/*
  ===============================================================================
  THEME: keystone
  PURPOSE: Default F.R.I.D.A. Timer theme — dark navy with cream panels
  DESCRIPTION: Dark navy body background (matching F.R.I.D.A. 2.0 landing page
                  hero section) with cream/tan panels and buttons for contrast.
  NOTE: Fonts are defined in layout CSS files via CSS variables --font-primary
        and --font-display. This theme explicitly resets to layout defaults.
  ===============================================================================
  */

/* Reset font variables to layout defaults */
:root {
    --font-primary: 'PT Sans', 'DejaVu Sans', 'Liberation Sans', 'Segoe UI', sans-serif;
    --font-display: 'Josefin Sans', 'Liberation Sans', 'Helvetica Neue', Arial, sans-serif;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: #144668;
    min-height: 100vh;
    color: #333;
}

#app {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    position: relative; /* For positioning demo selector */
}

header h1 {
    text-align: center;
    color: #efb836;
    margin-bottom: 30px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: var(--font-display);
}

.view {
    flex: 1;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hidden {
    display: none !important;
}

/* Demo mode selector */
.demo-selector {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.demo-selector select {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #c8bfb3;
    border-radius: 4px;
    background: #f5f0e8;
    color: #144668;
    cursor: pointer;
}

.demo-selector select:hover {
    border-color: #236693;
}

/* Password Screen Styling */
#password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #144668;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

@media (max-width: 600px) {
    #password-screen {
        align-items: flex-start;
        padding-top: 15vh;
    }
}

.password-container {
    background: #f5f0e8;
    padding: 40px 50px;
    border-radius: var(--radius-md);
    border: var(--border-width) var(--border-style) #c8bfb3;
    box-shadow: var(--shadow-lg);
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.password-container h2 {
    color: #236693;
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 700;
}

#login-password {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.2rem;
    font-family: var(--font-primary);
    border: 2px solid #c8bfb3;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    transition: var(--transition-fast);
    outline: none;
    background: #f5f0e8;
    color: #333;
}

#login-password:focus {
    border-color: #236693;
    box-shadow: 0 0 15px rgba(35, 102, 147, 0.4);
}

#login-btn {
    background: #236693;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-medium);
    box-shadow: var(--shadow-md);
}

#login-btn:hover {
    background: #1a5075;
}

.error-message {
    color: #e53935;
    display: none;
    margin-top: 15px;
    font-size: 1rem;
    font-weight: 500;
}

#login-password.invalid {
    border-color: #e53935 !important;
    box-shadow: 0 0 15px rgba(229, 57, 53, 0.4) !important;
}

#selection-view h2,
#module-selection-view h2 {
    text-align: center;
    color: #efb836;
    margin-bottom: 24px;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    font-family: var(--font-display);
}

.session-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    max-width: 460px;
    margin: 0 auto;
}

.session-btn {
    background: #f5f0e8;
    border: var(--border-width) var(--border-style) #c8bfb3;
    padding: 14px 24px;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-primary);
    color: #333;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition-medium);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 460px;
    text-align: center;
}

.session-btn:hover {
    background: #ebe5db;
    transform: var(--hover-lift);
    box-shadow: var(--hover-shadow);
}

.session-btn .session-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.session-name {
    font-size: 18px;
    color: #236693;
    font-weight: 600;
}

.section-count {
    font-size: 13px;
    color: #9a9490;
}

.timer-layout {
    display: flex;
    gap: 30px;
    align-items: stretch;
}

.timer-panel {
    flex: 2;
    background: #f5f0e8;
    border-radius: var(--radius-md);
    border: var(--border-width) var(--border-style) #c8bfb3;
    padding: 40px;
    box-shadow: var(--shadow-md);
    position: relative;
}

.timeline-panel {
    flex: 0 0 auto;
    min-width: 180px;
    max-width: 220px;
    background: #f5f0e8;
    border-radius: var(--radius-md);
    border: var(--border-width) var(--border-style) #c8bfb3;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.timer-container {
    text-align: center;
    margin-bottom: 40px;
}

.countdown {
    font-size: 8rem;
    font-weight: 700;
    color: #144668;
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #236693;
    color: white;
    font-size: 6rem;
    padding: 80px 120px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.message.show {
    opacity: 0;
    animation: fadeInOut 2.5s forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    40% { opacity: 1; }
    100% { opacity: 0; }
}

.transition-message {
    font-size: 2.5rem;
    font-weight: 600;
    color: #144668;
    text-align: center;
    padding: 40px 30px;
    line-height: 1.4;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-primary);
}

.transition-message.scrollable {
    overflow-y: auto;
    max-height: 350px;
}

.timer-panel.transition-mode .progress-container {
    display: none !important;
}

.timer-panel.transition-mode .countdown {
    display: none !important;
}

.control-btn.transition-active {
    background: #d6cfc4;
    box-shadow: 0 2px 10px rgba(35, 102, 147, 0.3);
}

.progress-container {
    margin-bottom: 40px;
}

#section-progress-label {
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: #144668;
    margin-bottom: 15px;
    font-family: var(--font-display);
}

.progress-bar {
    height: var(--progress-height);
    background: #d8d0c4;
    border: var(--progress-border-width) var(--border-style) #6a1b9a;
    border-radius: var(--progress-border-radius);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #236693;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    transition: width 100ms linear;
}

.timeline-panel h3 {
    text-align: center;
    color: #236693;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition-fast);
    font-size: 13px;
    font-family: var(--font-primary);
}

.timeline-range {
    color: #144668;
    font-weight: 600;
    margin-right: 8px;
    white-space: nowrap;
}

.timeline-duration {
    color: #424242;
    white-space: nowrap;
    flex-shrink: 0;
}

.timeline-item.remaining {
    background: #ebe5db;
    border-left: 4px solid #c8bfb3;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.timeline-item.current {
    background: #d6cfc4;
    border-left: 4px solid #236693;
    box-shadow: 0 2px 8px rgba(35, 102, 147, 0.2);
}

.timeline-item.completed {
    background: #dce8d0;
    border-left: 4px solid #388e3c;
    box-shadow: 0 2px 8px rgba(56, 142, 60, 0.2);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding-top: 20px;
}

.control-btn {
    background: #e8e1d6;
    border: var(--border-width) var(--border-style) #c8bfb3;
    padding: 30px 40px;
    font-size: 20px;
    font-weight: 600;
    font-family: var(--font-primary);
    color: #144668;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
    box-shadow: var(--shadow-btn);
}

.control-btn:hover {
    background: #dcd5ca;
    border-color: #236693;
    transform: var(--hover-lift);
    box-shadow: var(--hover-shadow);
}

.control-btn#stop-btn {
    background: #f0dcd6;
    border-color: #e0b8ae;
    color: #c62828;
}

.control-btn#stop-btn:hover {
    background: #e8c8be;
    border-color: #d4908a;
}

@media (max-width: 768px) {
    #app {
        padding: 15px;
    }

    header h1 {
        margin-bottom: 20px;
        font-size: 1.8rem;
    }

    #selection-view h2,
    .timer-panel h3 {
        margin-bottom: 20px;
        font-size: 1.4rem;
    }

    .session-btn {
        padding: 12px 18px;
        font-size: 15px;
        width: 100%;
        max-width: 380px;
        border-width: 1px;
    }

    .session-btn .session-name {
        font-size: 16px;
    }

    .session-btn .session-info {
        gap: 1px;
    }

    .timer-layout {
        flex-direction: column;
        gap: 20px;
    }

    .timer-panel {
        padding: 25px 20px;
    }

    .timeline-panel {
        max-width: none;
        min-width: auto;
        width: 100%;
    }

    .countdown {
        font-size: 4rem;
        margin-bottom: 20px;
    }

    .message {
        font-size: 3.5rem;
        padding: 40px 60px;
    }

    .transition-message {
        font-size: 1.8rem;
        padding: 30px 20px;
        min-height: 150px;
    }

    .transition-message.scrollable {
        max-height: 250px;
    }

    .progress-bar {
        height: 6px;
    }

    #section-progress-label {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .controls {
        flex-wrap: wrap;
        gap: 15px;
        padding-top: 15px;
    }

    .control-btn {
        padding: 20px 25px;
        font-size: 16px;
        min-width: calc(50% - 8px);
    }

    .timeline-item {
        gap: 6px;
        text-align: center;
        padding: 6px 10px;
    }

    .timeline-range,
    .timeline-duration {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #app {
        padding: 10px;
    }

    header h1 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }

    .countdown {
        font-size: 3.5rem;
    }

    .message {
        font-size: 3rem;
        padding: 35px 45px;
    }

    .transition-message {
        font-size: 1.5rem;
        padding: 25px 15px;
        min-height: 120px;
    }

    .transition-message.scrollable {
        max-height: 200px;
    }

    .session-btn {
        padding: 10px 16px;
        font-size: 14px;
        width: 100%;
        max-width: 300px;
    }

    .session-btn .session-name {
        font-size: 15px;
    }

    .session-btn .session-info {
        gap: 1px;
    }

    .timer-panel {
        padding: 20px 15px;
    }

    .control-btn {
        padding: 18px 20px;
        font-size: 14px;
    }

    #section-progress-label {
        font-size: 14px;
    }

    .progress-bar {
        height: 6px;
    }
}

@media (max-width: 600px) {
    .password-container {
        padding: 30px 25px;
        width: 95%;
    }

    .password-container h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }

    #login-password {
        font-size: 1rem;
        padding: 12px 15px;
    }

    #login-btn {
        font-size: 1rem;
        padding: 12px 30px;
    }

    .error-message {
        font-size: 0.9rem;
    }
}
