/**
 * Super Bowl Squares - Custom CSS
 * Modern, interactive styling for the game
 */

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    --warning-gradient: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    --danger-gradient: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    --dark-bg: #1a1a2e;
    --light-bg: #f8f9fa;
    --border-radius: 15px;
    --transition: all 0.3s ease;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

/* Animations */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

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

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes slideInFromLeft {
    0% { transform: translateX(-100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideInFromRight {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Gradient Backgrounds */
.bg-gradient-primary {
    background: var(--primary-gradient);
}

.bg-gradient-success {
    background: var(--success-gradient);
}

.bg-gradient-warning {
    background: var(--warning-gradient);
}

.bg-gradient-danger {
    background: var(--danger-gradient);
}

/* Cards with Hover Effects */
.card-hover {
    transition: var(--transition);
    cursor: pointer;
}

.card-hover:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* Buttons */
.btn-gradient {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 30px;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn-gradient:hover::before {
    left: 100%;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

/* Game Grid Styling */
.game-grid-container {
    perspective: 1000px;
}

.game-grid {
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.game-grid:hover {
    transform: rotateX(2deg) rotateY(2deg);
}

.square-interactive {
    position: relative;
    transition: var(--transition);
    cursor: pointer;
}

.square-interactive::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, transparent, rgba(255, 215, 0, 0.3));
    opacity: 0;
    transition: opacity 0.3s;
}

.square-interactive:hover::before {
    opacity: 1;
}

.square-interactive.selected {
    animation: pulse 1s infinite;
    background: var(--warning-gradient) !important;
}

.square-interactive.winner {
    animation: float 3s ease-in-out infinite;
    background: var(--warning-gradient) !important;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.8);
}

/* Token Display */
.token-counter {
    background: var(--primary-gradient);
    color: white;
    border-radius: 50px;
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.token-counter .token-icon {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spin 3s linear infinite;
}

/* Player Avatars */
.player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    border: 3px solid white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.player-avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.5);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    animation: pulse 2s infinite;
}

/* Progress Bars */
.progress-animated {
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.progress-animated .progress-bar {
    background: var(--primary-gradient);
    background-size: 200% 100%;
    animation: shimmer 2s linear infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Tooltips */
.custom-tooltip {
    position: relative;
}

.custom-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    white-space: nowrap;
    font-size: 0.875rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.custom-tooltip:hover::after {
    opacity: 1;
}

/* Modal Styling */
.modal-custom {
    backdrop-filter: blur(5px);
}

.modal-custom .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideInFromTop 0.3s ease-out;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-custom .modal-header {
    background: var(--primary-gradient);
    color: white;
    border-radius: 20px 20px 0 0;
    border: none;
}

/* Form Elements */
.form-control-custom {
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    padding: 12px 15px;
    transition: var(--transition);
}

.form-control-custom:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    transform: translateY(-2px);
}

/* Switch Toggle */
.switch-toggle {
    position: relative;
    width: 60px;
    height: 30px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    transition: 0.4s;
    border-radius: 30px;
}

.switch-toggle .slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: 0.4s;
    border-radius: 50%;
}

.switch-toggle input:checked + .slider {
    background: var(--primary-gradient);
}

.switch-toggle input:checked + .slider:before {
    transform: translateX(30px);
}

/* Responsive Tables */
@media (max-width: 768px) {
    .table-responsive-custom {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table-responsive-custom table {
        min-width: 500px;
    }
}

/* Countdown Timer */
.countdown-timer {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.countdown-item {
    background: var(--primary-gradient);
    color: white;
    border-radius: 10px;
    padding: 15px;
    min-width: 80px;
    text-align: center;
}

.countdown-item .count {
    font-size: 2rem;
    font-weight: bold;
}

.countdown-item .label {
    font-size: 0.875rem;
    text-transform: uppercase;
    opacity: 0.9;
}

/* Chat Messages */
.chat-message {
    display: flex;
    margin-bottom: 15px;
    animation: slideInFromLeft 0.3s ease-out;
}

.chat-message.own {
    justify-content: flex-end;
    animation: slideInFromRight 0.3s ease-out;
}

.chat-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 15px;
    background: #e0e0e0;
    position: relative;
}

.chat-message.own .chat-bubble {
    background: var(--primary-gradient);
    color: white;
}

/* Stats Cards */
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary-gradient);
    opacity: 0.1;
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #333;
}

.stat-card .stat-label {
    color: #666;
    font-size: 0.875rem;
    text-transform: uppercase;
}

/* Mobile Optimizations */
@media (max-width: 576px) {
    .game-grid table {
        font-size: 0.75rem;
    }
    
    .square {
        width: 30px !important;
        height: 30px !important;
    }
    
    .btn-gradient {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background: var(--dark-bg);
        color: #e0e0e0;
    }
    
    .card, .modal-content {
        background: #2a2a3e;
        color: #e0e0e0;
    }
    
    .form-control-custom {
        background: #1a1a2e;
        border-color: #3a3a4e;
        color: #e0e0e0;
    }
    
    .table {
        color: #e0e0e0;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .game-grid {
        page-break-inside: avoid;
    }
}