/* ==========================================================================
   Scholē Companion - Classical Centered Styling
   ========================================================================== */

/* Design Tokens */
:root {
    --bg-parchment: #fbf9f4;
    --bg-paper: #f5f0e6;
    --bg-card: #ffffff;
    --text-primary: #1c2826;
    --text-secondary: #5c564f;
    --text-muted: #8c857b;
    --border-color: #e5dfd3;
    
    /* Stage Accent Colors */
    --accent-gold: #c5a059;
    --accent-gold-hover: #b08d4a;
    --accent-gold-light: #f7eedb;
    
    /* Stage Specific Primary Brandings */
    --stage-grammar: #2d4a3e; /* Sage/Forest Green for grammar and concrete facts */
    --stage-logic: #1e3047;   /* Deep Navy for logic, debate, and structure */
    --stage-rhetoric: #5c2525;/* Deep Burgundy for persuasive speech and maturity */
    
    --current-stage-color: var(--stage-grammar); /* Default starting color */
    
    --font-header: 'Cinzel', 'Playfair Display', Georgia, serif;
    --font-body: 'Lora', Georgia, serif;
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    
    --shadow-sm: 0 2px 4px rgba(28, 40, 38, 0.04);
    --shadow-md: 0 8px 16px rgba(28, 40, 38, 0.06);
    --shadow-lg: 0 16px 32px rgba(28, 40, 38, 0.08);
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-parchment);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Ambient Parchment Texture */
.parchment-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.25;
    background-image: 
        radial-gradient(circle at 50% 50%, transparent 60%, rgba(28,40,38,0.05) 100%),
        repeating-linear-gradient(rgba(0,0,0,0) 0px, rgba(0,0,0,0) 99px, rgba(28,40,38,0.02) 100px);
}

/* Header (Centered) */
.app-header {
    background-color: var(--bg-paper);
    border-bottom: 2px solid var(--border-color);
    padding: 2.5rem 2rem 0 2rem;
    position: relative;
    z-index: 10;
}

.header-content-centered {
    max-width: 800px;
    margin: 0 auto 2rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.5rem;
}

.emblem-container {
    max-height: 170px;
    max-width: 480px;
    padding: 3px;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.emblem-img {
    height: auto;
    width: auto;
    max-height: 160px;
    max-width: 100%;
    object-fit: contain;
}

.header-text-centered h1 {
    font-family: var(--font-header);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--current-stage-color);
    letter-spacing: 0.05em;
    transition: var(--transition);
}

.sub-motto {
    font-family: var(--font-header);
    font-size: 0.85rem;
    color: var(--accent-gold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.25rem;
}

.tagline {
    font-size: 1.05rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 0.1rem;
}

/* Trivium Selector Navigation */
.trivium-selector {
    max-width: 800px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background-color: var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
}

.stage-btn {
    background-color: var(--bg-card);
    border: none;
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    text-align: left;
    transition: var(--transition);
    outline: none;
}

.stage-btn:hover {
    background-color: var(--bg-paper);
}

.stage-num {
    font-family: var(--font-header);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    opacity: 0.5;
    transition: var(--transition);
}

.btn-label {
    display: flex;
    flex-direction: column;
}

.stage-name {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
}

.stage-desc {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* Stage Active States */
#stage-grammar.active {
    border-bottom: 4px solid var(--stage-grammar);
    background-color: #f4f7f5;
}
#stage-grammar.active .stage-num { color: var(--stage-grammar); opacity: 1; }
#stage-grammar.active .stage-name { color: var(--stage-grammar); }

#stage-logic.active {
    border-bottom: 4px solid var(--stage-logic);
    background-color: #f3f6f9;
}
#stage-logic.active .stage-num { color: var(--stage-logic); opacity: 1; }
#stage-logic.active .stage-name { color: var(--stage-logic); }

#stage-rhetoric.active {
    border-bottom: 4px solid var(--stage-rhetoric);
    background-color: #faf5f5;
}
#stage-rhetoric.active .stage-num { color: var(--stage-rhetoric); opacity: 1; }
#stage-rhetoric.active .stage-name { color: var(--stage-rhetoric); }

/* Main Centered Container */
.app-container-centered {
    max-width: 800px;
    width: 100%;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
    flex: 1;
}

.main-panel-centered {
    width: 100%;
}

/* Base Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 2.25rem;
    margin-bottom: 2rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.card-header h2 {
    font-family: var(--font-header);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
}

.accent-gold {
    color: var(--accent-gold);
    font-size: 1.25rem;
}

.section-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    font-family: var(--font-ui);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: var(--border-color) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
}

.btn-primary {
    background-color: var(--current-stage-color);
    color: #ffffff;
    border: 1px solid var(--current-stage-color);
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Section Drawer Tab Triggers */
.section-tab-container {
    display: flex;
    justify-content: flex-end;
    margin-top: -1.25rem;
    margin-bottom: 1.5rem;
}

.drawer-trigger-btn {
    background-color: var(--bg-paper);
    color: var(--accent-gold-hover);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.85rem;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.drawer-trigger-btn:hover {
    background-color: var(--accent-gold-light);
    border-color: var(--accent-gold);
}

/* Welcome Letter & Intro */
.letter-body {
    font-size: 1.05rem;
    color: var(--text-primary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    text-align: justify;
}

.notification-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: var(--bg-paper);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--current-stage-color);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: var(--transition);
}

/* Subject Sections Layout */
.subject-title-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.subject-icon {
    font-size: 1.75rem;
    color: var(--current-stage-color);
    transition: var(--transition);
}

.subject-title-container h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.subject-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Checklist Blocks */
.checklist-items {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.check-item-block {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 1.25rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.check-item-block:hover {
    background-color: var(--bg-paper);
}

.check-item-block input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.custom-check {
    position: relative;
    height: 24px;
    width: 24px;
    background-color: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    flex-shrink: 0;
    transition: var(--transition);
}

.check-item-block:hover input ~ .custom-check {
    border-color: var(--accent-gold);
}

.check-item-block input:checked ~ .custom-check {
    background-color: var(--current-stage-color);
    border-color: var(--current-stage-color);
}

.custom-check:after {
    content: "";
    position: absolute;
    display: none;
}

.check-item-block input:checked ~ .custom-check:after {
    display: block;
}

.check-item-block .custom-check:after {
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.check-content {
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.check-item-block input:checked ~ .check-content > p {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Badge System */
.badge {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 0.05em;
    display: inline-block;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.badge-grammar { background-color: #e9f2ee; color: var(--stage-grammar); }
.badge-logic { background-color: #e8ecf1; color: var(--stage-logic); }
.badge-rhetoric { background-color: #faeded; color: var(--stage-rhetoric); }

/* Document & Media Integrations */
.document-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-gold-hover);
    text-decoration: none;
    background-color: var(--accent-gold-light);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    width: fit-content;
    transition: var(--transition);
}

.document-link:hover {
    background-color: var(--accent-gold);
    color: #ffffff;
}

.media-container {
    width: 100%;
    max-width: 560px;
    margin-top: 0.75rem;
}

.embedded-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.image-showcase {
    width: 100%;
    max-width: 450px;
    margin: 1rem 0;
    display: flex;
    justify-content: center;
}

.sculpture-img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.music-tip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f7f5ef;
    border: 1px solid var(--border-color);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: var(--font-ui);
}

.music-tip a {
    color: var(--accent-gold-hover);
    font-weight: 600;
    text-decoration: none;
}

.music-tip a:hover {
    text-decoration: underline;
}

/* Accountability Sign-Off Block */
.accountability-controls {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.parent-sign-block {
    background-color: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
}

.parent-box {
    margin-top: 2px;
}

.parent-label-text {
    font-size: 1.05rem;
    color: var(--text-primary);
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group-row input {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.form-group-row input:focus {
    border-color: var(--current-stage-color);
    box-shadow: 0 0 0 3px var(--accent-gold-light);
}

.form-group-comments textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    outline: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
}

.form-group-comments textarea:focus {
    border-color: var(--current-stage-color);
}

.action-row {
    display: flex;
    justify-content: flex-end;
}

/* Slide-out Drawer Overlays */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(28, 40, 38, 0.4);
    backdrop-filter: blur(2px);
    z-index: 998;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.drawer-backdrop.active {
    display: block;
    opacity: 1;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(28, 40, 38, 0.45);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.modal-backdrop.active {
    opacity: 1;
}

.slide-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 400px;
    max-width: 90vw;
    background-color: var(--bg-paper);
    border-left: 2px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
}

.slide-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    background-color: var(--bg-card);
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    font-family: var(--font-header);
    font-size: 1.15rem;
    color: var(--text-primary);
}

.drawer-close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.drawer-close-btn:hover {
    color: var(--text-primary);
}

.drawer-body {
    padding: 2rem 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.drawer-desc {
    font-family: var(--font-ui);
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Drawer Lists */
.virtue-glossary-list,
.aristotle-drawer-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.glossary-item h4,
.category-item h4 {
    font-family: var(--font-header);
    font-size: 0.95rem;
    color: var(--current-stage-color);
    margin-bottom: 0.25rem;
    transition: var(--transition);
}

.glossary-item p,
.category-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Footer style */
.app-footer-bottom {
    text-align: center;
    padding: 2rem;
    background-color: var(--bg-paper);
    border-top: 1px solid var(--border-color);
    font-family: var(--font-header);
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
}

/* Fine Arts Aristotle Modal Overlay */
.fine-arts-overlay-content {
    background-color: var(--bg-card);
    border: 4px double var(--accent-gold);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: row;
    gap: 2.25rem;
    padding: 2.25rem;
    width: 92vw;
    max-width: 950px;
    height: 80vh;
    max-height: 600px;
    background-image: radial-gradient(circle at 50% 50%, var(--bg-parchment) 0%, var(--bg-paper) 100%);
    position: relative;
    z-index: 1001;
    overflow: hidden;
}

.overlay-image-column {
    flex: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    height: 100%;
    box-shadow: var(--shadow-sm);
}

.overlay-sculpture-img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.overlay-text-column {
    flex: 1.1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding-right: 0.75rem;
}

.overlay-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2.25rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    z-index: 1002;
    transition: var(--transition);
}

.overlay-close-btn:hover {
    color: var(--text-primary);
}

/* Click-to-Load Video Placeholders */
.video-placeholder {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: var(--text-primary);
    background-image: linear-gradient(135deg, rgba(28, 40, 38, 0.95) 0%, rgba(45, 74, 62, 0.85) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.video-placeholder:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-gold);
}

.play-btn-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--accent-gold-light);
    transition: var(--transition);
}

.play-btn-overlay i {
    font-size: 3.5rem;
    color: var(--accent-gold);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    transition: var(--transition);
}

.video-placeholder:hover .play-btn-overlay i {
    transform: scale(1.1);
    color: #ffffff;
    filter: drop-shadow(0 6px 12px rgba(197, 160, 89, 0.4));
}

.video-placeholder:hover .play-btn-overlay span {
    color: #ffffff;
}

.play-btn-overlay span {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Responsive adjustments */
@media(max-width: 768px) {
    .fine-arts-overlay-content {
        flex-direction: column;
        height: 90vh;
        max-height: none;
        overflow-y: auto;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    .overlay-image-column {
        height: 250px;
        flex: none;
        padding: 0.5rem;
    }
    .overlay-text-column {
        flex: none;
        height: auto;
        overflow-y: visible;
    }
}

@media(max-width: 600px) {
    .header-content-centered {
        flex-direction: column;
    }
    
    .trivium-selector {
        grid-template-columns: 1fr;
    }
    
    .form-group-row {
        grid-template-columns: 1fr;
    }
    
    .slide-drawer {
        width: 100vw;
    }
}
