/* Copyright (c) 2025. Jericho Crosby (Chalwk) */

:root {
    --bg-1: #f8fafc;
    --panel: #ffffff;
    --muted: #6b7280;
    --accent: #7c3aed;
    --accent-600: #6d28d9;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --radius: 12px;
    --gap: 14px;
    --shadow: 0 8px 30px rgba(10, 20, 40, 0.06);
    --btn-padding: 10px 14px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 16px;
    line-height: 1.4;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: linear-gradient(180deg, var(--bg-1), #f1f5f9 60%);
    color: var(--text);
    padding-bottom: 48px;
}

.container { max-width: 1100px; margin: 0 auto; padding: 18px; }

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.skip {
    position: absolute; left: -999px; top: auto; width: 1px; height: 1px;
}
.skip:focus {
    left: 16px; top: 16px; width: auto; height: auto; padding: 8px 10px;
    background: #fff; border-radius: 6px; box-shadow: var(--shadow);
}

.site-header { padding: 14px 0 6px; }
.header-inner { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.brand { display:flex; align-items:center; gap:12px; }
.logo { border-radius:8px; flex-shrink:0; }
.title-wrap h1 { margin:0; font-size:1.05rem; letter-spacing: -0.2px; }
.tagline { margin:4px 0 0; color:var(--muted); font-size:0.9rem; }

.header-actions { display:flex; gap:8px; align-items:center; }
.btn {
    appearance:none; border:1px solid rgba(15,23,42,0.06); background:#fff;
    padding: var(--btn-padding); border-radius:10px; cursor:pointer; font-weight:700; font-size:0.95rem;
    min-height:44px;
}
.btn.ghost { background: transparent; border-color:transparent; color:var(--accent); padding:8px; }
.btn.primary { background: linear-gradient(180deg,var(--accent),var(--accent-600)); color:#fff; border-color:transparent; }
.btn.small { padding:6px 8px; min-height:36px; font-size:0.85rem; }

.app-grid {
    display:grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 18px;
}

@media (min-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr 380px;
        align-items:start;
    }
}

.panel {
    background: var(--panel);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(15,23,42,0.03);
}

.panel-head { margin-bottom: 8px; }
.panel-head h2 { margin: 0 0 6px; font-size: 1.05rem; }
.panel-head .small { margin:0; color:var(--muted); font-size:0.9rem; }

.field { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.field span { font-weight:600; font-size:0.9rem; }
.field input, .field textarea {
    padding:10px 12px; border-radius:8px; border:1px solid #e2e8f0; font-size:0.95rem;
    background:#fff; transition:border-color 0.2s;
}
.field input:focus, .field textarea:focus {
    outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(124,58,237,0.1);
}

.script-steps { margin:16px 0; }
.script-steps h3 { margin:0 0 12px; font-size:1rem; }
.steps-list { display:flex; flex-direction:column; gap:8px; max-height:400px; overflow-y:auto; padding:4px; }
.step-item {
    display:flex; gap:10px; align-items:flex-start; padding:12px; border-radius:8px;
    background:#f8fafc; border:1px solid #e2e8f0;
}
.step-content { flex:1; }
.step-item textarea {
    width:100%; padding:8px 10px; border-radius:6px; border:1px solid #cbd5e1;
    font-size:0.9rem; resize:vertical; min-height:60px;
}
.step-type { min-width:120px; }
.step-actions { display:flex; gap:6px; }
.step-actions .btn { padding:4px 8px; font-size:0.8rem; }

.step-actions { display:flex; gap:10px; margin-top:12px; align-items:center; }
.step-actions select { padding:8px 10px; border-radius:6px; border:1px solid #cbd5e1; }

.script-actions { display:flex; gap:10px; margin-top:16px; flex-wrap:wrap; }

.search-controls { margin-bottom:12px; }
.search-controls input {
    width:100%; padding:10px 12px; border-radius:8px; border:1px solid #e2e8f0;
}
.scripts-library { display:flex; flex-direction:column; gap:10px; max-height:300px; overflow-y:auto; }
.script-card {
    padding:12px; border-radius:8px; background:#f8fafc; border:1px solid #e2e8f0;
    cursor:pointer; transition:all 0.2s;
}
.script-card:hover { border-color:var(--accent); transform:translateY(-2px); }
.script-card h4 { margin:0 0 6px; font-size:0.95rem; }
.script-card p { margin:0; color:var(--muted); font-size:0.85rem; }
.script-card-actions { display:flex; gap:6px; margin-top:8px; }
.script-card-actions .btn { padding:4px 8px; font-size:0.8rem; }

.premade-scripts-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.premade-scripts-section h3 { margin: 0 0 6px; font-size: 1rem; }
.premade-scripts { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; margin-top: 12px; }
.premade-script-card {
    padding: 12px; border-radius: 8px; background: #f0f9ff; border: 1px solid #bae6fd;
    cursor: pointer; transition: all 0.2s;
}
.premade-script-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.premade-script-card h4 { margin: 0 0 6px; font-size: 0.95rem; color: #0369a1; }
.premade-script-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }

.preview-modal {
    max-width: 600px; width: 90vw;
    border: none; border-radius: 12px; padding: 0;
    box-shadow: 0 12px 50px rgba(0,0,0,0.12);
}
.preview-content {
    padding: 16px; max-height: 60vh; overflow-y: auto;
}
.preview-steps {
    display: flex; flex-direction: column; gap: 12px; margin-top: 16px;
}
.preview-step {
    padding: 12px; border-radius: 8px; border-left: 4px solid;
    background: #f8fafc;
}
.preview-step-type {
    font-size: 0.8rem; font-weight: 600; margin-bottom: 6px; text-transform: uppercase;
}
.preview-step-text {
    font-size: 0.95rem; line-height: 1.4;
}

.preview-step.step-type-statement { border-left-color: #1e40af; background: #dbeafe; }
.preview-step.step-type-question { border-left-color: #166534; background: #f0fdf4; }
.preview-step.step-type-action { border-left-color: #92400e; background: #fef3c7; }
.preview-step.step-type-reminder { border-left-color: #7c3aed; background: #f3e8ff; }

.practice-tools { margin-top:16px; }
.tool-options { display:flex; flex-direction:column; gap:8px; }

.checkbox { display:flex; align-items:center; gap:8px; cursor:pointer; }
.checkbox input[type="checkbox"] { width:18px; height:18px; }

dialog {
    border:none; border-radius:12px; padding:0; box-shadow: 0 12px 50px rgba(0,0,0,0.12);
    max-width:500px; width:90vw;
}
.modal-header {
    display:flex; justify-content:space-between; align-items:center;
    padding:16px; border-bottom:1px solid #e2e8f0;
}
.modal-header h3 { margin:0; }

.practice-content { padding:16px; }
.practice-step {
    text-align:center; padding:24px; border-radius:8px; background:#f8fafc;
    margin-bottom:16px; min-height:120px; display:flex; flex-direction:column;
    justify-content:center; align-items:center;
}
.step-content { font-size:1.1rem; line-height:1.5; margin-bottom:12px; }
.step-type-badge {
    padding:4px 12px; border-radius:999px; font-size:0.8rem; font-weight:600;
}
.step-type-statement { background:#dbeafe; color:#1e40af; }
.step-type-question { background:#f0fdf4; color:#166534; }
.step-type-action { background:#fef3c7; color:#92400e; }
.step-type-reminder { background:#f3e8ff; color:#7c3aed; }

.practice-progress { margin:16px 0; }
.progress-bar {
    height:6px; background:#e2e8f0; border-radius:3px; overflow:hidden;
    margin-bottom:8px;
}
.progress-fill {
    height:100%; background:var(--accent); transition:width 0.3s;
}
.practice-controls { display:flex; gap:10px; justify-content:center; }
.practice-timer {
    text-align:center; margin-top:12px; padding:8px;
    background:#f8fafc; border-radius:6px; font-weight:600;
}

.help-content { padding:16px; max-height:60vh; overflow-y:auto; }
.help-section { margin-bottom:20px; }
.help-section h4 { margin:0 0 8px; font-size:0.95rem; }
.help-section p, .help-section ul { margin:0; font-size:0.9rem; }
.help-section ul { padding-left:20px; }
.help-section li { margin-bottom:4px; }

.modal-actions {
    padding:16px; border-top:1px solid #e2e8f0;
    display:flex; justify-content:flex-end;
}

.site-footer { padding:12px 0; margin-top:20px; color:var(--muted); }
.footer-inner { display:flex; justify-content:space-between; align-items:center; gap:8px; }

.muted { color:var(--muted); }
.small { font-size:0.9rem; color:var(--muted); }

.install-btn {
    display: none;
    margin: 10px auto;
}

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #fbbf24;
    color: #92400e;
    text-align: center;
    padding: 8px;
    font-size: 0.9rem;
    z-index: 1000;
    display: none;
}

.offline-indicator.show {
    display: block;
}

@keyframes fadeIn { from { opacity:0; transform: translateY(6px);} to { opacity:1; transform:none; } }
.fade-in { animation: fadeIn 0.45s ease both; }

@media (hover: none) {
    .btn { min-height:48px; padding:12px 14px; }
}

@media (max-width:420px) {
    .header-inner { gap:8px; }
    .title-wrap h1 { font-size:0.98rem; }
    .step-item { padding:10px; }
}