/* =========================================
   SECTION: DECLARATIONS / GLOBAL
   ========================================= */
:root {
    --monitor-bg: #111;
    --screen-bg: #000;
    --screen-text: #00ff41;
    --dashboard-bg: #40404a;
    --button-bg: #555560;
    --button-hover-bg: #60606b;
    --button-text: #eee;
    --dark-text: #eee;
    --light-text: #ccc;
}

/* OPTIMIZATION: Custom Text Selection to match Cyberpunk Theme */
::selection {
    background: var(--screen-text);
    color: #000;
}

body {
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--monitor-bg);
    font-family: 'Press Start 2P', 'Consolas', monospace;
    color: var(--button-text);
    overflow-y: auto;
}

.container {
    width: 900px;
    max-width: 95vw;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #000;
    border-left: 1px solid var(--screen-text);
}

::-webkit-scrollbar-thumb {
    background-color: var(--screen-text);
    border-radius: 0;
}

/* Unified Button Styling */
button.app-action-btn,
.timer-buttons button,
#todo-app button,
.music-buttons button,
#trivia-app button,
.app-btn,
#logout-btn {
    padding: 10px 15px;
    background-color: var(--screen-text);
    color: #000000;
    border: 2px solid var(--screen-text);
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    font-weight: bold;
    text-transform: uppercase;
    white-space: normal;
    transition: background-color 0.1s, color 0.1s;
    outline: none;
}

button.app-action-btn:hover,
.timer-buttons button:hover,
#todo-app button:hover,
.music-buttons button:hover,
#trivia-app button:hover,
.app-btn:hover {
    background-color: #000000;
    color: var(--screen-text);
}

/* FIX: Removed !important so JS can color validation buttons */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: #000;
    color: var(--screen-text);
    border-color: #444;
}

/* FIX: Ensure Trivia answers stay readable (100% opacity) when selected */
.trivia-choice-btn:disabled {
    opacity: 1;
    border-color: var(--screen-text);
}

.app-view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

.message-line {
    color: var(--screen-text);
    font-size: 0.7rem;
    text-align: center;
    height: 1em;
    margin-top: 10px;
    /* Ensure message has space to show */
    min-height: 20px;
}

/* =========================================
   END OF SECTION: DECLARATIONS / GLOBAL
   ========================================= */


/* =========================================
   SECTION: LOGIN / LOGOUT / TERMINAL
   ========================================= */
.monitor {
    background-color: var(--screen-bg);
    border: 15px solid var(--monitor-bg);
    border-radius: 5px 5px 0 0;
    padding: 20px;
    height: 450px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

/* CRT Scanline Effect */
.monitor::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15) 1px, transparent 1px, transparent 3px);
    pointer-events: none;
    z-index: 10;
}

.screen {
    position: relative;
    width: 100%;
    height: 100%;
    color: var(--screen-text);
    font-size: 1.2rem;
    line-height: 1.5;
    white-space: pre-wrap;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.6);
}

/* Dashboard */
.dashboard {
    background-color: var(--dashboard-bg);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-radius: 0 0 5px 5px;
    gap: 30px;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
    position: relative;
}

.system-apps h3 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--light-text);
    font-weight: normal;
}

.app-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    width: 320px;
}

.app-btn {
    display: flex;
    align-items: center;
    background-color: var(--button-bg);
    color: var(--button-text);
    border: none;
    border-radius: 3px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
    font-size: 10px;
    text-align: left;
    padding: 8px 15px;
}

.app-btn:hover {
    background-color: var(--button-hover-bg);
    color: var(--button-text);
}

#outer-logout-btn {
    padding-top: 50px;
}

#logout-btn {
    grid-column: 1 / -1;
    background-color: #ff4141;
    color: white;
    border: 2px solid #ff4141;
    text-align: center;
    justify-content: center;
    display: flex;
    align-items: center;
    border-radius: 3px;
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
    font-size: 10px;
    padding: 8px 15px;
}

#logout-btn:hover {
    background-color: #000;
    color: #ff4141;
}

.icon {
    margin-right: 8px;
    font-size: 1.2rem;
    line-height: 1;
}

/* Logo Container - Centered */
.logo-container {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    padding-top: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

#gdg-logo {
    width: 50%;
    height: 50%;
    filter: grayscale(100%) brightness(150%);
    opacity: 1;
}

.info-panel {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    width: 200px;
    padding-top: 15px;
}

.title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--light-text);
    margin-bottom: 5px;
}

.copyright {
    font-size: 0.65rem;
    color: var(--dark-text);
    margin-bottom: 20px;
}

/* Launch */
#launch-app {
    justify-content: center;
    align-items: center;
}

#launch-text {
    font-size: 1.2rem;
    text-shadow: 0 0 5px rgba(0, 255, 65, 0.6);
    white-space: pre-wrap;
}

/* =========================================
   END OF SECTION: LOGIN / LOGOUT / TERMINAL
   ========================================= */


/* =========================================
   SECTION: TIMER / STOPWATCH
   ========================================= */

.timer-title {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--screen-text);
    text-shadow: 0 0 5px var(--screen-text);
    margin-top: 0;
    text-align: center;
}

#timer-display-element {
    font-size: 50px;
    color: var(--screen-text);
    margin: 10px 0;
    text-shadow: 0 0 8px var(--screen-text);
    text-align: center;
}

#timer-inputs-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

#timer-inputs-row input {
    font-family: "Press Start 2P";
    background: none;
    border: 1px solid var(--screen-text);
    color: var(--screen-text);
    box-shadow: 0 0 5px var(--screen-text);
    width: 70px;
    padding: 10px;
    text-align: center;
    font-size: 14px;
    outline: none;
}

/* OPTIMIZATION: Better focus state for inputs */
#timer-inputs-row input:focus {
    background-color: #002200;
}

.timer-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 450px;
    padding: 0 10px;
    box-sizing: border-box;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.timer-buttons button {
    width: 100%;
}

#timer-mode-btn {
    grid-column: 1 / -1;
}

#timer-lap-btn {
    grid-column: 2;
}

#timer-lap-list {
    margin-top: 15px;
    padding: 0;
    list-style: none;
    color: var(--screen-text);
    font-size: 12px;
    max-height: 80px;
    overflow-y: auto;
    width: 100%;
    text-align: center;
}

#timer-lap-list li {
    margin: 5px 0;
}

/* =========================================
   END OF SECTION: TIMER / STOPWATCH
   ========================================= */


/* =========================================
   SECTION: MUSIC PLAYER
   ========================================= */
#music-app {
    justify-content: space-between;
    align-items: center;
}

.music-top {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50%;
}

#music-title {
    font-size: 1rem;
    text-align: center;
    color: var(--screen-text);
}

.music-controls-wrapper {
    height: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

.music-progress-container {
    width: 80%;
    height: 10px;
    background-color: #005500;
    border: 1px solid var(--screen-text);
    cursor: pointer;
    margin-bottom: 20px;
    box-sizing: border-box;
    font-size: 0;
}

#music-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--screen-text);
}

.music-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

#music-file-input {
    display: none;
}

.file-input-label {
    padding: 10px 15px;
    background-color: var(--screen-text);
    color: #000000;
    border: 2px solid var(--screen-text);
    cursor: pointer;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.1s;
}

.file-input-label:hover {
    background-color: #000000;
    color: var(--screen-text);
}

/* =========================================
   END OF SECTION: MUSIC PLAYER
   ========================================= */


/* =========================================
   SECTION: TO-DO
   ========================================= */
#todo-app {
    justify-content: flex-start;
    align-items: center;
    padding-top: 30px;
}

.todo-container-inner {
    width: 90%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.input-section {
    display: flex;
    width: 100%;
    gap: 10px;
    margin-bottom: 20px;
    align-items: stretch;
}

#todo-input {
    flex-grow: 1;
    background: none;
    border: 2px solid var(--screen-text);
    color: var(--screen-text);
    padding: 10px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    box-shadow: 0 0 5px rgba(0, 255, 65, 0.4);
    outline: none;
}

#todo-input:focus {
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.7);
}

#todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
    width: 100%;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border: 2px solid var(--screen-text);
    margin-bottom: 10px;
    background-color: #000000;
    color: var(--screen-text);
    font-size: 0.7rem;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    margin-right: 15px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--screen-text);
    background-color: #000000;
    position: relative;
    flex-shrink: 0;
}

.todo-checkbox:checked::before {
    content: "X";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--screen-text);
    font-size: 14px;
}

.task-text {
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.task-text.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.todo-date {
    font-size: 0.5rem;
    color: var(--screen-text);
    opacity: 0.8;
    margin-left: 10px;
    margin-right: 10px;
    white-space: nowrap;
}

.delete-btn {
    padding: 5px 10px !important;
    font-size: 0.5rem !important;
    flex-shrink: 0;
}

#todo-list::-webkit-scrollbar {
    width: 8px;
}

#todo-list::-webkit-scrollbar-track {
    background: #000;
    border-left: 1px solid var(--screen-text);
}

#todo-list::-webkit-scrollbar-thumb {
    background-color: var(--screen-text);
}

/* =========================================
   END OF SECTION: TO-DO
   ========================================= */


/* =========================================
   SECTION: TRIVIA
   ========================================= */
#trivia-app {
    justify-content: space-between;
    align-items: center;
}

.trivia-question-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 60%;
    text-align: center;
    width: 100%;
}

#trivia-category {
    font-size: 0.7rem;
    color: #008822;
    margin-bottom: 10px;
}

#trivia-question {
    font-size: 1rem;
    line-height: 1.4;
}

.trivia-answer-wrapper {
    height: 40%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
}

#trivia-choices-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 80%;
    margin-bottom: 15px;
}

.trivia-choice-btn {
    width: 100%;
    text-align: left;
    font-size: 0.7rem !important;
    white-space: normal;
}

#trivia-next-btn {
    width: 70%;
    margin-bottom: 10px;
}

/* =========================================
   END OF SECTION: TRIVIA
   ========================================= */


/* =========================================
   SECTION: MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    body {
        padding: 20px 10px;
        align-items: flex-start;
        height: auto;
    }

    .container {
        width: 100%;
        max-width: 100%;
        box-shadow: none;
    }

    .monitor {
        height: 50vh;
        min-height: 300px;
        max-height: 500px;
        padding: 10px;
        border-width: 10px;
    }

    .dashboard {
        flex-direction: column;
        align-items: center;
        gap: 20px;
        padding: 20px 10px;
        height: auto;
        position: static;
    }

    .logo-container {
        position: static;
        transform: none;
        width: 100%;
        padding-top: 10px;
    }

    #gdg-logo {
        max-width: 200px;
    }

    .system-apps,
    .info-panel {
        width: 100%;
        text-align: center;
        align-items: center;
    }

    .app-buttons {
        width: 100%;
        gap: 10px;
    }

    .app-btn {
        justify-content: center;
        font-size: 0.7rem;
    }

    #logout-btn {
        font-size: 0.7rem;
    }

    .info-panel {
        align-items: center;
        padding-top: 0;
    }

    /* App Adjustments */
    #timer-display-element {
        font-size: 2.5rem;
    }

    #timer-inputs-row input {
        width: 50px;
        font-size: 12px;
    }

    .timer-buttons button {
        padding: 10px 5px;
        font-size: 0.5rem;
    }

    .input-section {
        flex-wrap: wrap;
    }

    #todo-input {
        min-width: 100%;
    }

    #todo-app button {
        flex-grow: 1;
    }

    .todo-item {
        padding: 5px;
    }

    .todo-date {
        display: none;
    }

    .music-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .music-buttons button {
        padding: 8px 10px;
        font-size: 0.5rem;
    }

    #trivia-question {
        font-size: 0.8rem;
    }

    #trivia-choices-container {
        width: 100%;
    }
}