/* Custom Bootstrap Overrides & Enhancements */
:root {
    --bs-primary: #6366f1;
    --bs-primary-rgb: 99, 102, 241;
    --bs-secondary: #ec4899;
    --bs-success: #10b981;
    --bs-danger: #ef4444;
    --bs-warning: #f59e0b;
    --bs-info: #06b6d4;
    --bs-dark: #0a0e27;
    --bs-light: #f8f9fa;
}

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

body {
    background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 30%, #2d1b4e 60%, #1a1f3a 100%);
    background-attachment: fixed;
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Connection Badge */
.connection-badge {
    z-index: 1050;
}

.indicator-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--bs-danger);
    animation: pulse-dot 2s infinite;
}

.indicator-dot.connected {
    background-color: var(--bs-success);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Gradient Primary Background */
.bg-gradient-primary {
    background: linear-gradient(135deg, var(--bs-primary) 0%, var(--bs-secondary) 100%) !important;
}

/* Cards */
.card {
    border-radius: 16px !important;
    backdrop-filter: blur(10px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.stat-card {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.stat-card .text-primary {
    color: #ffffff !important;
}

.stat-card .text-warning {
    color: #ffffff !important;
}

.stat-card .text-success {
    color: #ffffff !important;
}

.stat-card .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
}

.timer-card .text-success {
    animation: pulse-timer 1s infinite;
}

@keyframes pulse-timer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Target Color Section */
.target-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse-glow 2s infinite;
    z-index: 0;
}

@keyframes pulse-glow {
    0%, 100% { 
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% { 
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.target-color-box {
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease;
}

.target-color-box:hover {
    transform: scale(1.05);
}

/* Color Grid Boxes */
.color-box {
    aspect-ratio: 1;
    border-radius: 12px;
    cursor: pointer;
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: rgba(26, 31, 58, 0.5);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.color-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(236, 72, 153, 0.1));
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1;
}

.color-box:hover {
    transform: scale(1.08) translateY(-2px);
    border-color: var(--bs-primary);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.color-box:hover::before {
    opacity: 1;
}

.color-box:active {
    transform: scale(0.96);
}

.color-box.correct {
    animation: correct-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-color: var(--bs-success) !important;
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6) !important;
}

.color-box.wrong {
    animation: wrong-wiggle 0.5s ease;
    border-color: var(--bs-danger) !important;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5) !important;
}

@keyframes correct-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2) rotate(5deg); }
    100% { transform: scale(1); }
}

@keyframes wrong-wiggle {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    25% { transform: translateX(-12px) rotate(-5deg); }
    75% { transform: translateX(12px) rotate(5deg); }
}

/* Buttons */
.btn {
    border-radius: 12px !important;
    transition: all 0.2s ease;
    font-weight: 600;
}

.btn-lg {
    padding: 14px 20px;
    font-size: 1rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--bs-primary), #4f46e5) !important;
    border: none !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--bs-secondary), #db2777) !important;
    border: none !important;
}

.btn-outline-light {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px);
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
}

/* Alerts */
.alert {
    border-radius: 12px !important;
    border: none !important;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: rgba(16, 185, 129, 0.2) !important;
    color: var(--bs-success) !important;
    border: 2px solid rgba(16, 185, 129, 0.4) !important;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: var(--bs-danger) !important;
    border: 2px solid rgba(239, 68, 68, 0.4) !important;
}

/* Modal */
.modal-content {
    border-radius: 20px !important;
    background: rgba(26, 31, 58, 0.98) !important;
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff;
}

.modal-header {
    border-radius: 20px 20px 0 0 !important;
}

.modal-body {
    background: transparent;
}

/* Nav Tabs */
.nav-tabs {
    border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
}

.nav-tabs .nav-link {
    color: rgba(255, 255, 255, 0.6) !important;
    border: none !important;
    border-bottom: 2px solid transparent !important;
    border-radius: 0 !important;
    padding: 10px 16px;
}

.nav-tabs .nav-link:hover {
    color: rgba(255, 255, 255, 0.8) !important;
    border-color: transparent !important;
}

.nav-tabs .nav-link.active {
    color: var(--bs-primary) !important;
    background: transparent !important;
    border-bottom-color: var(--bs-primary) !important;
}

/* Leaderboard Items */
.list-group-item {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
    border-radius: 10px !important;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.list-group-item:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateX(4px);
}

.list-group-item:first-child {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: #1a1f3a !important;
    font-weight: 800;
    border-color: #f59e0b !important;
}

.list-group-item.your-score {
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: var(--bs-primary) !important;
    font-weight: 700;
}

/* Share Buttons */
.btn-outline-primary {
    border-color: rgba(99, 102, 241, 0.5) !important;
    color: var(--bs-primary) !important;
}

.btn-outline-primary:hover {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: white !important;
}

.btn-outline-danger {
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
}

.btn-outline-danger:hover {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
}

.btn-outline-dark {
    border-color: rgba(0, 0, 0, 0.5) !important;
    color: #000000 !important;
}

.btn-outline-dark:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    color: white !important;
}

.btn-outline-success {
    border-color: rgba(37, 211, 102, 0.5) !important;
    color: #25d366 !important;
}

.btn-outline-success:hover {
    background: #25d366 !important;
    border-color: #25d366 !important;
    color: white !important;
}

.btn-outline-info {
    border-color: rgba(6, 182, 212, 0.5) !important;
    color: var(--bs-info) !important;
}

.btn-outline-info:hover {
    background: var(--bs-info) !important;
    border-color: var(--bs-info) !important;
    color: white !important;
}

/* Badges */
.badge {
    border-radius: 8px !important;
    font-weight: 600;
}

/* Scrollbar */
.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-track {
    background: transparent;
}

.tab-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

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

/* Responsive */
@media (max-width: 480px) {
    .container-fluid {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    .card-body {
        padding: 12px !important;
    }
    
    .target-color-box {
        width: 80px !important;
        height: 80px !important;
    }
    
    .target-glow {
        width: 100px;
        height: 100px;
    }
    
    .h3 {
        font-size: 1.2rem !important;
    }
    
    .h4 {
        font-size: 1.3rem !important;
    }
    
    .btn-lg {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

/* Prevent text selection on interactive elements */
.btn, .color-box, .badge {
    user-select: none;
    -webkit-user-select: none;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}
