/* Premium CSS Variables & Reset */
:root {
    --bg-primary: #0a0b10;
    --bg-secondary: #111422;
    --card-bg: rgba(22, 28, 45, 0.55);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --sidebar-w: 260px;

    /* Gamel/Brand Colors */
    --sangam: #a855f7;
    --chetak: #10b981;
    --super: #f59e0b;
    --mp_deluxe: #ec4899;
    --bhagya_rekha: #3b82f6;
    --diamond: #06b6d4;

    /* Glows & Gradients */
    --accent-purple: rgba(168, 85, 247, 0.25);
    --accent-blue: rgba(59, 130, 246, 0.25);
    --accent-gold: rgba(245, 158, 11, 0.25);

    --font-outfit: 'Outfit', sans-serif;
    --font-space: 'Space Grotesk', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-outfit);
    overflow-x: hidden;
    min-height: 100vh;
}

/* Beautiful Animated Background Glows */
.glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.glow-bg::before,
.glow-bg::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
    animation: drift 25s infinite alternate ease-in-out;
}

.glow-bg::before {
    background: var(--sangam);
    top: -100px;
    right: -100px;
}

.glow-bg::after {
    background: var(--bhagya_rekha);
    bottom: -150px;
    left: -150px;
    animation-delay: -5s;
}

@keyframes drift {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 80px) scale(1.2);
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Main Layout Grid */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-w);
    background-color: rgba(10, 11, 16, 0.85);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.brand-logo {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--sangam), var(--diamond));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.3));
}

.brand-text h2 {
    font-family: var(--font-space);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-item:hover,
.nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(168, 85, 247, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-color: rgba(168, 85, 247, 0.3);
    box-shadow: inset 0 0 12px rgba(168, 85, 247, 0.1);
}

.nav-item i {
    font-size: 1.1rem;
}

.sidebar-footer {
    margin-top: auto;
}

.status-indicator-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    position: relative;
}

.status-pulse.idle {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-pulse.running {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    animation: pulse 1.2s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.4);
        opacity: 1;
    }
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-w);
    padding: 2.5rem 3rem;
    min-height: 100vh;
}

/* Header Styling */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 2rem;
}

.header-title h1 {
    font-family: var(--font-space);
    font-weight: 700;
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 30%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-title p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background: linear-gradient(135deg, var(--sangam), var(--bhagya_rekha));
    color: white;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.35);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.45);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.08);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.09);
    transform: translateY(-2px);
}

.btn-icon {
    padding: 0.6rem;
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Section Controls */
.content-section {
    display: none;
    animation: fadeIn 0.4s ease-in-out forwards;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Metrics Grid Ribbon */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.15);
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.color-purple {
    background: rgba(168, 85, 247, 0.15);
    color: var(--sangam);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.1) inset;
}

.color-blue {
    background: rgba(59, 130, 246, 0.15);
    color: var(--bhagya_rekha);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.1) inset;
}

.color-orange {
    background: rgba(245, 158, 11, 0.15);
    color: var(--super);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.1) inset;
}

.metric-info {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-val {
    font-size: 1.8rem;
    font-family: var(--font-space);
    font-weight: 700;
    margin: 0.15rem 0;
}

.metric-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Games Grid section header */
.games-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.games-header-bar h2 {
    font-family: var(--font-space);
    font-weight: 600;
    font-size: 1.4rem;
}

.badge {
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Games Card Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.game-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.game-name {
    font-family: var(--font-space);
    font-weight: 600;
    font-size: 1.15rem;
}

.game-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: white;
}

.bg-sangam {
    background: var(--sangam);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.3);
}

.bg-chetak {
    background: var(--chetak);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.bg-super {
    background: var(--super);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.bg-mp_deluxe {
    background: var(--mp_deluxe);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

.bg-bhagya_rekha {
    background: var(--bhagya_rekha);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.bg-diamond {
    background: var(--diamond);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.game-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex-grow: 1;
}

.result-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 1.25rem;
    border-radius: 12px;
}

.result-lbl {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-number {
    font-family: var(--font-space);
    font-size: 2.2rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
}

/* Accuracy Indicators */
.accuracy-indicator {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.accuracy-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.accuracy-bar-fill {
    height: 100%;
    width: 0%;
    transition: width 1.2s ease-in-out;
}

.accuracy-text-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.predictions-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pred-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.balls-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
    border-radius: 12px;
    min-height: 80px;
    align-content: flex-start;
}

.ball {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #cbd5e1;
    transition: var(--transition);
}

.ball:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.ball.hit {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #34d399;
    color: white;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.no-predictions {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
    width: 100%;
    text-align: center;
    margin: auto;
}

/* Analytics Layout */
.analytics-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.panel-header h2 {
    font-family: var(--font-space);
    font-size: 1.3rem;
    font-weight: 600;
}

.panel-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.panel-body {
    padding: 2rem;
    flex-grow: 1;
}

.chart-container-wrapper {
    position: relative;
    width: 100%;
    height: 380px;
}

/* Data Table Styling */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    font-family: var(--font-space);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.small-table th,
.small-table td {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

/* Tabs System */
.tab-container {
    width: 100%;
}

.tab-headers {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 2rem;
}

.tab-header {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-muted);
    font-family: var(--font-outfit);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab-header:hover,
.tab-header.active {
    color: var(--text-primary);
}

.tab-header.active {
    border-bottom-color: var(--sangam);
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

/* Filter Bars */
.filter-bar {
    display: flex;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.15);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.filter-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.form-control {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    color: white;
    font-family: var(--font-outfit);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--sangam);
    background: rgba(255, 255, 255, 0.08);
}

select.form-control {
    cursor: pointer;
}

select.form-control option {
    background: var(--bg-secondary);
    color: white;
}

/* Logs / Console view */
.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.console-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.text-green {
    color: var(--chetak);
    filter: drop-shadow(0 0 5px rgba(16, 185, 129, 0.4));
}

.console-body {
    padding: 1.5rem;
    background: #06070a;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.console-output {
    height: 480px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.log-line {
    word-break: break-all;
    white-space: pre-wrap;
    padding-left: 1.25rem;
    position: relative;
}

.log-line::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.log-line.system-line {
    color: var(--diamond);
}

.log-line.info-line {
    color: #a3e635;
}

.log-line.error-line {
    color: var(--mp_deluxe);
}

/* Badge styling inside tables */
.status-pill {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill.hit {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.status-pill.miss {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.status-pill.pending {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Text alignments & utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .analytics-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        padding: 1.25rem 1.5rem;
    }

    .brand {
        margin-bottom: 1rem;
    }

    .nav-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .nav-item {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Login Overlay Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 11, 16, 0.95);
    backdrop-filter: blur(20px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}