/* 
 * WeZimplify Master Stylesheet
 * ----------------------------
 * Aesthetic: "Claude Warm Dark" + "WeZimplify Lime"
 * Fonts: Inter (UI), Playfair Display (Brand/Headings)
 */

:root {
    /* --- BRAND ACCENTS --- */
    --color-brand-lime: #D1F269;
    --color-brand-lime-glow: rgba(209, 242, 105, 0.4);
    --color-brand-lime-dim: rgba(209, 242, 105, 0.1);

    /* --- DARK MODE (Default - Claude Inspired) --- */
    /* Backgrounds: Warm, deep charcoal instead of cold black */
    --bg-app: #262624;
    --bg-panel: #1F1F1D;
    --bg-card: #30302E;
    --bg-glass: rgba(48, 48, 46, 0.95);

    /* Borders are softer in the warm theme */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.15);

    /* Text Colors - "Whiteish Grey" */
    --text-primary: #EDEDED;
    --text-secondary: #9A9A95;
    --text-tertiary: #6E6E6A;
    --text-on-accent: #1A1A18;

    /* Effects */
    --shadow-subtle: 0 4px 24px rgba(0, 0, 0, 0.3);
    --glow-active: 0 0 12px var(--color-brand-lime-glow);

    /* Theme Toggle Mappings */
    --border-card: var(--border-color);
    --accent: var(--color-brand-lime);
}

/* --- LIGHT MODE (Locked) --- */
.light-mode {
    --bg-app: #f0f0f0;
    --bg-panel: #ffffff;
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.95);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-highlight: rgba(0, 0, 0, 0.15);

    --text-primary: #1A1A18;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --text-on-accent: #1A1A18;

    --shadow-subtle: 0 4px 24px rgba(0, 0, 0, 0.06);

    /* Theme Toggle Mappings */
    --accent: #a65d3f;
    /* User/Tab default for light mode */
}

/* --- RESET & BASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    transition: background-color 0.3s ease;
    -webkit-font-smoothing: antialiased;
}

/* --- DARK SCROLLBAR STYLING --- */
/* WebKit browsers (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-panel);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 5px;
    border: 2px solid var(--bg-panel);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) var(--bg-panel);
}

/* Light mode scrollbar */
.light-mode ::-webkit-scrollbar-track {
    background: #e0e0e0;
}

.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid #e0e0e0;
}

.light-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.35);
}

.light-mode * {
    scrollbar-color: rgba(0, 0, 0, 0.2) #e0e0e0;
}

/* Brand wordmark font (Faustina) — same typeface as the WeZimplify logo. Self-hosted variable font. */
@font-face {
    font-family: 'Faustina';
    src: url('../fonts/Faustina-VariableFont_wght.ttf') format('truetype-variations'),
         url('../fonts/Faustina-VariableFont_wght.ttf') format('truetype');
    font-weight: 300 800;
    font-style: normal;
    font-display: swap;
}

/* --- TYPOGRAPHY --- */
h1,
h2,
h3,
.kpi-value {
    font-family: 'Playfair Display', serif;
}

/* --- LAYOUT GRID (Stellarsync Style) --- */
.app-shell {
    display: grid;
    grid-template-columns: 205px 1fr;
    height: 100vh;
}

.main-content {
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    height: 100vh;
    padding: 0;
    position: relative;
}

/* Scrollable Inner Area */
.content-scroll {
    overflow-y: auto;
    padding: 2rem 2.5rem;
    height: 100%;
}

/* --- COMPONENTS --- */

/* Sidebar */
.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    z-index: 20;
    height: 100vh;
    overflow-y: auto;
}

/* Brand lockup: WeZimplify wordmark logo + CRM sub-label */
.brand {
    display: flex;
    flex-direction: column;
    align-items: flex-end;       /* CRM aligns to the wordmark's right edge */
    gap: 0.3rem;
    width: 138px;
    margin: 0 auto;              /* center the lockup in the sidebar */
}

.brand-logo {
    display: block;
    width: 138px;
    height: auto;
}

/* Show the correct wordmark per theme (white on dark, navy on light) */
.brand-logo--light {
    display: none;
}

.light-mode .brand-logo--dark {
    display: none;
}

.light-mode .brand-logo--light {
    display: block;
}

.brand-crm {
    font-family: 'Faustina', 'Playfair Display', serif;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.42em;
    margin-right: -0.42em;       /* trim trailing tracking so CRM sits flush right */
    line-height: 1;
    text-transform: uppercase;
    color: var(--color-brand-lime);
}

.light-mode .brand-crm {
    color: #17283D;             /* matches the light-theme logo navy */
}

/* Search Input */
.search-wrapper {
    position: relative;
    margin-bottom: 0.5rem;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.75rem 0.6rem 2.2rem;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    width: 14px;
    height: 14px;
}

/* Navigation */
.nav-group-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 400;
    transition: all 0.2s;
    border: 1px solid transparent;
    cursor: pointer;
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    background: var(--bg-card);
    /* Specific to Stellarsync style */
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 500;
}

/* Active nav item indicator - could add a dot here in future */

.nav-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.nav-item.active svg {
    opacity: 1;
    color: var(--color-brand-lime);
}

/* --- HEADER AREA --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 2rem 0;
}

.breadcrumbs {
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-active {
    color: var(--text-primary);
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

/* --- WIDGET GRID SYSTEM --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto 1fr;
    gap: 1.5rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    /* Smooth rounded corners like Stellar */
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.card-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Playfair Display', serif;
    margin-bottom: 0.5rem;
}

.card-trend {
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
}

/* FIX: Lime-on-lime visibility - use DARK text on lime backgrounds */
.trend-up {
    color: #1A1A18;
    /* Dark text for visibility */
    background: var(--color-brand-lime);
    font-weight: 500;
}

.trend-down {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Main Stage Widget (Span 3) */
.col-span-3 {
    grid-column: span 3;
}

.col-span-1 {
    grid-column: span 1;
}

.col-span-2 {
    grid-column: span 2;
}

.col-span-4 {
    grid-column: span 4;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-tertiary);
    font-weight: 500;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

.text-white {
    color: var(--text-primary);
    font-weight: 500;
}

/* Status Badge */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    display: inline-block;
}

.badge.success {
    background: var(--color-brand-lime-dim);
    color: var(--color-brand-lime);
    border: 1px solid rgba(209, 242, 105, 0.4);
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.5);
}

.badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge.neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* User Avatar */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-primary);
    border: 2px solid var(--bg-card);
}

.avatar-group {
    display: flex;
}

.avatar-group .avatar {
    margin-left: -8px;
}

.avatar-group .avatar:first-child {
    margin-left: 0;
}

/* --- THEME TOGGLE (User Provided) --- */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    color: var(--text-secondary);
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.theme-toggle svg.hidden {
    opacity: 0;
    transform: rotate(180deg);
    position: absolute;
}

@media (min-width: 800px) {
    .theme-toggle {
        padding: 14px 16px;
        border-radius: 8px;
    }

    .theme-toggle svg {
        width: 1.75rem;
        height: 1.75rem;
    }
}

.theme-toggle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    /* Margin for sidebar spacing */
    margin-bottom: 1rem;
}

.theme-label {
    font-size: 0.7em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.theme-label-current {
    color: var(--accent);
}

@media (min-width: 800px) {
    .theme-label {
        font-size: 0.75em;
    }
}

/* --- HEADER THEME TOGGLE (System Standard) --- */
.theme-toggle-header {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.theme-toggle-header:hover {
    border-color: var(--color-brand-lime);
    color: var(--color-brand-lime);
    background: rgba(209, 242, 105, 0.05);
}

.theme-toggle-header svg {
    width: 1rem;
    height: 1rem;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-toggle-header svg.hidden {
    opacity: 0;
    transform: rotate(180deg);
    position: absolute;
}

/* --- KPI CARD 2x2 GRID --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    height: 100%;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 130px;
}

.kpi-card .card-title {
    font-size: 0.8rem;
}

.kpi-card .card-value {
    font-size: 2rem;
    margin: 0.5rem 0;
    text-align: center;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.35rem;
}

.kpi-card .card-trend {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
}

/* Unit styling for values (t, DKK, etc.) */
.value-unit {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
}

/* --- STYLED SELECT DROPDOWNS --- */
.select-filter {
    padding: 0.6rem 2.5rem 0.6rem 0.75rem;
    appearance: none;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%239A9A95" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
}

.select-filter:focus {
    outline: none;
    border-color: var(--color-brand-lime);
}

.select-filter option {
    background: var(--bg-card);
    color: var(--text-primary);
}

