
.modal-overlay-custom {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    /* align-items was "center": if the dialog is taller than the screen,
       centering clips it top and bottom with no way to scroll to the rest.
       flex-start + margin:auto on the dialog (below) centers it when it
       fits, and scrolls normally from the top when it doesn't. */
    align-items: flex-start;
    justify-content: center;
    z-index: 20000;
    padding: 1rem;
    /* overflow-y was "hidden": that made every modal using this class
       impossible to scroll, no matter what its content did. */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.3s ease;
}

html {
    scrollbar-gutter: stable;
}

html, body {
    overflow-x: hidden;
}

body.modal-open-custom {
    padding-right: var(--scrollbar-compensation, 0px);
}

.modal-content-custom,
.modal-content-custom * {
    box-sizing: border-box;
}

#ReportComment .modal-content-custom,
#ReportPresent .modal-content-custom {
    margin-left: auto;
    margin-right: auto;
}

.modal-overlay-custom .modal-dialog {
   /* width: 100%;
    max-width: 100%;*/
    margin: auto 1rem; /* auto top/bottom = centered when short, scrollable when tall */
}

#ReportComment .modal-dialog,
#ReportPresent .modal-dialog {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    width: 100%;
}

#ReportComment .modal-content,
#ReportPresent .modal-content {
    background: transparent;
    box-shadow: none;
    border: 0;
}

#ReportComment .modal-content-custom,
#ReportPresent .modal-content-custom {
    margin-top: 0;
    max-height: calc(100vh - 4rem);
}

#ReportComment.modal-overlay-custom,
#ReportPresent.modal-overlay-custom {
    overflow: hidden;
}

#ReportComment.modal-overlay-custom .modal-dialog,
#ReportPresent.modal-overlay-custom .modal-dialog {
    max-height: calc(100vh - 2rem);
}

#ReportComment.modal-overlay-custom .modal-body-custom,
#ReportPresent.modal-overlay-custom .modal-body-custom {
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-overlay-custom .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    overflow-x: hidden;
}

#Connect.modal-overlay-custom {
    padding: 1rem !important;
    width: 100%;
}

#Connect.modal-overlay-custom .modal-dialog {
    width: 100%;
    max-width: 650px;
    margin: 0;
}

#Connect.modal-overlay-custom #modalContent {
    width: 100%;
    max-width: 100%;
}

#Connect {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    overflow-y: auto;
    padding: calc(env(safe-area-inset-top, 0px) + 1rem) 1rem 1rem;
}

.modal-overlay-custom.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content-custom {
    background: linear-gradient(135deg, rgba(26, 35, 50, 0.98), rgba(15, 25, 35, 0.98));
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    max-height: calc(100vh - 7rem);
    animation: modalSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    margin: auto 0; /* centered when short, scrollable from the top when tall */
}

@media (max-height: 750px), (max-width: 576px) {
    .modal-content-custom {
        margin-top: calc(var(--navbar-height, 90px) * 0.25);
    }
}

@media (max-height: 750px) {
    .modal-content-custom {
        max-height: calc(100vh - (var(--navbar-height, 90px) + 2rem));
    }

    .modal-body-custom {
        max-height: calc(100vh - (var(--navbar-height, 90px) + 10rem));
        overflow-y: auto;
    }
}

@media (max-width: 576px) {
    .modal-overlay-custom {
        padding: .75rem;
    }

    .modal-content-custom {
        max-width: 100%;
        border-radius: 16px;
    }
}

.modal-body-custom {
    overflow-y: auto;
    max-height: calc(100vh - 14rem);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header-custom {
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.modal-header-custom::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    opacity: 0.1;
    background: radial-gradient(circle at center, currentColor 0%, transparent 70%);
}

.modal-icon-custom {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.modal-icon-custom::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.3;
    animation: iconGlow 2s ease-in-out infinite;
}

@keyframes iconGlow {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.1; }
}

.modal-content-custom.success .modal-header-custom {
    border-bottom: 3px solid #4caf50;
    color: #4caf50;
}

.modal-content-custom.success .modal-icon-custom {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(102, 187, 106, 0.2));
    border: 3px solid #4caf50;
    color: #4caf50;
}

.modal-content-custom.success .modal-icon-custom::before {
    background: #4caf50;
}

.modal-content-custom.info .modal-header-custom {
    border-bottom: 3px solid #0088ff;
    color: #0088ff;
}

.modal-content-custom.info .modal-icon-custom {
    background: linear-gradient(135deg, rgba(0, 136, 255, 0.2), rgba(0, 212, 255, 0.2));
    border: 3px solid #0088ff;
    color: #0088ff;
}

.modal-content-custom.info .modal-icon-custom::before {
    background: #0088ff;
}

.modal-content-custom.warning .modal-header-custom {
    border-bottom: 3px solid #ff9800;
    color: #ff9800;
}

.modal-content-custom.warning .modal-icon-custom {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 193, 7, 0.2));
    border: 3px solid #ff9800;
    color: #ff9800;
}

.modal-content-custom.warning .modal-icon-custom::before {
    background: #ff9800;
}

.modal-content-custom.danger .modal-header-custom {
    border-bottom: 3px solid #f44336;
    color: #f44336;
}

.modal-content-custom.danger .modal-icon-custom {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.2), rgba(229, 115, 115, 0.2));
    border: 3px solid #f44336;
    color: #f44336;
}

.modal-content-custom.danger .modal-icon-custom::before {
    background: #f44336;
}

.modal-title-custom {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    position: relative;
}

.modal-body-custom {
    padding: 1.5rem 2rem;
}

.modal-message-custom {
    color: #ccc;
    line-height: 1.6;
    font-size: 1rem;
    text-align: center;
}

.modal-footer-custom {
    padding: 1.5rem 2rem 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-button-custom {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    min-width: 120px;
}

.modal-button-custom:hover {
    transform: translateY(-2px);
}

.modal-button-custom.primary {
    color: #fff;
}

.modal-content-custom.success .modal-button-custom.primary {
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.modal-content-custom.success .modal-button-custom.primary:hover {
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.modal-content-custom.info .modal-button-custom.primary {
    background: linear-gradient(135deg, #0088ff, #00d4ff);
    box-shadow: 0 4px 15px rgba(0, 136, 255, 0.3);
}

.modal-content-custom.info .modal-button-custom.primary:hover {
    box-shadow: 0 6px 20px rgba(0, 136, 255, 0.5);
}

.modal-content-custom.warning .modal-button-custom.primary {
    background: linear-gradient(135deg, #ff9800, #ffc107);
    color: #000;
    box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.modal-content-custom.warning .modal-button-custom.primary:hover {
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.5);
}

.modal-content-custom.danger .modal-button-custom.primary {
    background: linear-gradient(135deg, #f44336, #e57373);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.3);
}

.modal-content-custom.danger .modal-button-custom.primary:hover {
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.5);
}

.modal-button-custom.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.modal-button-custom.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.close-button-custom {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.close-button-custom:hover {
    background: rgba(255, 0, 0, 0.3);
    border-color: #ff0000;
    transform: rotate(90deg);
}

.spinner-modal .modal-content-custom {
    background: transparent;
    box-shadow: none;
    max-width: 200px;
    display: flex; 
    justify-content: center;
    align-items: center;
}
 
 .spinner-modal {
     display: flex; 
     z-index: 2147483647; 
 }

.modal-overlay-custom.show {
    display: flex;
}


#Spinner {
    display: none;
}

#Spinner.show {
    display: flex;
}

.spinner-modal {
    justify-content: center;
    align-items: center;
}

@media (max-width: 768px) {
    .modal-content-custom {
        max-width: 100%;
        margin: 1rem;
    }

    .modal-header-custom {
        padding: 1.5rem;
    }

    .modal-icon-custom {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .modal-title-custom {
        font-size: 1.5rem;
    }

    .modal-body-custom {
        padding: 1rem 1.5rem;
    }

    .modal-footer-custom {
        flex-direction: column;
        padding: 1rem 1.5rem 1.5rem;
    }

    .modal-button-custom {
        width: 100%;
    }
}


/* Terms & Conditions modal (#termsModal): the fifa-* classes had no CSS
   anywhere, and the inline style="overflow:unset!important" on the markup
   was cancelling any scrolling we set here. Keep the header, law badges,
   checkbox row and footer pinned in place; only the long body text
   scrolls. This is what makes the Accept button always reachable. */
#termsModal .modal-dialog.fifa-modal-dialog {
    width: 100%;
    max-width: 650px;
    margin: auto;
}

#termsModal .modal-content.fifa-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100vh - 2rem);
    overflow: hidden; /* clips to the rounded card; body scrolls internally */
    background: linear-gradient(135deg, rgba(26, 35, 50, 0.98), rgba(15, 25, 35, 0.98));
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

#termsModal .fifa-modal__header,
#termsModal .fifa-modal__law-badge,
#termsModal .fifa-modal__check-row,
#termsModal .fifa-modal__footer {
    flex: 0 0 auto; /* never shrink and never scroll away */
}

#termsModal .fifa-modal__body {
    flex: 1 1 auto;
    min-height: 0; /* required so a flex child can actually scroll */
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 1.5rem 2rem;
}

#termsModal .fifa-modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 2rem 0.5rem;
    color: #fff;
}

#termsModal .fifa-modal__title-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

#termsModal .fifa-modal__title { margin: 0; font-size: 1.3rem; }
#termsModal .fifa-modal__subtitle { color: #aaa; font-size: 0.85rem; }

#termsModal .fifa-modal__close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    flex-shrink: 0;
}

#termsModal .fifa-modal__law-badge {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 2rem 1rem;
}

#termsModal .fifa-badge {
    background: rgba(0, 255, 157, 0.1);
    border: 1px solid rgba(0, 255, 157, 0.3);
    color: #00ff9d;
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
}

#termsModal .fifa-section { color: #ccc; margin-bottom: 1.25rem; }
#termsModal .fifa-section__hd { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; color: #00ff9d; font-weight: 600; }

#termsModal .fifa-modal__check-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

#termsModal .fifa-checkbox {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    border: 2px solid rgba(0, 255, 157, 0.5);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#termsModal .fifa-checkbox.is-checked { background: rgba(0, 255, 157, 0.15); border-color: #00ff9d; }
#termsModal .fifa-checkbox-label { color: #ccc; font-size: 0.9rem; }

#termsModal .fifa-modal__footer {
    padding: 1rem 2rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

#termsModal .fifa-modal__footer-note { color: #888; font-size: 0.75rem; }

#termsModal .fifa-modal__footer-btns {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

#termsModal .fifa-btn {
    padding: 0.7rem 1.4rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

#termsModal .fifa-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#termsModal .fifa-btn--primary {
    background: linear-gradient(135deg, #00ff9d, #00d4ff);
    color: #0a1628;
}

@media (max-width: 576px) {
    #termsModal .fifa-modal__header,
    #termsModal .fifa-modal__law-badge,
    #termsModal .fifa-modal__body,
    #termsModal .fifa-modal__check-row,
    #termsModal .fifa-modal__footer {
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    #termsModal .fifa-modal__footer {
        flex-direction: column;
        align-items: stretch;
    }

    #termsModal .fifa-modal__footer-btns {
        margin-left: 0;
        width: 100%;
    }

    #termsModal .fifa-btn {
        flex: 1;
        justify-content: center;
    }
}

#Display .modal-dialog { display: flex; align-items: center; }
#Display #DisplayContent .video-display-container { padding: 1rem !important; border-radius: 0 !important; border: none !important; margin: 0 !important; }
#Display #DisplayContent .video-display-header { display: none !important; }
#Display #DisplayContent .video-title { font-size: 1rem !important; margin-bottom: 0.5rem !important; }
#Display #DisplayContent .video-content-wrapper { padding: 0.5rem !important; margin: 0 !important; }
#Display #DisplayContent .video-player-section { margin-bottom: 0 !important; }
#Display #DisplayContent .video-player-container { max-width: 100% !important; margin: 0 !important; }
#Display #DisplayContent .video-player-container iframe { height: 400px !important; }
#Display #DisplayContent .fifa-modal-footer { display: none !important; }
@media (max-width: 768px) { #Display .modal-dialog { width: 95vw !important; max-width: 95vw !important; } #Display #DisplayContent .video-player-container iframe { height: 300px !important; } }
