/* ============================================
   Deliberate Life™ Workbook — Styles
   Bali-inspired, calm, warm, spacious
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Primary greens */
    --green-dark: #2D5016;
    --green-mid: #4A7C28;
    --green-light: #6B8F4E;

    /* Blues */
    --blue-dark: #1B4F72;
    --blue-mid: #2E86AB;
    --blue-light: #5DADE2;

    /* Earth browns */
    --brown-dark: #6B4226;
    --brown-mid: #8B6914;
    --brown-light: #C4A35A;

    /* Sun yellows */
    --yellow-dark: #D4AC0D;
    --yellow-light: #F4D03F;

    /* Backgrounds */
    --bg-primary: #FAFAF5;
    --bg-warm: #F5F0E8;

    /* Text */
    --text-primary: #2C2C2C;
    --text-secondary: #5A5A5A;
    --text-light: #8A8A8A;

    /* Borders */
    --border: #E0D8CC;
    --border-light: #EDE8DF;

    /* Status colours */
    --status-not-started: #C8C8C0;
    --status-in-progress: #D4AC0D;
    --status-final: #4A7C28;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-serif: Georgia, 'Times New Roman', Times, serif;
    --text-base: 1.0625rem;
    --text-lg: 1.1875rem;
    --text-xl: 1.375rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;
    --line-height: 1.65;

    /* Layout */
    --max-width: 52rem;
    --radius: 8px;
    --radius-lg: 12px;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--line-height);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.app-header {
    background: white;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.logo {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    color: var(--green-dark);
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.logo .tm {
    font-size: 0.6em;
    vertical-align: super;
}

.header-nav {
    display: flex;
    gap: var(--space-md);
    margin-left: auto;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: var(--green-dark);
    background: var(--bg-warm);
}

.nav-link.active {
    color: var(--green-dark);
    font-weight: 500;
}

.save-indicator {
    font-size: 0.8125rem;
    color: var(--green-mid);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.save-indicator.visible {
    opacity: 1;
}

/* --- Main Content --- */
.app-main {
    flex: 1;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    width: 100%;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: var(--space-lg);
    color: var(--text-light);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border-light);
}

/* ============================================
   Dashboard View
   ============================================ */

.dashboard-header {
    margin-bottom: var(--space-2xl);
}

.dashboard-header h1 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: var(--space-sm);
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    max-width: 36rem;
    line-height: 1.6;
}

/* Overall progress */
.overall-progress {
    margin-bottom: var(--space-2xl);
    padding: var(--space-lg);
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.overall-progress h2 {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.progress-bar-container {
    background: var(--bg-warm);
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--green-mid), var(--green-light));
    border-radius: 999px;
    transition: width 0.4s ease;
    min-width: 0;
}

.progress-text {
    margin-top: var(--space-xs);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Category grid */
.categories-section h2 {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-weight: 600;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.category-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-card:hover {
    border-color: var(--green-light);
    box-shadow: 0 2px 12px rgba(45, 80, 22, 0.08);
    transform: translateY(-1px);
}

.category-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.category-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--bg-warm);
    color: var(--green-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.category-card-name {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.category-card-desc {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.category-card-progress {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.category-progress-bar {
    flex: 1;
    background: var(--bg-warm);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
}

.category-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.category-progress-fill.not-started {
    background: var(--status-not-started);
}

.category-progress-fill.in-progress {
    background: var(--status-in-progress);
}

.category-progress-fill.complete {
    background: var(--status-final);
}

.category-progress-text {
    font-size: 0.8125rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* Exercises section */
.exercises-section h2 {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    font-weight: 600;
}

.exercise-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-2xl);
}

.exercise-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.exercise-card:hover {
    border-color: var(--blue-mid);
    box-shadow: 0 2px 12px rgba(46, 134, 171, 0.08);
    transform: translateY(-1px);
}

.exercise-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
}

.exercise-card-icon.visioning {
    background: #EBF5FB;
    color: var(--blue-mid);
}

.exercise-card-icon.benchmark {
    background: #FEF9E7;
    color: var(--yellow-dark);
}

.exercise-card h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.exercise-card p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Data actions (export/import) */
.data-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-primary);
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
    font-family: inherit;
    line-height: 1.4;
}

.btn:hover {
    background: var(--bg-warm);
    border-color: var(--brown-light);
}

.btn-primary {
    background: var(--green-dark);
    color: white;
    border-color: var(--green-dark);
}

.btn-primary:hover {
    background: var(--green-mid);
    border-color: var(--green-mid);
}

/* Hidden file input */
.hidden-input {
    display: none;
}

/* ============================================
   Category View
   ============================================ */

.category-view {
    max-width: 42rem;
    margin: 0 auto;
}

.category-view-header {
    margin-bottom: var(--space-2xl);
}

.category-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
    transition: color 0.2s;
}

.category-back:hover {
    color: var(--green-dark);
}

.category-view-number {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.category-view-header h1 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--green-dark);
    margin-bottom: var(--space-sm);
}

.category-view-desc {
    color: var(--text-secondary);
    font-size: var(--text-lg);
    line-height: 1.6;
}

/* Question blocks */
.question-block {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.question-label {
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.question-text {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 500;
    line-height: 1.4;
}

.question-hint {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-lg);
    line-height: 1.55;
    padding-left: var(--space-md);
    border-left: 2px solid var(--border);
}

.video-ref {
    font-size: 0.8125rem;
    color: var(--blue-mid);
    background: #EBF5FB;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    line-height: 1.5;
}

.question-textarea {
    width: 100%;
    min-height: 9rem;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-primary);
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.question-textarea:focus {
    outline: none;
    border-color: var(--green-light);
    box-shadow: 0 0 0 3px rgba(74, 124, 40, 0.1);
}

.question-textarea::placeholder {
    color: var(--text-light);
}

.question-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-md);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.8125rem;
    padding: 2px var(--space-sm);
    border-radius: 999px;
}

.status-badge.not-started {
    color: var(--text-light);
}

.status-badge.in-progress {
    color: var(--status-in-progress);
}

.status-badge.final {
    color: var(--status-final);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.not-started {
    background: var(--status-not-started);
}

.status-dot.in-progress {
    background: var(--status-in-progress);
}

.status-dot.final {
    background: var(--status-final);
}

.final-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.final-checkbox input[type="checkbox"] {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: var(--green-mid);
    cursor: pointer;
}

/* Tactics sub-fields */
.tactics-group {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.tactics-group-header {
    margin-bottom: var(--space-lg);
}

.tactics-group-header .question-label {
    margin-bottom: var(--space-xs);
}

.tactics-group-header .question-text {
    margin-bottom: 0;
}

.tactics-sub {
    margin-bottom: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
}

.tactics-sub:first-of-type {
    border-top: none;
    padding-top: 0;
}

.tactics-sub-label {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.tactics-sub-question {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-sm);
}

/* Notes/Reflections block */
.notes-block {
    background: var(--bg-warm);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.notes-block h3 {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.notes-block p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
}

.notes-block .question-textarea {
    background: white;
}

/* Category nav (prev/next) */
.category-nav {
    display: flex;
    justify-content: space-between;
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-light);
    margin-top: var(--space-xl);
}

.category-nav a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
}

.category-nav a:hover {
    color: var(--green-dark);
    background: var(--bg-warm);
}

.category-nav .nav-disabled {
    visibility: hidden;
}

/* ============================================
   Visioning Exercise View
   ============================================ */

.exercise-view {
    max-width: 42rem;
    margin: 0 auto;
}

.exercise-view-header {
    margin-bottom: var(--space-2xl);
}

.exercise-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
    transition: color 0.2s;
}

.exercise-back:hover {
    color: var(--green-dark);
}

.exercise-view-header h1 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--blue-dark);
    margin-bottom: var(--space-sm);
}

.exercise-instructions {
    background: var(--bg-warm);
    border-left: 3px solid var(--blue-mid);
    padding: var(--space-md) var(--space-lg);
    border-radius: 0 var(--radius) var(--radius) 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
    font-style: italic;
    margin-bottom: var(--space-xl);
}

/* Before/After toggle */
.timing-toggle {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-xl);
    background: var(--bg-warm);
    border-radius: var(--radius);
    padding: 3px;
    border: 1px solid var(--border);
}

.timing-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: calc(var(--radius) - 2px);
    transition: background 0.2s, color 0.2s;
}

.timing-btn.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.timing-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* Visioning prompts */
.visioning-prompt {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
}

.prompt-number {
    font-size: 0.8125rem;
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.prompt-text {
    font-family: var(--font-serif);
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    font-weight: 500;
    line-height: 1.45;
}

/* ============================================
   Benchmark Scoring View
   ============================================ */

.benchmark-view {
    max-width: 42rem;
    margin: 0 auto;
}

.benchmark-header {
    margin-bottom: var(--space-2xl);
}

.benchmark-header h1 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: 600;
    color: var(--brown-dark);
    margin-bottom: var(--space-sm);
}

.benchmark-desc {
    color: var(--text-secondary);
    font-size: var(--text-base);
    line-height: 1.6;
    margin-bottom: var(--space-md);
}

.score-legend {
    background: var(--bg-warm);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.score-legend strong {
    color: var(--text-primary);
}

.benchmark-scores {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.score-row {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.score-category-info {
    flex: 1;
    min-width: 0;
}

.score-category-name {
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--text-primary);
}

.score-category-num {
    color: var(--text-light);
    font-size: 0.8125rem;
}

.score-slider-container {
    flex: 2;
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.score-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--bg-warm);
    border-radius: 999px;
    outline: none;
}

.score-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green-mid);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s;
}

.score-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.score-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green-mid);
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.score-value {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--green-dark);
    min-width: 2rem;
    text-align: center;
}

/* Comparison chart (before/after) */
.comparison-section {
    margin-top: var(--space-xl);
}

.comparison-section h3 {
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    margin-bottom: var(--space-lg);
    font-weight: 500;
}

.comparison-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.comparison-row {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.comparison-label {
    width: 7rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    flex-shrink: 0;
}

.comparison-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.comparison-bar {
    height: 12px;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.comparison-bar.before {
    background: var(--blue-light);
}

.comparison-bar.after {
    background: var(--green-mid);
}

.comparison-legend {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.before {
    background: var(--blue-light);
}

.legend-dot.after {
    background: var(--green-mid);
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 640px) {
    .header-inner {
        flex-wrap: wrap;
        padding: var(--space-sm) var(--space-md);
        gap: var(--space-sm);
    }

    .header-nav {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: var(--space-xs);
    }

    .save-indicator {
        margin-left: auto;
    }

    .app-main {
        padding: var(--space-lg) var(--space-md);
    }

    .dashboard-header h1 {
        font-size: var(--text-2xl);
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .exercise-cards {
        grid-template-columns: 1fr;
    }

    .category-view-header h1,
    .exercise-view-header h1,
    .benchmark-header h1 {
        font-size: var(--text-2xl);
    }

    .question-block,
    .tactics-group,
    .notes-block,
    .visioning-prompt {
        padding: var(--space-md);
    }

    .score-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-sm);
    }

    .score-slider-container {
        flex: none;
    }

    .comparison-row {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-xs);
    }

    .comparison-label {
        width: auto;
        text-align: left;
    }

    .data-actions {
        flex-direction: column;
    }

    .data-actions .btn {
        justify-content: center;
    }
}
