/* ===================================================================
   CHAKULA SMART — Application UI (dashboards, admin, internal pages)
   Scoped to body:not(.landing-page) so the landing page keeps its style.
   =================================================================== */

/* ================= App shell ================= */
body:not(.landing-page) {
    font-family: var(--font-body);
    background-color: var(--surface-base);
    background-image:
        radial-gradient(ellipse 80% 50% at 0% -10%, rgba(45, 106, 79, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(212, 160, 23, 0.08), transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    perspective: none;
}

body:not(.landing-page) h1,
body:not(.landing-page) h2,
body:not(.landing-page) h3,
body:not(.landing-page) h4,
body:not(.landing-page) h5,
body:not(.landing-page) .h1,
body:not(.landing-page) .h2,
body:not(.landing-page) .h3,
body:not(.landing-page) .h4,
body:not(.landing-page) .h5 {
    font-family: var(--font-display);
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

body:not(.landing-page) main.container,
body:not(.landing-page) > .container {
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
}

/* ================= Navigation ================= */
.navbar-app,
.navbar-app.navbar-dark {
    background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 48%, var(--brand-800) 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-nav);
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
}

.navbar-app .navbar-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.15rem;
    color: #fff !important;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    letter-spacing: -0.03em;
}

.navbar-app .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    color: var(--accent-light);
    font-size: 1rem;
}

.navbar-app .nav-link {
    color: rgba(255, 255, 255, 0.82) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.45rem 0.85rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.navbar-app .nav-link:hover,
.navbar-app .nav-link:focus {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.1);
}

.navbar-app .nav-link.active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 600;
}

.navbar-app .navbar-user {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

.btn-nav-ghost {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: transparent;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
}

.btn-nav-ghost:hover,
.btn-nav-ghost:focus {
    color: var(--brand-900);
    background: #fff;
    border-color: #fff;
}

.navbar-app .btn-light {
    background: #fff;
    color: var(--brand-800);
    border: none;
    font-weight: 600;
    border-radius: var(--radius-sm);
}

.navbar-app .btn-light:hover {
    background: var(--accent-light);
    color: var(--brand-900);
}

/* Legacy navbars still using navbar-dark + inline bg */
body:not(.landing-page) .navbar-dark:not(.navbar-app) {
    background: linear-gradient(135deg, var(--brand-900), var(--brand-700)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-nav);
}

/* ================= Page header ================= */
.page-header {
    margin-bottom: 1.75rem;
}

.page-header .page-title {
    font-size: clamp(1.35rem, 2.5vw, 1.85rem);
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.page-header .page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

/* ================= Cards (app — calm, professional) ================= */
body:not(.landing-page) .card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    box-shadow: var(--shadow-card);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: none;
    transition: box-shadow var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

body:not(.landing-page) .card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(45, 106, 79, 0.2);
}

body:not(.landing-page) .card h5 {
    transform: none;
    color: var(--brand-700);
    font-weight: 700;
}

body:not(.landing-page) .card-header {
    background: var(--surface-muted);
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

body:not(.landing-page) .card-body {
    padding: 1.25rem;
}

/* ================= Stat cards ================= */
.stat-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.35rem;
    height: 100%;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-600), var(--accent-500));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ================= Quick links & panels ================= */
.quick-link {
    text-decoration: none;
    color: inherit;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: block;
    height: 100%;
    box-shadow: var(--shadow-card);
    transition: var(--transition-fast);
}

.quick-link:hover {
    color: inherit;
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
    border-color: rgba(45, 106, 79, 0.25);
}

.panel-card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.panel-card .panel-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.panel-card .panel-head h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

/* ================= Highlight / CTA cards ================= */
.progress-form-card,
.hero-panel {
    background: linear-gradient(135deg, var(--brand-800) 0%, var(--brand-600) 55%, var(--brand-700) 100%);
    border-radius: var(--radius-xl);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-elevated);
    position: relative;
    overflow: hidden;
}

.progress-form-card::after,
.hero-panel::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    top: -80px;
    right: -60px;
    pointer-events: none;
}

.progress-form-card .form-control,
.hero-panel .form-control {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
}

.progress-form-card .form-control:focus,
.hero-panel .form-control:focus {
    border-color: var(--accent-400);
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.25);
}

.quick-log-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    transition: var(--transition-fast);
}

.quick-log-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

/* ================= List items ================= */
.meal-plan-card {
    border-left: 4px solid var(--brand-600) !important;
    transition: var(--transition-fast);
}

.meal-plan-card:hover {
    background: var(--surface-muted) !important;
}

.idea-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    transition: var(--transition-fast);
}

.idea-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.vote-badge {
    background: linear-gradient(135deg, var(--accent-500), var(--accent-600));
    color: #fff;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}

/* ================= Buttons (app) ================= */
body:not(.landing-page) .btn {
    border-radius: var(--radius-sm);
    padding: 0.55rem 1.15rem;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: none;
}

body:not(.landing-page) .btn-primary {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
    border: none;
    color: #fff;
    box-shadow: 0 4px 14px rgba(27, 67, 50, 0.28);
}

body:not(.landing-page) .btn-primary:hover {
    background: linear-gradient(135deg, var(--brand-700), var(--brand-900));
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(27, 67, 50, 0.35);
    color: #fff;
}

body:not(.landing-page) .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(27, 67, 50, 0.25);
}

body:not(.landing-page) .btn-outline-primary {
    color: var(--brand-700);
    border-color: var(--brand-600);
    border-width: 1.5px;
}

body:not(.landing-page) .btn-outline-primary:hover {
    background: var(--brand-600);
    border-color: var(--brand-600);
    color: #fff;
}

body:not(.landing-page) .btn-success {
    background: linear-gradient(135deg, #2d9a5c, #1e7a47);
    border: none;
}

/* ================= Forms ================= */
body:not(.landing-page) .form-control,
body:not(.landing-page) .form-select {
    border: 1.5px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    background: #fff;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

body:not(.landing-page) .form-control:hover,
body:not(.landing-page) .form-select:hover {
    border-color: var(--brand-500);
    transform: none;
    box-shadow: none;
}

body:not(.landing-page) .form-control:focus,
body:not(.landing-page) .form-select:focus {
    border-color: var(--brand-600);
    box-shadow: var(--focus-ring);
    transform: none;
}

body:not(.landing-page) .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

/* ================= Tables ================= */
body:not(.landing-page) .table {
    --bs-table-bg: transparent;
    font-size: 0.9rem;
}

body:not(.landing-page) .table thead th {
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem;
}

body:not(.landing-page) .table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: var(--border-subtle);
}

body:not(.landing-page) .table-hover tbody tr:hover {
    background: rgba(45, 106, 79, 0.04);
}

.table-wrap {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

/* ================= Alerts ================= */
body:not(.landing-page) .alert {
    border: none;
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow-sm);
}

body:not(.landing-page) .alert-success {
    background: #e8f5ec;
    color: #1a5c38;
}

body:not(.landing-page) .alert-danger {
    background: #fdecea;
    color: #8b2918;
}

body:not(.landing-page) .alert-warning {
    background: #fff8e6;
    color: #7a5c00;
}

body:not(.landing-page) .alert-info {
    background: #e8f4fc;
    color: #0c4a6e;
}

/* ================= Badges ================= */
body:not(.landing-page) .badge {
    font-weight: 600;
    padding: 0.35em 0.65em;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

/* ================= Auth pages ================= */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(45, 106, 79, 0.15), transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(212, 160, 23, 0.1), transparent 45%),
        var(--surface-base);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-elevated);
    padding: 2rem;
}

.auth-card .auth-logo {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

/* ================= Chart container ================= */
.chart-container {
    position: relative;
    height: 220px;
}

/* ================= Footer (app) ================= */
body:not(.landing-page) footer.app-footer {
    background: var(--brand-900);
    color: rgba(255, 255, 255, 0.7);
    padding: 1.5rem 0;
    margin-top: 2rem;
    clip-path: none;
}

/* ================= Responsive (app) ================= */
@media (max-width: 991.98px) {
    .stat-value { font-size: 1.5rem; }
    .chart-container { height: 180px; }
}

@media (max-width: 767.98px) {
    .navbar-app .navbar-brand { font-size: 1.05rem; }
    .stat-card { padding: 1rem; }
    .stat-icon { width: 40px; height: 40px; font-size: 1.2rem; }
    .stat-value { font-size: 1.35rem; }
    .progress-form-card { padding: 1rem !important; }
    .chart-container { height: 160px; }
}

@media (max-width: 575.98px) {
    body:not(.landing-page) main.container { padding-top: 1.25rem; }
    .stat-card { padding: 0.9rem; border-radius: var(--radius-md); }
    .stat-icon { width: 36px; height: 36px; font-size: 1.1rem; }
    .stat-value { font-size: 1.2rem; }
    .quick-link { padding: 1rem; }
}
