/* =============================================
   UI IMPROVEMENTS - v3
   Covers both Admin UI and Player UI
   ============================================= */

/* ===========================================
   PLAYER CLUE POPUP IMPROVEMENTS
   =========================================== */

/* Override default popup for player clue windows */
.popupWindow {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 90% !important;
    max-width: 700px !important;
    max-height: 85vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 4px solid #fff !important;
    border-radius: 30px !important;
    background: linear-gradient(180deg, #2e7f8a 0%, #1a5a63 100%) !important;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5) !important;
    overflow: hidden !important;
    z-index: 1000 !important;
}

/* Popup Header - coordinates display */
.popupHeader {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 15px 20px !important;
    background: rgba(0,0,0,0.3) !important;
    border-bottom: 3px solid rgba(255,255,255,0.3) !important;
    font-size: 48px !important;
    height: auto !important;
    margin-bottom: 0 !important;
}

#popupCoord {
    border-bottom: none !important;
    font-size: 64px !important;
    color: #fff !important;
}

/* Close button */
.closePopUpBtn {
    position: relative !important;
    right: auto !important;
    margin: 0 !important;
    padding: 5px !important;
    background: rgba(255,0,0,0.3) !important;
    border-radius: 15px !important;
    transition: background 0.2s !important;
}

.closePopUpBtn:hover {
    background: rgba(255,0,0,0.6) !important;
    opacity: 1 !important;
}

.closePopUpBtn img {
    height: 80px !important;
    width: auto !important;
}

/* Popup Title - THE RIDDLE */
.popupTitle {
    font-size: 52px !important;
    line-height: 1.3 !important;
    padding: 20px 25px !important;
    margin: 0 !important;
    max-width: 100% !important;
    color: #fff !important;
    text-align: center !important;
    background: rgba(0,0,0,0.2) !important;
}

/* Popup Content - input and button */
.popupContent {
    padding: 20px 30px 30px 30px !important;
    border-top: none !important;
    text-align: center !important;
    font-size: 24px !important;
}

/* Clue answer input - much bigger and more prominent */
input.clueAnswer {
    width: 85% !important;
    max-width: 500px !important;
    height: 100px !important;
    font-size: 56px !important;
    padding: 15px 20px !important;
    margin: 10px auto 20px auto !important;
    display: block !important;
    border: 4px solid #666 !important;
    border-radius: 20px !important;
    background-color: #2a2a2a !important;
    color: #00ff00 !important;
    text-transform: uppercase !important;
    text-align: center !important;
    font-family: courier, monospace !important;
}

input.clueAnswer:focus {
    border-color: #00ff00 !important;
    outline: none !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4) !important;
}

input.clueAnswer::placeholder {
    color: #666 !important;
    text-transform: none !important;
}

/* Answer submit button */
.answerSubmitButton {
    display: block !important;
    margin: 15px auto 0 auto !important;
    padding: 0 !important;
    height: auto !important;
    cursor: pointer !important;
    transition: transform 0.1s !important;
}

.answerSubmitButton img {
    height: 120px !important;
    width: auto !important;
}

.answerSubmitButton:hover {
    transform: scale(1.05) !important;
}

.answerSubmitButton:active {
    transform: scale(0.98) !important;
}

/* Blur background when popup is visible */
body.popup-open #nameDiv,
body.popup-open #timeDivBG,
body.popup-open #timeDiv,
body.popup-open #buttonsDiv,
body.popup-open #contentDiv,
body.popup-open #hackingDiv {
    filter: blur(8px);
    pointer-events: none;
}

/* ===========================================
   HACK WINDOW IMPROVEMENTS
   =========================================== */

.hackButton {
    cursor: pointer;
    transition: transform 0.1s;
}

.hackButton:hover {
    transform: scale(1.05);
}

.hackButton:active {
    transform: scale(0.98);
}

/* ===========================================
   NOTIFICATION IMPROVEMENTS
   =========================================== */

.successNotification,
.failNotification {
    font-size: 72px !important;
    padding: 40px 20px !important;
    border-radius: 30px !important;
    text-align: center !important;
    z-index: 1001 !important;
}

/* ===========================================
   SCOREBOARD IMPROVEMENTS
   =========================================== */

.scoreBG {
    padding: 25px 20px !important;
    font-size: 32px !important;
    border-radius: 25px !important;
    overflow-y: auto !important;
}

/* ===========================================
   CLUE BUTTONS IMPROVEMENTS
   =========================================== */

.quad1, .quad2, .quad3, .quad4, .quad5 {
    transition: transform 0.1s, opacity 0.1s;
    margin: 8px 0 !important;
}

.quad1:hover, .quad2:hover, .quad3:hover, .quad4:hover, .quad5:hover {
    transform: scale(1.02);
    opacity: 0.9 !important;
}

.quad1:active, .quad2:active, .quad3:active, .quad4:active, .quad5:active {
    transform: scale(0.98);
}

/* ===========================================
   MAIN NAVIGATION BUTTONS
   =========================================== */

.mainButtons {
    transition: transform 0.1s !important;
}

.mainButtons:hover {
    transform: scale(1.1) !important;
    opacity: 1 !important;
}

.mainButtons:active {
    transform: scale(0.95) !important;
}

/* ===========================================
   LOGIN SCREEN IMPROVEMENTS
   =========================================== */

.loginWindow {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 20px !important;
}

.loginTitle {
    font-size: 80px !important;
    margin-bottom: 20px !important;
    text-shadow: 4px 4px 8px rgba(0,0,0,0.5) !important;
}

input.loginCode {
    width: 80% !important;
    max-width: 500px !important;
    height: 120px !important;
    font-size: 64px !important;
    border-radius: 20px !important;
    border: 4px solid #888 !important;
    margin: 20px 0 !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

input.loginCode:focus {
    border-color: #00ff00 !important;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.3) !important;
    outline: none !important;
}

/* ===========================================
   ADMIN UI - POPUP OVERRIDE
   When admin popups are shown, use different styling
   =========================================== */

body.popup-open .popupWindow.adminMode,
.popupWindow:has(.adminPopup) {
    max-width: none !important;
    width: 94% !important;
    height: 92vh !important;
    max-height: 92vh !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* ----- Admin Main Menu Buttons ----- */
.adminButtons {
    display: inline-block;
    padding: 30px 25px;
    font-size: 52px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    outline: none;
    color: #fff;
    width: 90%;
    height: auto;
    min-height: 120px;
    background: linear-gradient(180deg, #666666 0%, #444444 100%);
    border: 4px solid #888;
    border-radius: 25px;
    box-shadow: 0 10px 0 #333, 0 12px 20px rgba(0,0,0,0.3);
    margin-bottom: 12px;
    transition: all 0.1s ease;
}

.adminButtons:hover {
    background: linear-gradient(180deg, #777777 0%, #555555 100%);
    transform: translateY(3px);
    box-shadow: 0 7px 0 #333, 0 9px 15px rgba(0,0,0,0.3);
}

.adminButtons:active {
    transform: translateY(8px);
    box-shadow: 0 2px 0 #333, 0 3px 8px rgba(0,0,0,0.3);
}

/* Color-coded admin buttons */
.adminButtons.game-control {
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
    border-color: #a93226;
    box-shadow: 0 10px 0 #7b241c, 0 12px 20px rgba(0,0,0,0.3);
}
.adminButtons.game-control:hover {
    background: linear-gradient(180deg, #ec7063 0%, #e74c3c 100%);
}

.adminButtons.add-item {
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
    border-color: #196f3d;
    box-shadow: 0 10px 0 #145a32, 0 12px 20px rgba(0,0,0,0.3);
}
.adminButtons.add-item:hover {
    background: linear-gradient(180deg, #2ecc71 0%, #27ae60 100%);
}

.adminButtons.edit-item {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
    border-color: #2471a3;
    box-shadow: 0 10px 0 #1a5276, 0 12px 20px rgba(0,0,0,0.3);
}
.adminButtons.edit-item:hover {
    background: linear-gradient(180deg, #5dade2 0%, #3498db 100%);
}

/* ----- Admin Popup Scroll Area ----- */
.adminPopup {
    max-height: calc(90vh - 140px);
    overflow-y: auto;
    padding: 10px 15px;
}

/* ----- Admin Form Inputs - Base Style ----- */
.adminInput {
    height: 100px;
    font-size: 52px;
    padding: 12px 20px;
    margin: 5px 6px;
    display: inline-block;
    border: 4px solid #555;
    border-radius: 18px;
    background-color: #2a2a2a;
    color: #00ff00;
    text-align: center;
    font-family: courier, monospace;
    box-sizing: border-box;
}

.adminInput:focus {
    border-color: #00ff00;
    outline: none;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.4);
}

.adminInput::placeholder {
    color: #555;
    font-size: 40px;
}

.adminInput:disabled {
    background-color: #3a3a3a;
    color: #aaa;
    border-color: #444;
}

/* ----- Specific Field Widths ----- */
.adminInput.field-coord { width: 150px; }
.adminInput.field-code { width: 240px; }
.adminInput.field-answer { width: 300px; }
.adminInput.field-quadrant { width: 260px; }
.adminInput.field-sequence { width: 130px; }
.adminInput.field-points { width: 180px; }
.adminInput.field-hackcode { width: 200px; }
.adminInput.field-logincode { width: 320px; }
.adminInput.field-teamid { width: 180px; }
.adminInput.field-score { width: 180px; }
.adminInput.field-name { width: 450px; min-width: 300px; }
.adminInput.field-hint { width: 100%; min-height: 180px; }

/* Textarea styling */
textarea.adminInput {
    font-family: courier, monospace;
    padding: 18px;
    line-height: 1.25;
    resize: vertical;
    text-align: left;
    font-size: 44px;
}

textarea.adminInput:disabled {
    background-color: #3a3a3a;
    color: #aaa;
    border-color: #444;
}

/* Select dropdowns */
select.adminInput {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300ff00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 32px;
    padding-right: 65px;
}

select.adminInput:disabled {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
}

/* Label for inputs */
.adminLabel {
    display: block;
    font-size: 40px;
    color: #ccc;
    margin-top: 8px;
    margin-bottom: 6px;
    text-align: center;
}

/* ----- Admin Action Buttons (inside popups) ----- */
.adminActionBtn {
    display: inline-block;
    padding: 24px 50px;
    font-size: 48px;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(180deg, #27ae60 0%, #1e8449 100%);
    border: 4px solid #196f3d;
    border-radius: 18px;
    box-shadow: 0 8px 0 #145a32;
    margin: 10px 8px;
    transition: all 0.1s ease;
}

.adminActionBtn:hover {
    transform: translateY(3px);
    box-shadow: 0 5px 0 #145a32;
}

.adminActionBtn:active {
    transform: translateY(7px);
    box-shadow: 0 1px 0 #145a32;
}

.adminActionBtn.secondary {
    background: linear-gradient(180deg, #7f8c8d 0%, #606060 100%);
    border-color: #505050;
    box-shadow: 0 8px 0 #404040;
}

.adminActionBtn.danger {
    background: linear-gradient(180deg, #e74c3c 0%, #c0392b 100%);
    border-color: #a93226;
    box-shadow: 0 8px 0 #7b241c;
}

.adminActionBtn.generate {
    padding: 20px 35px;
    font-size: 40px;
    background: linear-gradient(180deg, #9b59b6 0%, #8e44ad 100%);
    border-color: #7d3c98;
    box-shadow: 0 6px 0 #5b2c6f;
}

/* ----- Team/Player/Clue Cards ----- */
.adminCard {
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border: 4px solid #555;
    border-radius: 22px;
    padding: 18px 22px;
    margin: 12px auto;
    max-width: 100%;
}

.adminCard .cardTitle {
    font-size: 50px;
    color: #fff;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid #555;
}

.adminCard .cardRow {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    margin: 10px 0;
}

.adminCard .fieldGroup {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.adminCard .fieldGroup label {
    font-size: 32px;
    color: #aaa;
    margin-bottom: 3px;
}

/* ----- Section Dividers ----- */
.adminSection {
    margin: 12px 0;
    padding: 15px 18px;
    background: rgba(0,0,0,0.25);
    border-radius: 18px;
    border: 2px solid #444;
}

.adminSection h3 {
    font-size: 44px;
    color: #3498db;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* ----- Scrollbar styling ----- */
.adminPopup::-webkit-scrollbar,
.popupContent::-webkit-scrollbar {
    width: 16px;
}

.adminPopup::-webkit-scrollbar-track,
.popupContent::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 8px;
}

.adminPopup::-webkit-scrollbar-thumb,
.popupContent::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 8px;
}

.adminPopup::-webkit-scrollbar-thumb:hover,
.popupContent::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* ----- Success/Info Messages ----- */
.adminMessage {
    padding: 22px 28px;
    border-radius: 18px;
    font-size: 46px;
    margin: 12px 0;
    text-align: center;
}

.adminMessage.success {
    background-color: rgba(39, 174, 96, 0.35);
    border: 4px solid #27ae60;
    color: #2ecc71;
}

.adminMessage.info {
    background-color: rgba(52, 152, 219, 0.35);
    border: 4px solid #3498db;
    color: #5dade2;
}

.adminMessage.warning {
    background-color: rgba(241, 196, 15, 0.35);
    border: 4px solid #f1c40f;
    color: #f4d03f;
}

/* ----- Captain Badge ----- */
.captainBadge {
    display: inline-block;
    background: linear-gradient(180deg, #f39c12 0%, #d68910 100%);
    color: #fff;
    padding: 12px 28px;
    border-radius: 30px;
    font-size: 32px;
    margin-left: 15px;
    vertical-align: middle;
}

/* ----- Current Score Display ----- */
.currentScore {
    font-size: 72px;
    color: #f39c12;
    margin: 12px 0;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.5);
}

.currentScore strong {
    font-size: 96px;
}

/* ===========================================
   RESPONSIVE ADJUSTMENTS
   =========================================== */

@media (max-width: 600px) {
    .popupTitle {
        font-size: 32px !important;
        padding: 20px !important;
    }
    
    input.clueAnswer {
        font-size: 42px !important;
        height: 80px !important;
    }
    
    .adminInput {
        font-size: 28px;
        height: 60px;
    }
    
    .adminActionBtn {
        font-size: 28px;
        padding: 15px 25px;
    }
    
    .adminButtons {
        font-size: 32px;
        min-height: 80px;
    }
}
