/* ============================================================
   ESSENCE — Old Government Website UI (Bigger, PHP-ready)
   ============================================================ */

* {
    box-sizing: border-box;
    font-family: "Tw Cen MT", "Trebuchet MS", sans-serif;
}

body {
    background-color: #ffffff;
    color: #000000;
    margin: 0;
    padding: 0;
    font-size: 16px;
}

a {
    color: #0000EE;
    text-decoration: underline;
}

/* ========================
   UTILITIES
   ======================== */
.hidden {
    display: none !important;
}

.hidden-input {
    display: none;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ========================
   HEADER / NAV
   ======================== */
.app-header {
    background-color: #003366;
    color: #ffffff;
    padding: 8px 16px;
    border-bottom: 3px solid #000000;
    margin-bottom: 0;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.logo {
    font-size: 30px;
    font-weight: bold;
    letter-spacing: 2px;
    line-height: 1;
    color: #ffffff;
    user-select: none;
}

.main-nav {
    display: flex;
    gap: 6px;
    align-items: center;
}

.header-user {
    display: flex;
    align-items: center;
    font-size: 15px;
    gap: 4px;
    color: #ddd;
    flex-wrap: wrap;
}

/* ========================
   BUTTONS (Win95 style)
   ======================== */
.nav-btn,
.btn-primary,
.btn-secondary,
.btn-icon {
    background-color: #c0c0c0;
    color: #000000;
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #808080;
    border-right-color: #808080;
    padding: 6px 18px;
    font-size: 15px;
    font-family: "Tw Cen MT", "Trebuchet MS", sans-serif;
    cursor: pointer;
    text-align: center;
    margin: 2px;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
}

.nav-btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-icon:hover {
    background-color: #d8d8d8;
}

.nav-btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-icon:active {
    border-top-color: #808080;
    border-left-color: #808080;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
}

.nav-btn.active {
    background-color: #ffffff;
    border-top-color: #808080;
    border-left-color: #808080;
    border-bottom-color: #ffffff;
    border-right-color: #ffffff;
    font-weight: bold;
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-icon:disabled {
    color: #808080;
    cursor: default;
}

.btn-icon.danger {
    color: #cc0000;
    font-weight: bold;
}

/* ========================
   MAIN CONTENT AREA
   ======================== */
.app-main {
    padding: 18px 20px;
}

/* ========================
   INIT / LOADING
   ======================== */
.init-card {
    border: 2px solid #000000;
    padding: 24px;
    background-color: #eeeeee;
    max-width: 640px;
    margin: 40px auto;
}

.init-card h2 {
    margin-top: 0;
    font-size: 22px;
}

#loading-indicator {
    margin-top: 14px;
    font-size: 16px;
    font-weight: bold;
}

.error-msg {
    color: #cc0000;
    font-weight: bold;
    margin-top: 10px;
}

/* ========================
   GRID CARDS
   ======================== */
.selection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 16px;
}

@media (max-width: 800px) {
    .selection-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .selection-grid { grid-template-columns: 1fr; }
}

.grid-card {
    border: 1px solid #000000;
    padding: 14px 16px;
    background-color: #fafafa;
    cursor: pointer;
}

.grid-card:hover {
    background-color: #ddeeff;
}

.grid-card.loading-card {
    opacity: 0.7;
    pointer-events: none;
}

.card-loading-text {
    font-style: italic;
    color: #555;
    font-size: 14px;
}

.grid-card h3 {
    margin: 0 0 6px 0;
    font-size: 18px;
    color: #003366;
    text-decoration: underline;
}

.grid-card p {
    margin: 0 0 6px 0;
    font-size: 15px;
}

.card-meta {
    margin-top: 10px;
    font-size: 13px;
    font-weight: bold;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.meta-chip {
    border: 1px solid #000000;
    padding: 2px 7px;
    background-color: #ffffcc;
    font-size: 13px;
}

/* ========================
   BREADCRUMBS
   ======================== */
.breadcrumbs {
    background-color: #ffffdd;
    border: 1px solid #000000;
    padding: 7px 10px;
    margin-bottom: 16px;
    font-weight: bold;
    font-size: 15px;
}

.breadcrumb-item {
    color: #0000ee;
    text-decoration: underline;
    cursor: pointer;
}

.breadcrumb-separator {
    color: #555;
}

.breadcrumb-current {
    color: #000000;
}

/* ========================
   QUESTION VIEW
   ======================== */
.question-header {
    border: 1px solid #000000;
    padding: 8px 12px;
    margin-bottom: 14px;
    background-color: #eeeeee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.progress-bar-container {
    border: 1px solid #000000;
    width: 340px;
    height: 18px;
    background: #ffffff;
    flex-shrink: 0;
}

.progress-bar {
    background: #003366;
    height: 100%;
    transition: width 0.2s;
}

.progress-text {
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
}

.question-container {
    max-width: 900px;
}

.question-text {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 18px;
    line-height: 1.4;
}

.q-number {
    color: #555555;
    margin-right: 10px;
}

.options-list {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-item {
    border: 1px solid #000000;
    padding: 9px 14px;
    background-color: #ffffff;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.option-item:hover:not(.disabled) {
    background-color: #d0e8ff;
}

.option-item.disabled {
    cursor: default;
}

.option-prefix {
    font-weight: bold;
    min-width: 24px;
    flex-shrink: 0;
}

.option-item.correct {
    background-color: #ccffcc;
    border: 2px solid #008000;
    font-weight: bold;
}

.option-item.incorrect {
    background-color: #ffcccc;
    border: 2px solid #cc0000;
    text-decoration: line-through;
}

.option-item.user-selected {
    background-color: #ffff99;
}

.explanation-box {
    margin-top: 18px;
    border: 2px dashed #000000;
    padding: 14px;
    background-color: #ffffe0;
}

.explanation-title {
    font-weight: bold;
    text-transform: uppercase;
    text-decoration: underline;
    color: #cc0000;
    margin-bottom: 8px;
    font-size: 15px;
}

.explanation-text {
    font-size: 16px;
    line-height: 1.5;
}

.question-footer {
    margin-top: 18px;
    display: flex;
    gap: 10px;
}

/* ========================
   TEST MODE
   ======================== */
.page-title {
    margin-bottom: 14px;
}
.page-title h2 {
    margin: 0 0 4px 0;
}
.page-title p {
    margin: 0;
    color: #555;
}

.test-header {
    border: 2px solid #000000;
    padding: 12px 16px;
    background: #eeeeee;
    margin-bottom: 14px;
}

.test-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.test-info h3 {
    margin: 0;
    font-size: 20px;
}

.test-timer {
    font-size: 20px;
    font-weight: bold;
    color: #cc0000;
    border: 1px solid #000000;
    padding: 4px 10px;
    background: #ffffff;
}

.test-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.test-layout {
    display: flex;
    border: 1px solid #000000;
}

.test-sidebar {
    width: 220px;
    flex-shrink: 0;
    border-right: 1px solid #000000;
    padding: 12px;
    background: #fafafa;
}

.test-sidebar h4 {
    margin: 0 0 12px 0;
    text-decoration: underline;
    font-size: 17px;
}

.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}

.nav-dot {
    border: 1px solid #808080;
    text-align: center;
    padding: 5px 2px;
    cursor: pointer;
    font-size: 13px;
    background: #c0c0c0;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-bottom-color: #808080;
    border-right-color: #808080;
}

.nav-dot:hover {
    background: #ffffff;
}

.nav-dot.active {
    border: 2px solid #000000;
    background: #ffffff;
    font-weight: bold;
}

.nav-dot.answered {
    background: #003366;
    color: #ffffff;
}

.test-main {
    flex: 1;
    padding: 18px;
    min-width: 0;
}

/* ========================
   RESULTS
   ======================== */
.results-card {
    border: 3px double #000000;
    padding: 36px;
    margin: 40px auto;
    max-width: 540px;
    text-align: center;
    background-color: #eeeeee;
}

.score-circle {
    display: none;
}

.score-title {
    text-decoration: underline;
    font-size: 28px;
    margin: 0 0 10px 0;
}

.score-details {
    font-size: 22px;
    font-weight: bold;
    margin: 20px 0;
}

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================
   LOGIN PAGE
   ======================== */
.login-page {
    background: #003366;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: #ffffff;
    border: 3px solid #000000;
    padding: 36px 40px;
    width: 100%;
    max-width: 460px;
}

.login-header {
    text-align: center;
    margin-bottom: 26px;
    border-bottom: 2px solid #000000;
    padding-bottom: 16px;
}

.login-header h1 {
    margin: 0 0 4px 0;
    font-size: 38px;
    color: #003366;
    letter-spacing: 3px;
}

.login-header p {
    margin: 0;
    font-size: 15px;
    color: #555;
}

.login-error {
    margin-bottom: 18px;
    padding: 8px 12px;
    background: #ffeeee;
    border: 1px solid #cc0000;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: bold;
    font-size: 16px;
}

.form-group input,
.form-group select {
    border: 2px solid #808080;
    border-top-color: #555;
    border-left-color: #555;
    border-bottom-color: #fff;
    border-right-color: #fff;
    padding: 8px 10px;
    font-size: 16px;
    font-family: "Tw Cen MT", "Trebuchet MS", sans-serif;
    background: #ffffff;
    width: 100%;
}

.form-group input:focus,
.form-group select:focus {
    outline: 2px solid #003366;
}

.login-btn {
    width: 100%;
    padding: 10px;
    font-size: 17px;
    background: #003366;
    color: #ffffff;
    border: 2px solid #000;
    border-top-color: #0055aa;
    border-left-color: #0055aa;
    cursor: pointer;
    font-weight: bold;
}

.login-btn:hover {
    background: #00448a;
}

/* ========================
   ADMIN PANEL
   ======================== */
.admin-main {
    max-width: 1100px;
}

.admin-title {
    font-size: 24px;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    margin-bottom: 22px;
}

.admin-section {
    border: 1px solid #000000;
    padding: 18px 20px;
    margin-bottom: 22px;
    background: #f5f5f5;
}

.admin-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    text-decoration: underline;
}

.admin-form .form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.admin-form .form-group {
    flex: 1;
    min-width: 160px;
}

.admin-form .form-submit-group {
    flex: 0 0 auto;
    justify-content: flex-end;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.admin-table th,
.admin-table td {
    border: 1px solid #000;
    padding: 10px 14px;
    text-align: left;
}

.admin-table th {
    background: #003366;
    color: #ffffff;
    font-weight: bold;
}

.admin-table tr:nth-child(even) td {
    background: #eeeeee;
}

.admin-table tr:nth-child(odd) td {
    background: #ffffff;
}

.current-user-row td {
    background: #ffffdd !important;
}

.badge-you {
    font-size: 13px;
    color: #555;
    font-style: italic;
}

.admin-message {
    padding: 10px 16px;
    margin-bottom: 18px;
    font-weight: bold;
    font-size: 16px;
    border: 1px solid;
}

.success-msg {
    background: #ccffcc;
    border-color: #008000;
    color: #004400;
}

.error-msg {
    background: #ffeeee;
    border-color: #cc0000;
    color: #cc0000;
}

.hint {
    font-weight: normal;
    font-size: 13px;
    color: #666;
}

/* ========================
   VIDEO PLAYER
   ======================== */

.video-player-layout {
    display: flex;
    border: 1px solid #000000;
    height: calc(100vh - 80px); /* full usable height below header */
    overflow: hidden;
}

/* Sidebar */
.video-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-right: 1px solid #000000;
    background: #f0f0f0;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* clips children, playlist handles its own scroll */
}

.video-sidebar-header {
    background: #003366;
    color: #ffffff;
    padding: 10px 12px;
    border-bottom: 2px solid #000;
}

.video-sidebar-header .btn-icon {
    background: transparent;
    border-color: #ffffff;
    color: #ffffff;
    font-size: 13px;
    padding: 3px 10px;
    margin: 0 0 8px 0;
    display: block;
}

.video-sidebar-header .btn-icon:hover {
    background: rgba(255,255,255,0.15);
}

.video-sidebar-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 0.5px;
    color: #ddeeff;
    word-break: break-word;
}

.video-playlist {
    flex: 1;          /* takes all space below the sidebar header */
    overflow-y: auto; /* scrolls independently */
    overflow-x: hidden;
    padding: 4px 0;
}

.playlist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
    line-height: 1.35;
}

.playlist-item:hover {
    background: #ddeeff;
}

.playlist-item.active {
    background: #003366;
    color: #ffffff;
}

.playlist-item.active .playlist-num {
    color: #aaccff;
}

.playlist-num {
    font-weight: bold;
    color: #555;
    min-width: 26px;
    font-size: 13px;
    padding-top: 1px;
    flex-shrink: 0;
}

.playlist-title {
    flex: 1;
    word-break: break-word;
}

/* Player area */
.video-player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden; /* keep player contained */
    background: #111;
}

.video-title-bar {
    background: #003366;
    color: #ffffff;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: bold;
    border-bottom: 2px solid #000;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-wrap {
    flex: 1;           /* grows to fill remaining height between title bar and footer */
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#main-video-player {
    width: 100%;
    height: 100%;     /* fills the flex wrap exactly */
    max-height: 100%;
    display: block;
    background: #000;
}

.video-nav-footer {
    background: #eeeeee;
    border-top: 2px solid #000;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#video-counter {
    font-size: 15px;
    font-weight: bold;
    color: #333;
}

@media (max-width: 700px) {
    .video-player-layout {
        flex-direction: column;
        height: auto;
    }
    .video-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #000;
        height: 220px;    /* fixed height on mobile so list scrolls */
        flex-shrink: 0;
    }
    .video-player-main {
        flex: none;
    }
    #main-video-player {
        max-height: 55vw;
    }
}

