/* ==========================================================================
   TrackIEP: Special Educator Companion — Mobile-First Doorstep Stylesheet
   ========================================================================== */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --secondary-color: #475569;
    --success-color: #16a34a;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --bg-main: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --recap-bg: #fffbeb;
    --recap-border: #f59e0b;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 8px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    padding-bottom: 32px;
}

/* Prevent iOS Safari auto-zoom on form focus by ensuring >= 16px font size */
input.form-control,
select.form-select,
textarea.form-control {
    font-size: 1rem !important;
}

/* App Header & Top Navigation */
.app-header {
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.brand-icon {
    font-size: 1.4rem;
    line-height: 1;
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

/* Compact AI Batch Sync Banner */
.sync-banner {
    background: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    color: #ffffff;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-sync-action {
    background-color: #ffffff;
    color: #1e1b4b;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.btn-sync-action:hover, .btn-sync-action:active {
    background-color: #f8fafc;
    color: #1e1b4b;
}

/* Child Card Styling */
.child-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.child-card-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid #f1f5f9;
}

.child-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #e0e7ff;
    color: #3730a3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.child-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.child-age-badge {
    background-color: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
}

.focus-badge {
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.76rem;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
    display: inline-block;
}

/* 15-Second Pre-Doorstep Recap Box */
.recap-box {
    background-color: var(--recap-bg);
    border-left: 4px solid var(--recap-border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 10px 12px;
    margin: 10px 14px;
}

.recap-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.recap-activity {
    font-size: 0.88rem;
    color: #1f2937;
    line-height: 1.35;
    font-weight: 500;
}

.recap-homework {
    background: #ffffff;
    border: 1px dashed #fcd34d;
    border-radius: 6px;
    padding: 5px 8px;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #78350f;
}

/* Baseline Tags Chips */
.baseline-chip {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

/* Big Thumb-Friendly Tap Buttons */
.btn-doorstep-primary {
    background-color: var(--primary-color);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    padding: 12px 16px;
    min-height: 48px;
    border-radius: var(--radius-md);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.18);
    text-decoration: none;
}

.btn-doorstep-primary:hover, .btn-doorstep-primary:active {
    background-color: var(--primary-hover);
    color: #ffffff;
}

.btn-doorstep-secondary {
    background-color: #ffffff;
    color: #334155;
    font-weight: 600;
    font-size: 0.88rem;
    padding: 10px 12px;
    min-height: 44px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-decoration: none;
}

.btn-doorstep-secondary:hover, .btn-doorstep-secondary:active {
    background-color: #f8fafc;
    color: #0f172a;
}

/* Quick Action Chips (Logger) */
.quick-chips-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 6px;
}

.tool-chip {
    display: inline-block;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 11px;
    border-radius: 18px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.12s ease, border-color 0.12s ease;
}

.tool-chip:active,
.tool-chip.tool-chip-active {
    background: #dbeafe;
    border-color: var(--primary-color);
    color: #1d4ed8;
}

/* Goal Checkbox Label (Logger) */
.goal-checkbox-label {
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 8px 12px;
    cursor: pointer;
    width: 100%;
    display: block;
    user-select: none;
}

.btn-check:checked + .goal-checkbox-label {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* WhatsApp Share Card (Logger) */
.whatsapp-card {
    background: linear-gradient(135deg, #128c7e 0%, #25d366 100%);
    color: #ffffff;
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    box-shadow: 0 6px 16px rgba(37, 211, 102, 0.25);
}

.btn-whatsapp-share {
    background-color: #ffffff;
    color: #075e54;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.btn-whatsapp-share:hover, .btn-whatsapp-share:active {
    color: #054c44;
    background-color: #f8fafc;
}

.preview-message-box {
    background: rgba(255, 255, 255, 0.96);
    color: #1f2937;
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 0.84rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* Child Setup & Goals Cards */
.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
    gap: 6px;
}

.section-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    margin-bottom: 16px;
}

.goal-item {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px;
    background: #ffffff;
    margin-bottom: 8px;
}

.goal-item.active {
    border-left: 4px solid #16a34a;
}

.goal-item.achieved {
    border-left: 4px solid #3b82f6;
    background: #f8fafc;
}

.goal-item.paused {
    border-left: 4px solid #94a3b8;
    opacity: 0.85;
}

/* Analytics & Insights Styles */
.kpi-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 8px;
    height: 100%;
}

.kpi-value {
    font-size: 1.45rem;
    font-weight: 800;
    line-height: 1.1;
}

.chart-container-card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
}

.table-correlation th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    background-color: #f8fafc;
    border-top: none;
    padding: 8px 10px;
}

.table-correlation td {
    padding: 10px;
    vertical-align: middle;
    font-size: 0.85rem;
}

.badge-modality {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 5px;
    background: #f1f5f9;
    color: #475569;
    display: inline-block;
    margin-top: 2px;
}

.score-pill {
    display: inline-block;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 2px 6px;
    border-radius: 5px;
}

.score-high {
    background-color: #dcfce7;
    color: #15803d;
}

.score-med {
    background-color: #fef9c3;
    color: #a16207;
}

.score-low {
    background-color: #fee2e2;
    color: #b91c1c;
}

.child-switcher-pill {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 18px;
    text-decoration: none;
    white-space: nowrap;
}

/* Thumb-friendly Radio & Checkbox Pills */
.btn-check-pill + label {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 8px;
    min-height: 48px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #ffffff;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    width: 100%;
    line-height: 1.2;
}

.btn-check-pill:checked + label {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 700;
    box-shadow: 0 0 0 1px var(--primary-color);
}

/* Prompt Level & Engagement Pill Variants */
.pill-level-1:checked + label,
.pill-eng-1:checked + label {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    box-shadow: 0 0 0 1px #ef4444;
}

.pill-level-2:checked + label,
.pill-eng-2:checked + label {
    border-color: #f59e0b !important;
    background-color: #fffbeb !important;
    color: #92400e !important;
    box-shadow: 0 0 0 1px #f59e0b;
}

.pill-level-3:checked + label,
.pill-eng-3:checked + label {
    border-color: #0284c7 !important;
    background-color: #f0f9ff !important;
    color: #0369a1 !important;
    box-shadow: 0 0 0 1px #0284c7;
}

.pill-level-4:checked + label,
.pill-eng-4:checked + label {
    border-color: #16a34a !important;
    background-color: #f0fdf4 !important;
    color: #166534 !important;
    box-shadow: 0 0 0 1px #16a34a;
}

/* Empty State */
.empty-state-box {
    background: #ffffff;
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius-lg);
    padding: 28px 16px;
    text-align: center;
}
