/* ============================================================
   CV SARANA MULTI SUKSES - MODERN MINIMALIST SAAS THEME
   Inspired by High-End Modern Dashboard Analytics UI
   ============================================================ */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Brand Accent Colors */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --primary-text: #1e40af;

    --sidebar-bg: #ffffff;
    --sidebar-border: #e2e8f0;
    --sidebar-active-bg: #eef2ff;
    --sidebar-active-text: #3730a3;
    --sidebar-active-icon: #4f46e5;
    
    /* Multi-segment Funnel & Chart Colors (matches reference image) */
    --chart-coral: #ef4444;
    --chart-amber: #f59e0b;
    --chart-navy: #1e293b;
    --chart-emerald: #10b981;
    --chart-purple: #8b5cf6;
    --chart-teal: #0d9488;
    --chart-crimson: #be123c;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-subtle: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-dropdown: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

body {
    font-family: var(--font);
    background-color: var(--bg-page);
    color: var(--text-main);
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover {
    color: var(--primary-hover);
}

/* APP SHELL: SIDEBAR + MAIN CONTENT */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.app-sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: width 0.2s ease;
}

.sidebar-header {
    height: 64px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-light);
}

.sidebar-brand-icon {
    width: 32px;
    height: 32px;
    background: #000000;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: -0.5px;
}

.sidebar-brand-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-item:hover {
    background-color: var(--bg-page);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    color: var(--text-light);
    flex-shrink: 0;
    transition: color 0.15s ease;
}

.nav-item.active svg {
    color: var(--sidebar-active-icon);
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* MAIN CONTENT WRAPPER */
.app-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* TOP HEADER */
.app-header {
    height: 52px;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.header-title-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-main-heading {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* CREATE DROPDOWN BUTTON (Matches Blue "Create ▾" from Image) */
.create-dropdown {
    position: relative;
}

.btn-create-primary {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
    transition: background 0.15s ease;
}
.btn-create-primary:hover {
    background: #1d4ed8;
}

.create-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    min-width: 220px;
    padding: 6px;
    z-index: 100;
}

.create-dropdown.open .create-dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease;
}
.dropdown-item:hover {
    background: var(--bg-page);
    color: var(--primary);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}
.user-avatar-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

/* CONTENT BODY */
.app-content {
    padding: 16px 22px;
    flex: 1;
}

/* SUB TABS & PERIOD BAR (From Image Header) */
.subtabs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    padding-bottom: 0;
}

.subtabs-group {
    display: flex;
    gap: 24px;
}

.subtab-link {
    padding-bottom: 10px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.15s ease;
    cursor: pointer;
}

.subtab-link:hover {
    color: var(--text-main);
}

.subtab-link.active {
    color: #4338ca;
    border-bottom-color: #4338ca;
}

.period-select-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}
.period-select-badge:hover {
    background: #ffffff;
    color: var(--text-main);
}

/* CARDS & GRID LAYOUTS */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-subtle);
    padding: 18px 20px;
    margin-bottom: 16px;
}

.dashboard-row-2col {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .dashboard-row-2col {
        grid-template-columns: 1fr;
    }
}

.card-title-sm {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
}

/* FUNNEL COUNT CARD */
.funnel-metric-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 18px;
}
.funnel-huge-number {
    font-size: 38px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
    letter-spacing: -1px;
}
.funnel-metric-label {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* MULTI-SEGMENT STACKED BAR */
.stacked-progress-bar {
    height: 8px;
    border-radius: var(--radius-full);
    display: flex;
    overflow: hidden;
    margin-bottom: 24px;
    background: #f1f5f9;
}
.stacked-segment {
    height: 100%;
    transition: width 0.3s ease;
}
.seg-coral   { background-color: var(--chart-coral); }
.seg-amber   { background-color: var(--chart-amber); }
.seg-navy    { background-color: var(--chart-navy); }
.seg-emerald { background-color: var(--chart-emerald); }
.seg-purple  { background-color: var(--chart-purple); }

/* FUNNEL BREAKDOWN LIST */
.funnel-table {
    width: 100%;
    border-collapse: collapse;
}
.funnel-table tr {
    border-bottom: 1px solid var(--border-light);
}
.funnel-table tr:last-child {
    border-bottom: none;
}
.funnel-table td {
    padding: 10px 4px;
    font-size: 13px;
}
.funnel-stage-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--text-main);
}
.stage-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.funnel-count-cell {
    color: var(--text-muted);
    text-align: right;
    font-weight: 600;
}
.funnel-amount-cell {
    font-weight: 700;
    color: var(--text-main);
    text-align: right;
}
.funnel-time-cell {
    color: var(--text-light);
    text-align: right;
    font-size: 12px;
}

/* SOURCES CARD (DONUT CHART + PILL BUTTONS) */
.sources-card-body {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
}

@media (max-width: 640px) {
    .sources-card-body {
        grid-template-columns: 1fr;
    }
}

.donut-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.sources-legend-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sources-legend-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
}

.legend-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.legend-square {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}
.legend-name {
    font-weight: 500;
    color: var(--text-main);
}
.legend-values {
    display: flex;
    align-items: center;
    gap: 14px;
}
.legend-amount {
    font-weight: 700;
    color: var(--text-main);
}
.legend-percent {
    color: var(--text-light);
    font-size: 12px;
    min-width: 32px;
    text-align: right;
}

.sources-filter-pills {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.filter-pill {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 5px 12px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}
.filter-pill:hover {
    border-color: var(--text-muted);
    color: var(--text-main);
}
.filter-pill.active {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text-main);
}

/* TRACKING SPLINE CARD */
.tracking-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tracking-metric-block {
    display: flex;
    align-items: baseline;
    gap: 24px;
}

.tracking-stat-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
}
.tracking-big-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1;
}
.tracking-sub-label {
    font-size: 13px;
    color: var(--text-muted);
}

.spline-chart-wrapper {
    width: 100%;
    height: 240px;
    position: relative;
}

/* DATA TABLES (SAAS CLEAN STYLE) */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.table th {
    background: var(--bg-page);
    color: var(--text-muted);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    border-bottom: 2px solid var(--border);
    vertical-align: middle;
}
.table th:first-child {
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
    border-left: 1px solid var(--border);
}
.table th:last-child {
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    border-right: 1px solid var(--border);
}

.table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: 13px;
    vertical-align: middle;
}

.table tbody tr:hover td {
    background-color: #fbfcfd;
}

/* MODERN BADGES */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1;
}

.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-slate  { background: #f1f5f9; color: #475569; }

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-secondary {
    background: #ffffff;
    color: var(--text-main);
    border-color: var(--border);
}
.btn-secondary:hover {
    background: var(--bg-page);
    border-color: #cbd5e1;
}

.btn-success {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}
.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}
.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

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

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

.form-control,
.vb-input {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text-main);
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.vb-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ALERTS */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* BACKWARDS COMPATIBILITY ALIASES (Ensures existing templates render smoothly) */
.vb-window {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-subtle);
    overflow: hidden;
    margin-bottom: 24px;
}
.vb-titlebar {
    background: #ffffff;
    color: var(--text-main);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: 14px;
}
.vb-titlebar-controls { display: none; }
.vb-menubar, .vb-toolbar { display: none; }
.vb-statusbar {
    padding: 10px 20px;
    background: var(--bg-page);
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.vb-groupbox {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 18px;
    background: #ffffff;
}
.vb-groupbox-legend {
    font-weight: 700;
    font-size: 13px;
    color: var(--text-main);
    padding: 0 8px;
}
.vb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #ffffff;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
}
.vb-btn:hover {
    background: var(--bg-page);
    border-color: #cbd5e1;
}
.vb-datagrid {
    width: 100%;
    border-collapse: collapse;
}
.vb-datagrid th {
    background: var(--bg-page);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.vb-datagrid td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-main);
}
.vb-datagrid tbody tr:hover td {
    background-color: #f8fafc;
}
