/*
 * ARCADEVIBECODE
 * STAGE 5 — PART 2
 * AUTH, SUBMISSION AND ADMIN MODALS
 *
 * Ice Blue Arcade visual redesign.
 * CSS only — no backend changes.
 */

/* =====================================
   SHARED MODAL COLOURS
===================================== */

:is(#authModal, #submitModal, #adminModal) {
    --modal-navy: #071B34;
    --modal-blue: #1467B3;
    --modal-electric: #1598E6;
    --modal-ice: #A8DFFF;
    --modal-frost: #F2F9FF;
    --modal-steel: #6689A8;
    --modal-border: #D8E7F3;

    background-color: rgba(4, 15, 30, 0.78) !important;
    padding: 24px 12px;
}

/* Keep the existing JS modal show/hide behaviour.
   Do not override display or the hidden class. */

/* =====================================
   MODAL WINDOWS
===================================== */

:is(#authModal, #submitModal, #adminModal) > div {
    background: #FFFFFF !important;
    color: #071B34 !important;

    border: 1px solid #D8E7F3 !important;
    border-radius: 18px !important;

    box-shadow: 0 25px 75px rgba(0, 0, 0, 0.24);

    max-height: calc(100dvh - 48px);
    overflow-y: auto;
}

/* =====================================
   HEADINGS AND TEXT
===================================== */

:is(#authModal, #submitModal, #adminModal) h2,
:is(#authModal, #submitModal, #adminModal) h3,
:is(#authModal, #submitModal, #adminModal) h4 {
    color: #071B34 !important;
    letter-spacing: -0.025em;
}

:is(#authModal, #submitModal, #adminModal) h2 {
    font-weight: 900 !important;
}

:is(#authModal, #submitModal, #adminModal) label {
    color: #435E78 !important;
    font-weight: 700;
}

:is(#authModal, #submitModal, #adminModal) .text-gray-300,
:is(#authModal, #submitModal, #adminModal) .text-gray-400,
:is(#authModal, #submitModal, #adminModal) .text-gray-500 {
    color: #6689A8 !important;
}

/* =====================================
   CLOSE BUTTONS
===================================== */

:is(#authModal, #submitModal, #adminModal)
> div > button:first-child {
    color: #526E89 !important;
    background: #E4F2FD !important;

    width: 34px;
    height: 34px;

    border: 1px solid #D8E7F3 !important;
    border-radius: 50%;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 23px;
    line-height: 1;
}

:is(#authModal, #submitModal, #adminModal)
> div > button:first-child:hover {
    color: #FFFFFF !important;
    background: #1467B3 !important;
}

/* =====================================
   FORM FIELDS
===================================== */

:is(#authModal, #submitModal) input,
:is(#authModal, #submitModal) textarea,
:is(#authModal, #submitModal) select {
    background: #FFFFFF !important;
    color: #071B34 !important;

    border: 1px solid #C8DDED !important;
    border-radius: 9px !important;

    box-shadow: none !important;
    outline: none;

    min-height: 43px;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

:is(#authModal, #submitModal) textarea {
    min-height: 85px;
}

:is(#authModal, #submitModal) input:focus,
:is(#authModal, #submitModal) textarea:focus,
:is(#authModal, #submitModal) select:focus {
    border-color: #1598E6 !important;
    box-shadow: 0 0 0 3px rgba(21,152,230,0.13) !important;
}

:is(#authModal, #submitModal) input::placeholder,
:is(#authModal, #submitModal) textarea::placeholder {
    color: #829BB0 !important;
    opacity: 1;
}

:is(#authModal, #submitModal) select option {
    background: #FFFFFF;
    color: #071B34;
}

/* =====================================
   AUTHENTICATION MODAL
===================================== */

#authModal > div {
    max-width: 460px;
}

/* Login / Register / Magic Link tabs */

#authModal .flex.gap-2.mb-5 button {
    background: #E4F2FD !important;
    color: #1467B3 !important;

    border: 1px solid #C8E2F4 !important;
    border-radius: 8px !important;

    font-weight: 700;
    padding: 11px 8px;

    transition: background-color 0.2s ease;
}

#authModal .flex.gap-2.mb-5 button:hover {
    background: #D0EAFD !important;
}

/* Selected auth tab if state is exposed */

#authModal .flex.gap-2.mb-5 button.active,
#authModal .flex.gap-2.mb-5 button[aria-selected="true"],
#authModal .flex.gap-2.mb-5 button[aria-pressed="true"] {
    background: #1467B3 !important;
    color: #FFFFFF !important;
    border-color: #1467B3 !important;
}

/* Sign In / Register submit */

#authSubmitBtn {
    background: #1467B3 !important;
    color: #FFFFFF !important;

    border: 1px solid #1467B3 !important;
    border-radius: 9px !important;

    padding: 12px !important;
    font-weight: 800 !important;

    box-shadow: none !important;
}

#authSubmitBtn:hover {
    background: #0D548F !important;
}

/* Forgot password */

#authModal button[onclick*="resetPassword"] {
    color: #1467B3 !important;
    font-weight: 700;
}

/* Google and GitHub buttons */

#authModal button[onclick*="signInWithProvider"] {
    background: #F2F9FF !important;
    color: #071B34 !important;

    border: 1px solid #C8DDED !important;
    border-radius: 9px !important;

    padding: 11px;
}

#authModal button[onclick*="signInWithProvider"]:hover {
    background: #E4F2FD !important;
    border-color: #1598E6 !important;
}

/* =====================================
   SUBMIT GAME MODAL
===================================== */

#submitModal > div {
    max-width: 700px;
}

#submitModal form {
    color: #071B34;
}

#submitModal form > button[type="submit"] {
    background: #1467B3 !important;
    color: #FFFFFF !important;

    border: 1px solid #1467B3 !important;
    border-radius: 9px !important;

    font-weight: 800 !important;
    padding: 14px 20px !important;

    box-shadow: none !important;
}

#submitModal form > button[type="submit"]:hover {
    background: #0D548F !important;
}

/* Helpful field descriptions */

#submitModal form p {
    color: #6689A8 !important;
}

/* =====================================
   ADMIN MODERATION QUEUE
===================================== */

#adminModal > div {
    max-width: 900px;
}

#admin-queue-list {
    color: #071B34 !important;
}

/* Submission cards */

#admin-queue-list > div {
    background: #F2F9FF !important;

    border: 1px solid #D8E7F3 !important;
    border-radius: 12px !important;

    padding: 18px !important;
    margin-bottom: 12px;

    box-shadow: none !important;
}

/* Game names */

#admin-queue-list h3,
#admin-queue-list h4 {
    color: #071B34 !important;
    font-weight: 800 !important;
}

/* Descriptions and metadata */

#admin-queue-list p,
#admin-queue-list .text-gray-400,
#admin-queue-list .text-gray-300 {
    color: #526E89 !important;
}

/* Preview buttons */

#admin-queue-list button[class*="bg-white"],
#admin-queue-list button[class*="bg-gray"] {
    background: #E4F2FD !important;
    color: #1467B3 !important;

    border: 1px solid #C8DDED !important;
}

/* Approve — Green */

#admin-queue-list button[class*="bg-green"] {
    background: #168348 !important;
    color: #FFFFFF !important;

    border: 1px solid #168348 !important;
}

/* Reject — Amber */

#admin-queue-list button[class*="bg-orange"],
#admin-queue-list button[class*="bg-yellow"] {
    background: #FFF0CD !important;
    color: #865500 !important;

    border: 1px solid #E7CC87 !important;
}

/* Delete — Red */

#admin-queue-list button[class*="bg-red"] {
    background: #FFF0F1 !important;
    color: #B42332 !important;

    border: 1px solid #F2B8BD !important;
}

/* Shared moderation buttons */

#admin-queue-list button {
    border-radius: 8px !important;
    font-weight: 800 !important;
    padding: 9px 13px;

    box-shadow: none !important;
}

#admin-queue-list button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

/* =====================================
   ERROR AND SUCCESS MESSAGES
===================================== */

:is(#authModal, #submitModal, #adminModal)
[class*="bg-red-950"] {
    background: #FFF0F1 !important;
    border-color: #F2B8BD !important;
}

:is(#authModal, #submitModal, #adminModal)
.text-red-400 {
    color: #B42332 !important;
}

:is(#authModal, #submitModal, #adminModal)
.text-green-400 {
    color: #168348 !important;
}

/* =====================================
   KEYBOARD ACCESSIBILITY
===================================== */

:is(#authModal, #submitModal, #adminModal)
button:focus-visible,
:is(#authModal, #submitModal, #adminModal)
a:focus-visible {
    outline: 3px solid #1598E6 !important;
    outline-offset: 3px;
}

/* =====================================
   MOBILE OPTIMISATION
===================================== */

@media (max-width: 768px) {

    :is(#authModal, #submitModal, #adminModal) {
        padding: 12px 9px;
    }

    :is(#authModal, #submitModal, #adminModal) > div {
        padding: 24px 18px !important;
        border-radius: 13px !important;

        max-height: calc(100dvh - 24px);
    }

    #submitModal form > .grid {
        grid-template-columns: 1fr !important;
    }

    #admin-queue-list > div {
        padding: 14px !important;
    }

    #admin-queue-list button {
        min-height: 38px;
    }

    :is(#authModal, #submitModal) input,
    :is(#authModal, #submitModal) select,
    :is(#authModal, #submitModal) textarea {
        font-size: 16px !important;
    }
}

/* =====================================
   REDUCED MOTION
===================================== */

@media (prefers-reduced-motion: reduce) {

    :is(#authModal, #submitModal, #adminModal)
    button,
    :is(#authModal, #submitModal, #adminModal)
    input {
        transition: none !important;
    }
}

/* ==========================================
   ARCADEVIBECODE — THEATER MODAL
   Ice Blue Arcade theme
   Visual changes only — no functionality changed
========================================== */

#theaterModal {
    background: rgba(4, 15, 30, 0.82) !important;
    padding: 28px 18px !important;
}

/* Main theater window */
#theaterModal > div {
    background: #FFFFFF !important;
    color: #071B34 !important;
    border: 1px solid #D8E7F3 !important;
    border-radius: 18px !important;
    box-shadow: 0 25px 75px rgba(7, 27, 52, 0.30);
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
}

/* Keep the video/game player dark */
#theaterModal #theaterMediaContainer {
    background: #000000 !important;
}

#theaterModal > div > div:first-of-type {
    border: 1px solid #D8E7F3 !important;
    background: #000000 !important;
    border-radius: 12px !important;
}

/* Game title */
#theaterModal #theaterTitle {
    color: #071B34 !important;
    font-weight: 900 !important;
    letter-spacing: -0.03em;
}

/* Category and genre badges */
#theaterModal #theaterCategory {
    background: #E4F2FD !important;
    color: #1467B3 !important;
    border: 1px solid #ABD4F6 !important;
    border-radius: 6px;
}

/* Game description */
#theaterModal #theaterDesc {
    color: #426987 !important;
    font-size: 14px;
    line-height: 1.75;
    font-weight: 500 !important;
}

/* About This Game heading */
#theaterModal #theaterDesc::before {
    color: #071B34 !important;
    font-weight: 800;
}

/* Game information and secondary text */
#theaterModal h3,
#theaterModal h4,
#theaterModal strong {
    color: #071B34 !important;
}

#theaterModal .text-gray-300,
#theaterModal .text-gray-400,
#theaterModal .text-gray-500 {
    color: #6689A8 !important;
}

/* Voting panel */
#theaterModal #theaterVotes {
    color: #1467B3 !important;
    font-weight: 900 !important;
}

#theaterModal .bg-white\/5 {
    background: #F2F9FF !important;
    border-color: #D8E7F3 !important;
}

/* Upvote button */
#theaterModal #theaterUpvoteBtn {
    background: #1467B3 !important;
    color: #FFFFFF !important;
    border: 1px solid #1467B3 !important;
    border-radius: 9px;
    box-shadow: none !important;
}

#theaterModal #theaterUpvoteBtn:hover:not(:disabled) {
    background: #0E5596 !important;
}

/* Play Game button */
#theaterModal #primaryPlayBtn {
    background: #A8DFFF !important;
    color: #071B34 !important;
    border: 1px solid #83C9F3 !important;
    border-radius: 9px;
    box-shadow: none !important;
}

#theaterModal #primaryPlayBtn:hover:not(:disabled) {
    background: #83C9F3 !important;
}

/* Close button */
#theaterModal > div > button:first-child {
    background: #E4F2FD !important;
    color: #071B34 !important;
    border: 1px solid #D8E7F3 !important;
    box-shadow: 0 3px 12px rgba(7, 27, 52, 0.12);
}

#theaterModal > div > button:first-child:hover {
    background: #1467B3 !important;
    color: #FFFFFF !important;
}

/* Keyboard accessibility */
#theaterModal button:focus-visible {
    outline: 3px solid #1598E6 !important;
    outline-offset: 3px;
}

/* Mobile theater layout */
@media (max-width: 768px) {
    #theaterModal {
        padding: 12px 9px !important;
    }

    #theaterModal > div {
        padding: 18px !important;
        gap: 18px;
        max-height: calc(100dvh - 24px);
    }

    #theaterModal > div > div:first-of-type {
        min-height: 260px !important;
    }

    #theaterModal #theaterTitle {
        font-size: 26px !important;
    }

    #theaterModal > div > button:first-child {
        top: 8px !important;
        right: 8px !important;
    }
}


/* ==========================================================
   STAGE 10 — THEATER LAYOUT REFINEMENT
   The desktop and mobile Theater use the same Ice Blue look.
   Scope all rules to #theaterModal to protect other modals.
========================================================== */
#theaterModal { background:rgba(4,15,30,.84)!important; }
#theaterModal > .avc-theater-shell {
    background:#fff!important; color:#071B34!important;
    border:1px solid #C8E2F4!important; border-radius:18px!important;
    padding:24px!important; width:min(1160px,calc(100% - 24px))!important;
    max-width:1160px!important; max-height:calc(100dvh - 42px);
    overflow-y:auto; overflow-x:hidden; box-sizing:border-box;
}
#theaterModal .avc-theater-layout {display:grid;grid-template-columns:minmax(0,1.7fr) minmax(300px,1fr);gap:24px;align-items:start;}
#theaterModal .avc-theater-left,#theaterModal .avc-theater-right {min-width:0;}
#theaterModal .avc-theater-player {
    position:relative; width:100%; aspect-ratio:16/9; min-height:0!important;
    background:#000!important; border-radius:12px; overflow:hidden;
    border:1px solid #C8DDED;
}
#theaterModal .avc-theater-player iframe {width:100%;height:100%;border:0;}
#theaterModal .avc-theater-right {display:flex;flex-direction:column;gap:16px;}
#theaterModal #theaterTitle {color:#071B34!important;font-weight:900!important;margin:0;line-height:1.18;}
#theaterModal .avc-theater-tags {margin:0;}
#theaterModal #theaterCategory {color:#1467B3!important;background:#E4F2FD!important;border:1px solid #B7DDF7!important;cursor:pointer;}
#theaterModal #theaterGenreBadge.avc-theater-genre {
    background:#E4F2FD!important;color:#1467B3!important;border:1px solid #B7DDF7!important;
    font-weight:800;cursor:pointer;
}
#theaterModal #theaterGenreBadge.avc-theater-genre:hover {background:#1467B3!important;color:white!important;}
#theaterModal .avc-theater-actions {
    background:#F2F9FF;border:1px solid #C8E2F4;border-radius:14px;
    padding:16px;display:flex;flex-direction:column;gap:10px;
}
#theaterModal .avc-theater-vote-count {display:flex;align-items:center;justify-content:space-between;gap:12px;}
#theaterModal .avc-theater-vote-count span {font-size:13px;font-weight:800;color:#456C8B;}
#theaterModal #theaterVotes {color:#1467B3!important;font-size:25px;font-weight:900;}
#theaterModal #theaterUpvoteBtn {background:#1467B3!important;color:white!important;border:1px solid #1467B3!important;padding:13px!important;}
#theaterModal #primaryPlayBtn {background:#A8DFFF!important;color:#071B34!important;border:1px solid #83C9F3!important;padding:13px!important;}
#theaterModal .avc-theater-about {border-top:1px solid #D8E7F3;padding-top:18px;}
#theaterModal .avc-theater-about h3 {color:#071B34!important;font-size:18px;font-weight:900;margin:0 0 12px;}
#theaterModal #theaterDesc {color:#315B7B!important;font-size:14px;font-weight:500!important;line-height:1.8;overflow-wrap:anywhere;}
#theaterModal #theaterDesc::before {content:none!important;display:none!important;}
#theaterModal #avcTheaterInfoSlot {margin-top:18px;}
#theaterModal #theaterGameDetails {
    background:#F2F9FF!important;border:1px solid #D8E7F3!important;
    border-radius:12px;padding:18px!important;margin:0!important;
}
#theaterModal #theaterGameDetails h3 {color:#071B34!important;font-size:17px;font-weight:900;}
#theaterModal #theaterGameDetails p:not(.text-xs),
#theaterModal #theaterGameDetails #gameDetailsDeveloper {color:#173B5D!important;}
#theaterModal #theaterGameDetails .text-gray-500 {color:#527390!important;}
#theaterModal #theaterGameDetails a,
#theaterModal #theaterGameDetails button {color:#1467B3!important;}
#theaterModal .avc-theater-close {
    top:10px!important;right:10px!important;background:#E4F2FD!important;
    color:#071B34!important;width:34px;height:34px;border-radius:50%;
    display:flex;align-items:center;justify-content:center;border:1px solid #D8E7F3!important;
    font-size:23px;font-weight:800;
}
#theaterModal .avc-theater-close:hover {background:#1467B3!important;color:white!important;}
/* Fullscreen is limited to the player, not the information below it. */
#theaterModal .avc-theater-player:fullscreen {aspect-ratio:auto!important;border:0!important;border-radius:0!important;}
@media(max-width:768px) {
    #theaterModal {padding:8px!important;}
    #theaterModal > .avc-theater-shell {width:100%!important;padding:12px!important;max-height:calc(100dvh - 16px)!important;}
    #theaterModal .avc-theater-layout {grid-template-columns:minmax(0,1fr)!important;gap:18px;}
    #theaterModal .avc-theater-player {min-height:0!important;aspect-ratio:16/9;}
    #theaterModal .avc-theater-right {gap:12px;}
    #theaterModal .avc-theater-actions {padding:12px;}
    #theaterModal .avc-theater-close {top:5px!important;right:5px!important;}
}


/* ==========================================================
   STAGE 10.1 — WHITE THEATER & ABOUT BELOW VIDEO
   Override legacy #theaterModal > div > div:first-of-type
   which painted the entire new grid black.
========================================================== */
#theaterModal > .avc-theater-shell,
#theaterModal > .avc-theater-shell > .avc-theater-layout,
#theaterModal .avc-theater-left,
#theaterModal .avc-theater-right {
    background: #FFFFFF !important;
    color: #071B34 !important;
}
#theaterModal > .avc-theater-shell > .avc-theater-layout {
    border: 0 !important;
    border-radius: 0 !important;
    overflow: visible !important;
}
/* Black belongs ONLY behind the actual YouTube/game iframe. */
#theaterModal .avc-theater-player,
#theaterModal #theaterMediaContainer {
    background: #000000 !important;
}
#theaterModal .avc-theater-about {
    margin-top: 18px;
    padding: 18px;
    background: #F2F9FF !important;
    border: 1px solid #D8E7F3;
    border-radius: 12px;
}
#theaterModal .avc-theater-about h3 {
    color: #071B34 !important;
    font-size: 19px;
    font-weight: 900;
    margin: 0 0 12px;
}
#theaterModal .avc-theater-about #theaterDesc {
    color: #315B7B !important;
    font-size: 14px;
    font-weight: 500 !important;
    line-height: 1.75;
    margin: 0;
    white-space: pre-line;
}
#theaterModal #avcTheaterInfoSlot { margin-top: 16px; }
#theaterModal .avc-theater-right #theaterTitle { color: #071B34 !important; }
#theaterModal .avc-theater-actions { background: #F2F9FF !important; }
@media (max-width:768px) {
  #theaterModal .avc-theater-about { padding: 14px; margin-top: 12px; }
  #theaterModal .avc-theater-left { min-width: 0; }
}
