/* =====================================================
   Overlay Manager Styles
   =====================================================
   Centralized styles for the OverlayManager system
   Handles backdrop, transitions, modals, and loading states
*/

/* =====================================================
   Backdrop / Scrim
   ===================================================== */
.overlay-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    display: none;
    opacity: 0;
    transition: opacity 300ms ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.overlay-backdrop.show {
    opacity: 1;
}

/* =====================================================
   Overlay Base Transitions
   ===================================================== */
.overlay {
    transition: opacity 300ms ease;
}

.overlay.is-hidden {
    pointer-events: none;
}

/* =====================================================
   Modal Overlays
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary, #ffffff);
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 14px 40px rgba(25, 40, 80, 0.2);
    animation: modalFadeIn 300ms ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-title {
    margin: 0 0 16px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
}

.modal-body {
    margin-bottom: 24px;
    color: var(--text-secondary, #4a4a4a);
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 16px;
}

.modal-body p {
    margin: 0 0 12px 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-buttons .btn {
    min-width: 100px;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms ease;
}

.modal-buttons .btn.primary {
    background: #2563eb;
    color: white;
}

.modal-buttons .btn.primary:hover {
    background: #1d4ed8;
}

.modal-buttons .btn.secondary {
    background: #e5e7eb;
    color: #374151;
}

.modal-buttons .btn.secondary:hover {
    background: #d1d5db;
}

.modal-buttons .btn.danger {
    background: #dc2626;
    color: white;
}

.modal-buttons .btn.danger:hover {
    background: #b91c1c;
}

.modal-buttons .btn.success {
    background: #16a34a;
    color: white;
}

.modal-buttons .btn.success:hover {
    background: #15803d;
}

/* Additional color variants for Face-Off and other modals */
.modal-buttons .btn.gray {
    background: linear-gradient(180deg, #f5f5f5, #e0e0e0);
    color: #555;
    border: 2px solid #ccc;
}

.modal-buttons .btn.gray:hover {
    background: linear-gradient(180deg, #ebebeb, #d5d5d5);
}

.modal-buttons .btn.green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.modal-buttons .btn.green:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.modal-buttons .btn.blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.modal-buttons .btn.blue:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.modal-buttons .btn.purple {
    background: linear-gradient(135deg, #9d60ff, #7b39e6);
    color: white;
    box-shadow: 0 3px 10px rgba(157, 96, 255, 0.30);
}

.modal-buttons .btn.purple:hover {
    background: linear-gradient(135deg, #8b4fe6, #6a2dd4);
}

.modal-buttons .btn.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 3px 10px rgba(245, 158, 11, 0.30);
}

.modal-buttons .btn.orange:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

/* =====================================================
   Loading Overlay
   ===================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.loading-content {
    text-align: center;
    color: white;
    font-size: 1.2rem;
}

.loading-content .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-content p {
    margin: 0;
    font-weight: 500;
}

/* =====================================================
   Dark Mode Support
   ===================================================== */
body.dark-mode .modal-content {
    background: #1f2937;
    color: #f9fafb;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.4);
}

body.dark-mode .modal-title {
    color: #f9fafb;
}

body.dark-mode .modal-body {
    color: #d1d5db;
}

body.dark-mode .modal-buttons .btn.secondary {
    background: #374151;
    color: #f9fafb;
}

body.dark-mode .modal-buttons .btn.secondary:hover {
    background: #4b5563;
}

body.dark-mode .overlay-backdrop {
    background: rgba(0, 0, 0, 0.75);
}

/* =====================================================
   Mobile Responsiveness
   ===================================================== */
@media (max-width: 600px) {
    .modal-overlay {
        padding: 0px;
        justify-content: center;
        align-items: center;
    }

    .modal-content {
        padding: 24px 20px;
        max-width: 100%;
        width: 100%;
        margin: 0 auto;
    }

    .modal-title {
        font-size: 1.25rem;
    }

    .modal-body {
        font-size: 0.95rem;
    }

    .modal-buttons {
        flex-direction: column-reverse;
    }

    .modal-buttons .btn {
        width: 100%;
        min-width: auto;
    }
}

/* =====================================================
   Accessibility
   ===================================================== */
.modal-overlay:focus-within .modal-content {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .overlay,
    .overlay-backdrop,
    .modal-content,
    .modal-buttons .btn {
        transition: none;
        animation: none;
    }
}

/* =====================================================
   Z-Index Management
   ===================================================== */
/* Ensure proper stacking order:
   - Backdrop: 999
   - Overlays: 1000+
   - Modals: 1100+
   - Loading: 1200+
   - Drawer: 1300 (if needed)
*/

/* =====================================================
   Face-Off Modal Styling
   ===================================================== */
.faceoff-title-centered .modal-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, #e53935 0%, #ff7043 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.5px;
}
