/* =============================================================
   Analyze Page Styles — extracted from index.html inline <style>
   FORGE-051: UX alignment with Profile page
   ============================================================= */

/* ─── Local tokens (aliases for readability) ─── */
:root {
    --primary-color: var(--avb-jade);
    --secondary-color: var(--avb-primary);
    --success-color: var(--avb-success);
    --warning-color: var(--avb-amber);
    --danger-color: var(--avb-danger);
    --bg-gradient: var(--avb-grad-brand);
    --card-shadow: 0 4px 20px rgba(0,0,0,0.1);
    --transition-smooth: all 0.3s ease;
    --border-radius: 12px;
}

/* ─── Base ─── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--avb-font-body);
    line-height: 1.6;
    color: var(--avb-text-body);
    background: var(--avb-surface-light);
    overflow-x: hidden;
    min-height: 100vh;
}

/* ─── View container system ─── */
.view-container {
    width: 100%;
    min-height: calc(100vh - 80px);
    max-height: calc(100vh - 80px);
    display: block;
    overflow-y: auto;
    overflow-x: hidden;
}

.view-container.hidden {
    display: none !important;
}

/* ─── Dashboard layout (1200px — unchanged) ─── */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.welcome-section {
    text-align: center;
    margin-bottom: 3rem;
}

.welcome-section h2 {
    font-size: 2.5rem;
    color: var(--avb-text-body);
    margin-bottom: 1rem;
}

.welcome-section p {
    font-size: 1.2rem;
    color: var(--avb-text-dim);
    max-width: 600px;
    margin: 0 auto;
}

/* ─── Quick-actions grid ─── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.action-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    cursor: pointer;
    border: 2px solid transparent;
}

.action-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.action-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.action-card h3 {
    color: var(--avb-text-body);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.action-card p {
    color: var(--avb-text-dim);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.action-btn {
    background: var(--bg-gradient);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ─── Recent activity ─── */
.recent-activity {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

.activity-item:hover {
    background: var(--avb-surface-light);
}

.activity-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 600;
    color: var(--avb-text-body);
}

.activity-meta {
    color: var(--avb-text-dim);
    font-size: 0.9rem;
}

/* ─── Analysis hub card ─── */
#analyze-view .dashboard-container {
    padding: 12px 0 0;
    height: auto;
}

.analysis-hub {
    display: none;
    background: white;
    overflow: hidden;
}

/* ─── Analysis sub-tabs (within Analyze view) ─── */
.analysis-tabs {
    display: flex;
    gap: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--avb-surface-muted);
    margin-bottom: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: transparent;
}

.analysis-tab {
    padding: 10px 16px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--avb-text-dim);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.2s ease, border-color 0.2s ease;
    font-size: 0.85rem;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
}

.analysis-tab:hover {
    color: var(--avb-text-dark);
}

.analysis-tab.active {
    color: var(--avb-primary);
    border-bottom-color: var(--avb-primary);
    font-weight: 600;
}

/* ─── Analysis content / panes ─── */
.analysis-content {
    padding: 1rem 24px;
    line-height: 1.6;
}

.analysis-pane {
    display: none;
    max-width: 800px;
}

.analysis-pane h3 {
    margin: 0.25rem 0 0.35rem;
}

.analysis-pane p {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
}

.analysis-pane.active {
    display: block;
}

/* ─── Analyze form elements ─── */
.analyze-textarea {
    width: 100%;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--avb-surface-muted);
    min-height: 100px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.analyze-textarea:focus {
    outline: none;
    border-color: var(--avb-primary);
    box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.1);
}

.analyze-input-group {
    margin-top: 0.5rem;
}

.analyze-btn {
    margin-top: 1rem;
    width: auto;
}

.analyze-results {
    margin-top: 2rem;
}

.analyze-hint {
    color: var(--avb-text-dim);
}

.compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ─── Results containers — scrollable ─── */
#supplement-results,
#nutrition-results,
#interactions-results,
#compare-results {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    margin-right: -10px;
}

/* ─── Custom scrollbar ─── */
.analysis-pane::-webkit-scrollbar,
#supplement-results::-webkit-scrollbar,
#nutrition-results::-webkit-scrollbar,
#interactions-results::-webkit-scrollbar,
#compare-results::-webkit-scrollbar {
    width: 8px;
}

.analysis-pane::-webkit-scrollbar-track,
#supplement-results::-webkit-scrollbar-track,
#nutrition-results::-webkit-scrollbar-track,
#interactions-results::-webkit-scrollbar-track,
#compare-results::-webkit-scrollbar-track {
    background: var(--avb-surface-light);
    border-radius: 4px;
}

.analysis-pane::-webkit-scrollbar-thumb,
#supplement-results::-webkit-scrollbar-thumb,
#nutrition-results::-webkit-scrollbar-thumb,
#interactions-results::-webkit-scrollbar-thumb,
#compare-results::-webkit-scrollbar-thumb {
    background: var(--avb-surface-muted);
    border-radius: 4px;
}

.analysis-pane::-webkit-scrollbar-thumb:hover,
#supplement-results::-webkit-scrollbar-thumb:hover,
#nutrition-results::-webkit-scrollbar-thumb:hover,
#interactions-results::-webkit-scrollbar-thumb:hover,
#compare-results::-webkit-scrollbar-thumb:hover {
    background: var(--avb-text-placeholder);
}

/* ─── Loading overlay ─── */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.loading-spinner {
    font-size: 2rem;
    margin-bottom: 1rem;
}

/* ─── Mobile responsive ─── */
@media (max-width: 768px) {
    .dashboard-container {
        padding: 1rem;
    }

    .quick-actions {
        grid-template-columns: 1fr;
    }

    .welcome-section h2 {
        font-size: 2rem;
    }

    .analysis-tabs {
        overflow-x: auto;
    }
}

@media (max-width: 600px) {
    .compare-grid {
        grid-template-columns: 1fr;
    }
}
