/* 🎨 Enhanced Styles for Real-Time Competition Dashboard with Push Notifications 🎨 */

/* 🔔 Notification Banner Styles */
.notification-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    padding: 15px 20px;
    box-shadow: 0 4px 20px rgba(66, 153, 225, 0.3);
    transform: translateY(0);
    transition: all 0.3s ease;
}

.notification-banner.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.notification-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 15px;
}

.notification-banner-content i {
    font-size: 1.2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.notification-banner-actions {
    display: flex;
    gap: 10px;
}

.btn-enable-notifications,
.btn-dismiss-notifications {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 44px; /* iOS touch target */
    min-width: 44px;
}

.btn-enable-notifications {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-enable-notifications:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-dismiss-notifications {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    padding: 8px 12px;
}

.btn-dismiss-notifications:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* 🔄 Sync Status Indicator */
.sync-status {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 16px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.sync-status.connected {
    background: rgba(56, 161, 105, 0.95);
    color: white;
}

.sync-status.syncing {
    background: rgba(237, 137, 54, 0.95);
    color: white;
}

.sync-status.error {
    background: rgba(229, 62, 62, 0.95);
    color: white;
}

.sync-status.polling {
    background: rgba(49, 130, 206, 0.95);
    color: white;
}

.sync-status.offline {
    background: rgba(113, 128, 150, 0.95);
    color: white;
}

.sync-icon {
    font-size: 0.9rem;
}

/* 📱 Enhanced Touch Controls */
.enhanced-touch-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    touch-action: manipulation;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.enhanced-touch-btn:active {
    transform: scale(0.95);
}

/* Prevent zoom on input focus (mobile) */
input, select, textarea {
    font-size: 16px !important; /* Prevents zoom on iOS */
}

/* Enhanced button styles for better touch experience */
.refresh-btn,
.add-participant-btn {
    padding: 12px 20px;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.refresh-btn {
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(66, 153, 225, 0.3);
}

.add-participant-btn {
    background: linear-gradient(135deg, #38a169, #2f855a);
    color: white;
}

.add-participant-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(56, 161, 105, 0.3);
}

/* Enhanced Modal Close Buttons */
.close-modal,
.close-mobile-edit,
.close-add-participant {
    min-height: 44px !important;
    min-width: 44px !important;
    background: rgba(229, 62, 62, 0.1);
    border: none;
    border-radius: 50%;
    color: #e53e3e;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover,
.close-mobile-edit:hover,
.close-add-participant:hover {
    background: #e53e3e;
    color: white;
    transform: scale(1.05);
}

/* Enhanced Score Input Controls */
.score-btn {
    min-height: 44px !important;
    min-width: 44px !important;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    color: #4a5568;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.score-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

.score-btn:active {
    transform: translateY(0) scale(0.95);
    background: #e2e8f0;
}

.score-btn.plus {
    border-radius: 0 8px 8px 0;
    background: linear-gradient(135deg, #38a169, #2f855a);
    border-color: #38a169;
    color: white;
}

.score-btn.plus:hover {
    background: linear-gradient(135deg, #2f855a, #276749);
    box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
}

.score-btn.minus {
    border-radius: 8px 0 0 8px;
    background: linear-gradient(135deg, #e53e3e, #c53030);
    border-color: #e53e3e;
    color: white;
}

.score-btn.minus:hover {
    background: linear-gradient(135deg, #c53030, #9c1c1c);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

/* Enhanced Table for Mobile */
.results-table {
    font-size: 0.9rem;
}

.participant-name-btn {
    background: rgba(66, 153, 225, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    color: #3182ce;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.participant-name-btn:hover {
    background: rgba(66, 153, 225, 0.2);
    transform: translateY(-1px);
}

/* Enhanced Save Indicator */
.save-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #38a169;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(56, 161, 105, 0.3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.save-indicator.show {
    transform: translateY(0);
    opacity: 1;
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    /* Notification banner adjustments */
    .notification-banner-content {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .notification-banner-content span {
        font-size: 0.9rem;
    }

    /* Sync status positioning */
    .sync-status {
        top: 10px;
        right: 10px;
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    /* Enhanced touch targets for mobile */
    .enhanced-touch-btn {
        min-height: 48px !important;
        min-width: 48px !important;
    }

    /* Larger buttons for mobile */
    .refresh-btn,
    .add-participant-btn {
        padding: 15px 25px;
        min-height: 52px;
        font-size: 1rem;
        width: 100%;
        margin-bottom: 10px;
    }

    /* Action buttons container */
    .action-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    /* Table adjustments */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .results-table {
        font-size: 0.8rem;
    }

    .participant-name-btn {
        min-height: 40px;
        padding: 10px 8px;
        font-size: 0.85rem;
    }

    /* Score buttons in modals */
    .score-input-group {
        margin: 0 auto;
        max-width: 200px;
    }

    .score-btn {
        min-height: 50px !important;
        min-width: 50px !important;
        font-size: 1.4rem;
    }

    /* Modal improvements */
    .modal-content {
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .mobile-edit-content {
        margin: 0;
        border-radius: 20px 20px 0 0;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* Ultra-wide screen adjustments */
@media (min-width: 1400px) {
    .sync-status {
        top: 30px;
        right: 30px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .enhanced-touch-btn {
        min-height: 40px !important;
        min-width: 40px !important;
    }

    .save-indicator {
        bottom: 30px;
        right: 30px;
        padding: 14px 24px;
    }
}

/* Pull-to-refresh visual feedback */
.pull-to-refresh-indicator {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(66, 153, 225, 0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9998;
    font-size: 0.85rem;
    font-weight: 500;
}

.pull-to-refresh-indicator.show {
    opacity: 1;
    transform: translateX(-50%) translateY(20px);
}

/* Enhanced focus states for accessibility */
.enhanced-touch-btn:focus {
    outline: 3px solid rgba(66, 153, 225, 0.5);
    outline-offset: 2px;
}

.score-btn:focus {
    outline: 3px solid rgba(66, 153, 225, 0.5);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .notification-banner {
        background: #1a365d;
        border-bottom: 3px solid #3182ce;
    }

    .sync-status {
        border: 2px solid #2d3748;
    }

    .enhanced-touch-btn {
        border: 2px solid #2d3748;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .notification-banner,
    .sync-status,
    .enhanced-touch-btn,
    .save-indicator {
        transition: none;
        animation: none;
    }

    .sync-icon.fa-spin {
        animation: none;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .sync-status {
        background: rgba(45, 55, 72, 0.95);
        color: #f7fafc;
        border: 1px solid rgba(113, 128, 150, 0.3);
    }

    .save-indicator {
        background: #2d3748;
        color: #f7fafc;
    }
}

/* Container padding adjustment when notification banner is visible */
body:not(.notification-banner-hidden) .container {
    padding-top: 80px;
}

@media (max-width: 768px) {
    body:not(.notification-banner-hidden) .container {
        padding-top: 100px;
    }
}

/* Enhanced podium animations */
.podium-place {
    transition: transform 0.3s ease;
}

.podium-place:hover {
    transform: translateY(-5px);
}

/* Position-based row highlighting */
.results-table tr.position-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.1) 0%, transparent 100%);
    border-left: 4px solid #ffd700;
}

.results-table tr.position-2 {
    background: linear-gradient(90deg, rgba(192, 192, 192, 0.1) 0%, transparent 100%);
    border-left: 4px solid #c0c0c0;
}

.results-table tr.position-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.1) 0%, transparent 100%);
    border-left: 4px solid #cd7f32;
}

/* Touch feedback for all interactive elements */
.enhanced-touch-btn,
.participant-name-btn,
.score-btn {
    -webkit-tap-highlight-color: rgba(66, 153, 225, 0.2);
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Ensure proper z-index layering */
.notification-banner {
    z-index: 10000;
}

.sync-status {
    z-index: 9999;
}

.save-indicator {
    z-index: 9999;
}

.fullscreen-modal,
.mobile-edit-modal,
.add-participant-modal {
    z-index: 10001;
}

console.log("🎨 Enhanced CSS loaded with mobile-first design and notification system!");