/* CSS variables matching premium light-theme v2 with warm F&B tones */
:root {
    --bg: #faf7f2; /* Warm sand/cream background */
    --sidebar-bg: #ffffff;
    --surface: #ffffff;
    --border: #ebdcd0; /* Light coffee border */
    --border-bright: #d4bfb0;
    --text: #2c1d11; /* Warm coffee brown text */
    --text-dim: #7d6b5e; /* Dimmed warm brown */
    --accent: #b05c2e; /* Terracotta / Copper accent */
    --accent-dim: rgba(176, 92, 46, 0.08);
    --gold: #b38600; /* Warm gold */
    --gold-dim: rgba(179, 134, 0, 0.08);
    --green: #2c6b45; /* Olive/Emerald green */
    --green-dim: rgba(44, 107, 69, 0.08);
    --red: #b03a2e; /* Wine red */
    --red-dim: rgba(176, 58, 46, 0.08);
    --glass-blur: blur(0px);
}

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

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    background: radial-gradient(ellipse at bottom right, #f2eae1, var(--bg));
    color: var(--text);
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    line-height: 1.6;
}

/* SIDEBAR STYLE */
aside.app-sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.logo-icon {
    font-size: 1.8rem;
}

.logo-text h1 {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    background: linear-gradient(135deg, var(--accent), #e08e60);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text p {
    font-size: 0.65rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.menu-title {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 1px;
    margin: 0.75rem 0 0.35rem 0.25rem;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item:hover, .nav-item.active {
    background: rgba(176, 92, 46, 0.03);
    color: var(--text);
    border-color: var(--border);
}

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(176, 92, 46, 0.2);
}

/* MAIN APP CONTENT */
main.app-main {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.top-bar {
    background: rgba(250, 247, 242, 0.8);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.breadcrumb {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.quick-links {
    display: flex;
    gap: 0.5rem;
}

.btn-link {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.5);
    transition: all 0.25s;
    font-weight: 600;
}

.btn-link:hover {
    color: var(--text);
    border-color: var(--border-bright);
    background: rgba(176, 92, 46, 0.04);
}

.btn-link.highlight {
    color: var(--accent);
    border-color: rgba(176, 92, 46, 0.3);
    background: var(--accent-dim);
}

.btn-link.highlight:hover {
    background: rgba(176, 92, 46, 0.15);
    border-color: rgba(176, 92, 46, 0.5);
}

.content-area {
    padding: 2rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
}

/* Glass Cards */
.glass-card {
    background: var(--surface);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(44, 29, 17, 0.03);
    margin-bottom: 1.5rem;
    transition: border-color 0.25s ease;
}

.glass-card:hover {
    border-color: var(--border-bright);
}

.glass-card h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.intro-title h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.intro-title p {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    text-align: justify;
}

/* Data Tables */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    background: #ffffff;
    margin-top: 0.5rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    text-align: left;
}

.data-table th {
    background: rgba(176, 92, 46, 0.02);
    color: var(--text-dim);
    padding: 0.75rem 1rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(176, 92, 46, 0.01);
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* Flow list & badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-indigo {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(176, 92, 46, 0.2);
}

.badge-gold {
    background: var(--gold-dim);
    color: var(--gold);
    border-color: rgba(179, 134, 0, 0.2);
}

.badge-green {
    background: var(--green-dim);
    color: var(--green);
    border-color: rgba(44, 107, 69, 0.2);
}

.badge-red {
    background: var(--red-dim);
    color: var(--red);
    border-color: rgba(176, 58, 46, 0.2);
}

.happy-path-box {
    background: rgba(176, 92, 46, 0.01);
    border-left: 3px solid var(--accent);
    padding: 1.25rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin-bottom: 1.5rem;
}

.happy-path-box h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.happy-path-flow {
    display: flex;
    flex-direction: column;
    position: relative;
    border-left: 2px solid var(--border-bright);
    gap: 1rem;
    margin-left: 1.25rem;
    padding-left: 1.75rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-top: 1rem;
}

.flow-node {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 0.65rem 0.85rem;
    border-radius: 0.35rem;
    color: var(--text);
    box-shadow: 0 2px 4px rgba(44, 29, 17, 0.02);
    position: relative;
    width: fit-content;
}

.flow-node::before {
    content: '';
    position: absolute;
    left: -33px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(176, 92, 46, 0.15);
}

.flow-arrow {
    display: none;
}

/* Modules accordion & list */
.module-group {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 0;
}

.module-group:last-child {
    border-bottom: none;
}

.module-header {
    font-family: 'Playfair Display', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.module-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 0.85rem;
    text-align: justify;
}

.rules-list {
    list-style: none;
    padding-left: 0;
}

.rules-list li {
    font-size: 0.82rem;
    color: var(--text);
    margin-bottom: 0.45rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.rules-list li::before {
    content: '☕';
    font-size: 0.75rem;
    margin-top: 2px;
}

section {
    scroll-margin-top: 80px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        grid-template-columns: 1fr;
    }

    aside.app-sidebar {
        height: auto;
        position: sticky;
        top: 0;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 0.75rem 1rem;
        z-index: 11; /* higher than top-bar */
    }

    .sidebar-header {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        gap: 0.5rem;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar-nav::-webkit-scrollbar {
        height: 3px;
    }

    .sidebar-nav::-webkit-scrollbar-thumb {
        background-color: var(--border-bright);
        border-radius: 99px;
    }

    .nav-item {
        display: inline-flex;
        flex-shrink: 0;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .menu-title {
        display: none;
    }

    .top-bar {
        position: relative;
        top: auto;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
        backdrop-filter: none;
        background: var(--bg);
    }

    .quick-links {
        flex-wrap: wrap;
        gap: 0.35rem;
        width: 100%;
    }

    .btn-link {
        flex-grow: 1;
        text-align: center;
        padding: 0.5rem 0.4rem;
        font-size: 0.7rem;
    }

    .content-area {
        padding: 1rem;
    }

    .intro-title h1 {
        font-size: 1.8rem;
    }

    .glass-card {
        padding: 1.25rem 1rem;
    }

    .glass-card h2 {
        font-size: 1.15rem;
    }

    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px; /* Force minimum width to trigger scroll on narrow screen */
    }
}
