/* public/css/styles.css */

:root {
    --bg: #0f172a;
    --bg-card: #1e293b;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #22c55e;
    --danger: #ef4444;
    --gold: #facc15;
    --radius: 0.75rem;
    --transition: 0.2s ease;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
}

.font-display { font-family: 'Orbitron', sans-serif; }

.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.input, .select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text);
    width: 100%;
    transition: border-color var(--transition);
}

.input:focus, .select:focus { outline: none; border-color: var(--accent); }

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--bg);
    border: none;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--text); background: rgba(255,255,255,0.05); }

.nav-tab {
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ========================================== 
   BALLS (FIXED)
   ========================================== */

/* 1. Base Ball (Used in Tables/Cards) */
.ball {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ball-default {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border);
    color: var(--text);
}

/* 2. Large Ball (Used in Lucky Generator OUTPUT) */
.ball-large {
    width: 52px;
    height: 52px;
    border-radius: 50% !important; /* FORCE CIRCLE */
    display: inline-flex;          /* FORCE CENTERING */
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    margin: 4px;
}

/* 3. History Ball (Used in Saved List) */
.ball-history {
    width: 32px;
    height: 32px;
    border-radius: 50% !important; /* FORCE CIRCLE */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    margin: 2px;
}

/* Winner Styles (Applied on top of size classes) */
.ball-winner {
    background: linear-gradient(135deg, #fde047, #eab308);
    color: #422006;
    border: 2px solid #facc15;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
}

/* ========================================== 
   PROGRESS & GRID
   ========================================== */

.progress-track {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill-red { background-color: #ef4444; height: 100%; border-radius: 999px; transition: width 0.5s; }
.progress-fill-blue { background-color: #3b82f6; height: 100%; border-radius: 999px; transition: width 0.5s; }
.progress-fill-sky { background-color: #38bdf8; height: 100%; border-radius: 999px; transition: width 0.5s; }
.progress-fill-purple { background-color: #a855f7; height: 100%; border-radius: 999px; transition: width 0.5s; }

.number-grid {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 0.5rem;
}
@media (max-width: 768px) { .number-grid { grid-template-columns: repeat(7, 1fr); } }

.num-ball {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    transition: all 0.15s ease;
}
.num-ball:hover { border-color: var(--accent); }
.num-ball.selected {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

.saved-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
@media (max-width: 640px) { .saved-grid { grid-template-columns: 1fr; } }

/* Tooltip */
.tooltip-container { position: relative; display: inline-block; cursor: pointer; }
.tooltip-text {
    visibility: hidden; width: 220px; background-color: #1e293b; color: #fff;
    text-align: center; border-radius: 6px; padding: 8px;
    position: absolute; z-index: 1; bottom: 125%; left: 50%;
    margin-left: -110px; opacity: 0; transition: opacity 0.3s;
    font-size: 0.75rem; border: 1px solid var(--border);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }

/* Chart Tooltip */
#chartTooltip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 100;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
#chartTooltip.active { opacity: 1; }

/* Select Option Disabled State */
option:disabled { color: #64748b; background-color: #1e293b; }

/* Print Styles */
@media print {
    body { background: white; }
    .no-print { display: none !important; }
    body > div:first-child > *:not(#section-generator) { display: none !important; }
    #section-generator { display: block !important; visibility: visible !important; position: absolute; left: 0; top: 0; width: 100%; }
    #section-generator .space-y-6:first-child, #section-generator .flex.gap-3 { display: none !important; }
    #printArea { border: none !important; background: white !important; color: black !important; box-shadow: none !important; padding: 0 !important; }
    #printHeader { display: block !important; border-bottom: 2px solid #333 !important; padding-bottom: 15px; margin-bottom: 20px; text-align: center; }
    #printHeader h1 { font-size: 24px; color: black !important; }
    #printHeader p { color: #333 !important; }
    #genHistoryList { display: grid !important; grid-template-columns: 1fr 1fr; gap: 15px; }
    .history-item { border: 1px solid #ccc !important; padding: 10px; border-radius: 8px; page-break-inside: avoid; color: black !important; background: white !important; }
    .ball-history { border: 1px solid #333 !important; background: #f0f0f0 !important; color: black !important; }
}