/*
================================================================
Project   : Cholesterol Coach
Module    : Core Styling
File      : /css/app.css
Purpose   : Global application styling for the Cholesterol Coach Core platform.
Author    : Mario Delaquis / Delaquis Prompt Engineering (PTY) Ltd
Created   : 2026-05-04
Updated   : 2026-05-04
Copyright : © 2026 Delaquis Prompt Engineering (Pty) Ltd. All rights reserved.
License   : Proprietary / Internal Use Only
================================================================
*/

/* -------------------------------------------------------------
   Base
------------------------------------------------------------- */

:root {
    --cc-bg: #f6f8f5;
    --cc-surface: #ffffff;
    --cc-surface-soft: #eef5ec;
    --cc-primary: #2f7d32;
    --cc-primary-dark: #235f26;
    --cc-primary-soft: #e4f2e2;
    --cc-secondary: #355c7d;
    --cc-text: #1f2a24;
    --cc-muted: #66756c;
    --cc-border: #dce5dc;
    --cc-danger: #b42318;
    --cc-warning: #b7791f;
    --cc-success: #2f7d32;
    --cc-radius: 16px;
    --cc-shadow: 0 12px 30px rgba(31, 42, 36, 0.08);
    --cc-header-height: 78px;
    --cc-container: 1180px;
    --cc-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body.cc-body {
    margin: 0;
    min-height: 100vh;
    background: var(--cc-bg);
    color: var(--cc-text);
    font-family: var(--cc-font);
    font-size: 16px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

button,
input,
select,
textarea {
    font: inherit;
}

.site-main {
    min-height: calc(100vh - 220px);
}

/* -------------------------------------------------------------
   Layout Helpers
------------------------------------------------------------- */

.container,
.cc-container {
    width: min(var(--cc-container), calc(100% - 32px));
    margin: 0 auto;
}

.page-section {
    padding: 48px 0;
}

.page-section.compact {
    padding: 28px 0;
}

.card {
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    box-shadow: var(--cc-shadow);
    padding: 24px;
}

.card-soft {
    background: var(--cc-surface-soft);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
    padding: 24px;
}

.grid {
    display: grid;
    gap: 24px;
}

.grid.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.text-muted {
    color: var(--cc-muted);
}

.text-center {
    text-align: center;
}

.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

/* -------------------------------------------------------------
   Header
------------------------------------------------------------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--cc-border);
    backdrop-filter: blur(10px);
}

.site-header-inner {
    width: min(var(--cc-container), calc(100% - 32px));
    min-height: var(--cc-header-height);
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 22px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.site-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 12px;
}

.site-logo-fallback {
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--cc-primary);
    color: #ffffff;
    font-weight: 800;
    letter-spacing: 0.03em;
}

.site-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.site-brand-name {
    font-size: 18px;
    font-weight: 800;
}

.site-brand-tagline {
    margin-top: 3px;
    font-size: 12px;
    color: var(--cc-muted);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.main-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--cc-muted);
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.main-nav-link:hover,
.main-nav-link.active {
    background: var(--cc-primary-soft);
    color: var(--cc-primary-dark);
}

.site-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.language-switcher {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    background: var(--cc-surface-soft);
    border: 1px solid var(--cc-border);
    border-radius: 999px;
}

.language-link {
    min-width: 34px;
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--cc-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.language-link:hover,
.language-link.active {
    background: #ffffff;
    color: var(--cc-primary-dark);
    box-shadow: 0 2px 8px rgba(31, 42, 36, 0.08);
}

.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-email {
    max-width: 190px;
    overflow: hidden;
    color: var(--cc-muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}

.plan-badge.free {
    background: #f1f3f2;
    color: var(--cc-muted);
}

.plan-badge.premium-plus {
    background: #fff3d8;
    color: #7a4f00;
}

/* -------------------------------------------------------------
   Buttons
------------------------------------------------------------- */

.btn,
button.btn,
input[type="submit"].btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--cc-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--cc-primary-dark);
}

.btn-secondary {
    background: #ffffff;
    color: var(--cc-primary-dark);
    border-color: var(--cc-border);
}

.btn-secondary:hover {
    background: var(--cc-primary-soft);
    border-color: #c5dcc2;
}

.btn-danger {
    background: var(--cc-danger);
    color: #ffffff;
}

.btn-block {
    width: 100%;
}

/* -------------------------------------------------------------
   Forms
------------------------------------------------------------- */

.form-card {
    width: min(520px, calc(100% - 32px));
    margin: 44px auto;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 24px;
    box-shadow: var(--cc-shadow);
    padding: 30px;
}

.form-title {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
}

.form-subtitle {
    margin: 0 0 24px;
    color: var(--cc-muted);
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    margin-bottom: 7px;
    font-weight: 700;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid var(--cc-border);
    border-radius: 12px;
    color: var(--cc-text);
    outline: none;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    border-color: var(--cc-primary);
    box-shadow: 0 0 0 3px rgba(47, 125, 50, 0.12);
}

.form-help {
    margin-top: 6px;
    color: var(--cc-muted);
    font-size: 13px;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

/* -------------------------------------------------------------
   Alerts
------------------------------------------------------------- */

.alert {
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--cc-border);
    background: #ffffff;
}

.alert-success {
    background: #e8f5e9;
    border-color: #c8e6c9;
    color: #1b5e20;
}

.alert-warning {
    background: #fff8e1;
    border-color: #ffe0a3;
    color: #7a4f00;
}

.alert-danger,
.alert-error {
    background: #fdecea;
    border-color: #f5c2be;
    color: var(--cc-danger);
}

.alert-info {
    background: #e8f2fb;
    border-color: #c9dff2;
    color: #204765;
}

/* -------------------------------------------------------------
   Tables
------------------------------------------------------------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: var(--cc-radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--cc-border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--cc-surface-soft);
    font-size: 13px;
    font-weight: 800;
}

tr:last-child td {
    border-bottom: 0;
}

/* -------------------------------------------------------------
   Hero / Public Pages
------------------------------------------------------------- */

.hero {
    padding: 70px 0 50px;
    background:
        radial-gradient(circle at top left, rgba(47, 125, 50, 0.12), transparent 34%),
        linear-gradient(180deg, #ffffff 0%, var(--cc-bg) 100%);
}

.hero-inner {
    width: min(var(--cc-container), calc(100% - 32px));
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
    gap: 38px;
    align-items: center;
}

.hero-kicker {
    display: inline-flex;
    margin-bottom: 14px;
    padding: 7px 12px;
    background: var(--cc-primary-soft);
    border-radius: 999px;
    color: var(--cc-primary-dark);
    font-size: 13px;
    font-weight: 800;
}

.hero-title {
    margin: 0;
    font-size: clamp(38px, 5vw, 64px);
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.hero-text {
    margin: 20px 0 0;
    color: var(--cc-muted);
    font-size: 19px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.hero-panel {
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 28px;
    box-shadow: var(--cc-shadow);
    padding: 28px;
}

/* -------------------------------------------------------------
   Dashboard / Module Pages
------------------------------------------------------------- */

.page-header {
    width: min(var(--cc-container), calc(100% - 32px));
    margin: 34px auto 22px;
}

.page-title {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.12;
}

.page-intro {
    max-width: 780px;
    margin: 10px 0 0;
    color: var(--cc-muted);
    font-size: 17px;
}

.module-grid {
    width: min(var(--cc-container), calc(100% - 32px));
    margin: 0 auto 48px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
}

.module-card {
    display: block;
    background: var(--cc-surface);
    border: 1px solid var(--cc-border);
    border-radius: 22px;
    box-shadow: var(--cc-shadow);
    padding: 22px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #bdd8ba;
}

.module-card h2,
.module-card h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.module-card p {
    margin: 0;
    color: var(--cc-muted);
}

/* -------------------------------------------------------------
   Footer
------------------------------------------------------------- */

.site-footer {
    margin-top: 60px;
    background: #ffffff;
    border-top: 1px solid var(--cc-border);
}

.site-footer-inner {
    width: min(var(--cc-container), calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 20px;
    align-items: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.footer-brand span,
.footer-meta {
    color: var(--cc-muted);
    font-size: 13px;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px 16px;
}

.footer-nav a {
    color: var(--cc-muted);
    font-size: 14px;
    font-weight: 650;
}

.footer-nav a:hover {
    color: var(--cc-primary-dark);
}

.footer-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding-top: 10px;
    border-top: 1px solid var(--cc-border);
}

/* -------------------------------------------------------------
   Responsive
------------------------------------------------------------- */

@media (max-width: 980px) {
    .site-header-inner {
        flex-wrap: wrap;
        padding: 12px 0;
    }

    .site-brand {
        flex: 1;
    }

    .main-nav {
        order: 3;
        width: 100%;
        flex: 0 0 100%;
        padding-top: 6px;
    }

    .site-header-actions {
        margin-left: 0;
    }

    .hero-inner {
        grid-template-columns: 1fr;
    }

    .module-grid,
    .grid.three {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 680px) {
    :root {
        --cc-header-height: auto;
    }

    .site-header-inner {
        width: min(100% - 20px, var(--cc-container));
    }

    .site-brand {
        min-width: 0;
    }

    .site-brand-tagline {
        display: none;
    }

    .site-header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .language-switcher {
        max-width: 100%;
        overflow-x: auto;
    }

    .user-status {
        width: 100%;
        justify-content: space-between;
    }

    .user-email {
        max-width: 60%;
    }

    .hero {
        padding: 42px 0 34px;
    }

    .hero-title {
        font-size: 38px;
    }

    .hero-text {
        font-size: 17px;
    }

    .form-card {
        margin: 24px auto;
        padding: 22px;
    }

    .module-grid,
    .grid.three {
        grid-template-columns: 1fr;
    }

    .site-footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-nav {
        justify-content: flex-start;
    }
}