/* ================================================================
   Glarus AI Co-owner Dashboard — Styles
   ================================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --sidebar-bg: #1a1a2e;
    --sidebar-hover: #16213e;
    --sidebar-active: #0f3460;
    --sidebar-text: #a0a0c0;
    --sidebar-text-active: #ffffff;
    --sidebar-width: 260px;

    --content-bg: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --accent: #4361ee;
    --accent-hover: #3651d4;
    --success: #2ec4b6;
    --warning: #ff9f1c;
    --danger: #e71d36;

    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --radius: 8px;
    --radius-sm: 4px;

    --topbar-height: 60px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font);
    color: var(--text-primary);
    background: var(--content-bg);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* --- Layout --- */
.layout {
    display: flex;
    min-height: 100vh;
}


/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.sidebar-brand span {
    display: block;
    font-size: 0.75rem;
    color: var(--sidebar-text);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--sidebar-text);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: var(--sidebar-text-active);
    border-left-color: var(--accent);
}

.sidebar-nav .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 16px 24px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(160, 160, 192, 0.6);
    font-weight: 600;
}


/* --- Main content area --- */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


/* --- Top bar --- */
.topbar {
    height: var(--topbar-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.topbar-logout {
    font-size: 0.85rem;
    color: var(--danger);
    font-weight: 500;
}

.topbar-logout:hover {
    text-decoration: underline;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px 8px;
}


/* --- Content area --- */
.content {
    flex: 1;
    padding: 28px 32px;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
}


/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card + .card {
    margin-top: 16px;
}


/* --- Stats grid (dashboard) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 4px;
    line-height: 1.2;
}

.stat-card .stat-detail {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.stat-card.accent {
    border-left: 4px solid var(--accent);
}

.stat-card.success {
    border-left: 4px solid var(--success);
}

.stat-card.warning {
    border-left: 4px solid var(--warning);
}

.stat-card.danger {
    border-left: 4px solid var(--danger);
}


/* --- Quick actions --- */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
}


/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    font-family: var(--font);
    text-decoration: none;
    line-height: 1.3;
}

.btn:hover {
    text-decoration: none;
}

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

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

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

.btn-success:hover {
    background: #26a89c;
}

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

.btn-warning:hover {
    background: #e58c18;
}

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

.btn-danger:hover {
    background: #cc1830;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: #ffffff;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 6px 10px;
}


/* --- Badges --- */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-accent {
    background: rgba(67, 97, 238, 0.12);
    color: var(--accent);
}

.badge-success {
    background: rgba(46, 196, 182, 0.12);
    color: #1a9a8e;
}

.badge-warning {
    background: rgba(255, 159, 28, 0.12);
    color: #c77a14;
}

.badge-danger {
    background: rgba(231, 29, 54, 0.12);
    color: var(--danger);
}

.badge-muted {
    background: rgba(107, 114, 128, 0.12);
    color: var(--text-secondary);
}


/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
}

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

thead {
    background: var(--content-bg);
}

th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: rgba(67, 97, 238, 0.03);
}


/* --- Forms --- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9rem;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}


/* --- Alert / Error --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 16px;
}

.alert-danger {
    background: rgba(231, 29, 54, 0.08);
    color: var(--danger);
    border: 1px solid rgba(231, 29, 54, 0.2);
}

.alert-success {
    background: rgba(46, 196, 182, 0.08);
    color: #1a9a8e;
    border: 1px solid rgba(46, 196, 182, 0.2);
}

.alert-info {
    background: rgba(67, 97, 238, 0.08);
    color: var(--accent);
    border: 1px solid rgba(67, 97, 238, 0.2);
}


/* --- Preformatted text --- */
.pre-block {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 16px 20px;
    border-radius: var(--radius);
    font-family: "JetBrains Mono", "Fira Code", "Consolas", monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-word;
}


/* --- Transcript block --- */
.transcript {
    background: var(--content-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    font-size: 0.88rem;
    line-height: 1.7;
    white-space: pre-wrap;
}


/* --- Detail sections --- */
.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 8px 16px;
    font-size: 0.9rem;
}

.detail-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.detail-value {
    color: var(--text-primary);
}


/* --- Inline form (approve/reject row) --- */
.inline-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}


/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.95rem;
}


/* --- Login page --- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--sidebar-bg);
}

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.login-card .login-sub {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 28px;
}

.login-card .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
}


/* --- Content block (markdown-like) --- */
.content-block {
    line-height: 1.7;
    font-size: 0.92rem;
}

.content-block h1 { font-size: 1.3rem; margin: 16px 0 8px; }
.content-block h2 { font-size: 1.1rem; margin: 14px 0 6px; }
.content-block ul, .content-block ol { padding-left: 24px; margin: 8px 0; }
.content-block li { margin-bottom: 4px; }
.content-block p { margin-bottom: 8px; }


/* --- Graph bar chart (pure CSS) --- */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    width: 140px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
}

.bar-track {
    flex: 1;
    height: 24px;
    background: var(--content-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
    min-width: 2px;
}

.bar-count {
    width: 50px;
    font-size: 0.82rem;
    color: var(--text-primary);
    font-weight: 600;
}


/* --- Priority colors for roadmap --- */
.priority-critical { color: var(--danger); }
.priority-high { color: #e07a1c; }
.priority-medium { color: var(--warning); }
.priority-low { color: var(--success); }


/* --- Back link --- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.back-link:hover {
    color: var(--accent);
}


/* --- Responsive --- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        transform: translateX(-260px);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .hamburger {
        display: block;
    }

    .main {
        margin-left: 0;
    }

    .content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }

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

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

    .detail-label {
        margin-top: 8px;
    }
}

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

    .actions-row {
        flex-direction: column;
    }

    .actions-row .btn {
        width: 100%;
        justify-content: center;
    }
}


/* --- Sidebar overlay on mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}
