/* Global Variables */
:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --font-main: 'Outfit', sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: #f3f4f6;
    overflow: hidden; /* Prevent body scroll, handle inside main container */
}

/* Animated Background */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 10s infinite ease-in-out;
}

.blob-1 { width: 400px; height: 400px; background: #ff9a9e; top: -100px; left: -100px; }
.blob-2 { width: 500px; height: 500px; background: #a18cd1; bottom: -150px; right: -100px; animation-delay: 2s; }
.blob-3 { width: 300px; height: 300px; background: #fbc2eb; top: 40%; left: 40%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}

/* Sidebar Styling */
#wrapper {
    overflow-x: hidden;
}

#sidebar-wrapper {
    min-height: 100vh;
    margin-left: -17rem; /* Hidden by default on mobile via neg margin logic or toggle */
    transition: margin 0.25s ease-out;
    width: 17rem;
    position: fixed;
    z-index: 1000;
    height: 100%;
    /* Glass Effect */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--glass-border);
    box-shadow: 5px 0 15px rgba(0,0,0,0.05);
}

#sidebar-wrapper .sidebar-heading {
    padding: 0.875rem 1.25rem;
    font-size: 1.2rem;
}

#page-content-wrapper {
    width: 100%;
    transition: margin 0.25s ease-out; /* Smooth transition for content push */
}

/* Toggled State */
body.sb-sidenav-toggled #sidebar-wrapper {
    margin-left: 0;
}

/* Desktop Logic: Show sidebar by default */
@media (min-width: 768px) {
    #sidebar-wrapper {
        margin-left: 0; /* Visible */
        position: relative; /* Push content */
    }

    #page-content-wrapper {
        margin-left: 0;
    }

    body.sb-sidenav-toggled #sidebar-wrapper {
        margin-left: -17rem; /* Hide on toggle */
    }
}

/* Glass Components */
.glass-navbar {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    margin: 1rem 1.5rem 0.5rem 1.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
}

.glass-input {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.8);
    backdrop-filter: blur(5px);
    border-radius: 10px;
}
.glass-input:focus {
    background: rgba(255,255,255,0.95);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* Buttons */
.btn-glass {
    background: rgba(255,255,255,0.5);
    border: 1px solid rgba(255,255,255,0.6);
    color: var(--text-main);
    transition: all 0.2s;
    border-radius: 10px;
    font-weight: 600;
}
.btn-glass:hover {
    background: white;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.btn-primary-glass {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-primary-glass:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-success-glass {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
}
.btn-success-glass:hover {
    background: #059669;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Scoreboard Grid */
.score-header-row > div, .score-footer-row > div, .score-row > div {
    flex: 1;
    padding: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    word-break: break-all;
}

.score-row {
    display: flex;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    animation: fadeIn 0.3s ease;
}
.score-row:hover {
    background: rgba(255,255,255,0.3);
}

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

/* Logo Animation (Large) */
.hazari-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    position: relative;
    perspective: 500px;
}
.hazari-logo .card {
    width: 70px;
    height: 100px;
    background: linear-gradient(135deg, #ffffff, #f0f0f0);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.5rem;
    position: absolute;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid #ddd;
}
.card-left { transform: translateX(-25px) rotate(-15deg); z-index: 1; color: #ef4444; }
.card-right { transform: translateX(25px) rotate(15deg); z-index: 1; color: #ef4444; }
.card-center { transform: translateY(-10px); z-index: 2; color: #1e293b; font-size: 1.8rem !important; }

.hazari-logo:hover .card-left { transform: translateX(-45px) rotate(-25deg) translateY(-5px); }
.hazari-logo:hover .card-right { transform: translateX(45px) rotate(25deg) translateY(-5px); }
.hazari-logo:hover .card-center { transform: translateY(-20px) scale(1.1); }

/* Mini Logo (Sidebar) */
.mini-logo-container {
    height: 40px;
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}
.mini-card {
    width: 25px;
    height: 36px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    position: absolute;
    font-size: 0.7rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}
.card-l { transform: translateX(-10px) rotate(-15deg); z-index: 1; color: #ef4444; }
.card-r { transform: translateX(10px) rotate(15deg); z-index: 1; color: #ef4444; }
.card-c { z-index: 2; color: #1e293b; transform: translateY(-3px); }

/* Overlay */
.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 2000;
    display: none; justify-content: center; align-items: center;
    backdrop-filter: blur(5px);
}
.overlay.active { display: flex; }

.trophy-anim {
    font-size: 5rem;
    animation: rotate 3s infinite linear;
    display: inline-block;
}
@keyframes rotate { 0% { transform: rotateY(0deg); } 100% { transform: rotateY(360deg); } }

#confetti-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }

.winner-highlight {
    color: #10b981;
    position: relative;
}
.winner-highlight::after {
    content: '👑';
    position: absolute;
    top: -15px; left: 50%; transform: translateX(-50%);
    font-size: 1rem;
}

/* Helper */
.cursor-pointer { cursor: pointer; }
.match-item {
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}
.match-item:hover { background: rgba(255,255,255,0.6); }
.match-item.active { background: rgba(99, 102, 241, 0.1); border-left: 3px solid var(--primary); }
