/* ==========================================================================
   ENTERPRISE CRM DESIGN SYSTEM
   Theme: Slate Dark & Pure White Glassmorphism + Indigo Accents
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.08);
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #1e293b;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #10b981;
    --success-bg: #ecfdf5;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glass: 0 8px 32px 0 rgba(15, 23, 42, 0.08);
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg-main); color: var(--text-main); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; transition: all 0.2s; }
a:hover { color: var(--primary-hover); text-decoration: none; }
h1, h2, h3, h4, h5 { color: var(--text-main); margin: 0 0 8px; font-weight: 700; letter-spacing: -0.02em; }
p { color: var(--text-muted); margin: 0 0 12px; }

/* Layout Shell */
.app-shell { display: flex; min-height: 100vh; transition: all 0.3s ease; margin: 0; padding: 0; }
.app-shell.shell-collapsed .sidebar { width: 64px; min-width: 64px; padding: 16px 0; }
.app-shell.shell-collapsed .sidebar .brand-text { display: none; }
.app-shell.shell-collapsed .sidebar .brand { padding: 0 0 16px; justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
.app-shell.shell-collapsed .sidebar-nav { padding: 0 8px; }
.app-shell.shell-collapsed .nav-link .nav-text { display: none; }
.app-shell.shell-collapsed .nav-link { justify-content: center; padding: 10px 8px; }
.app-shell.shell-collapsed .nav-link i { margin: 0; }
.app-shell.shell-collapsed .nav-link i svg { width: 20px; height: 20px; }
.app-shell.shell-collapsed .section-toggle { justify-content: center; padding: 10px 8px; }
.app-shell.shell-collapsed .section-toggle .section-text { display: none; }
.app-shell.shell-collapsed .section-chevron { display: none; }
.app-shell.shell-collapsed .section-body { display: none !important; }
.app-shell.shell-collapsed .nav-section { border-top: none; }

.sidebar { width: 260px; min-width: 260px; background: var(--sidebar-bg); color: #94a3b8; flex-shrink: 0; display: flex; flex-direction: column; padding: 24px 0; box-shadow: 4px 0 24px rgba(0,0,0,0.05); z-index: 20; transition: width 0.3s ease, min-width 0.3s ease, padding 0.3s ease; overflow: hidden; }
.sidebar-header { padding: 0 16px; }
.sidebar .brand { color: #fff; font-weight: 800; font-size: 18px; padding: 0 8px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); margin-bottom: 12px; display: flex; align-items: center; gap: 12px; letter-spacing: -0.03em; transition: all 0.3s ease; }
.sidebar .brand-icon { width: 32px; height: 32px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4); flex-shrink: 0; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 12px; }

/* Collapsible Nav Sections */
.nav-section { margin-bottom: 2px; border-top: 1px solid rgba(255,255,255,0.04); padding-top: 6px; margin-top: 4px; }
.nav-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.section-toggle { width: 100%; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin: 0; border-radius: var(--radius-md); color: #475569; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; transition: all 0.2s; font-family: var(--font); }
.section-toggle:hover { background: var(--sidebar-hover); color: #94a3b8; }
.section-toggle .section-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.section-toggle .section-icon svg { width: 15px; height: 15px; stroke-width: 2; opacity: 0.7; }
.section-toggle .section-text { flex: 1; text-align: left; }
.section-toggle .section-chevron { width: 14px; height: 14px; opacity: 0.5; transition: transform 0.2s; flex-shrink: 0; }
.section-toggle .section-chevron svg { width: 14px; height: 14px; }
.section-toggle .section-chevron.rotated { transform: rotate(-90deg); }
.section-body { overflow: hidden; max-height: 600px; transition: max-height 0.35s ease; }
.section-body.section-collapsed { max-height: 0; overflow: hidden; }

/* Nav Links */
.sidebar a.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 14px; color: #94a3b8; font-size: 13.5px; font-weight: 500; border-radius: var(--radius-md); transition: all 0.2s ease; margin-bottom: 2px; position: relative; }
.sidebar a.nav-link.nested { padding-left: 26px; font-size: 13px; }
.sidebar a.nav-link i { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sidebar a.nav-link i svg { width: 17px; height: 17px; stroke-width: 2; opacity: 0.75; transition: all 0.2s ease; }
.sidebar a.nav-link .nav-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar a.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar a.nav-link:hover i svg { opacity: 1; transform: translateX(2px); }
.sidebar a.nav-link.active { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35); }
.sidebar a.nav-link.active i svg { opacity: 1; }

/* Sidebar Toggle Button (in topbar) */
.sidebar-toggle-btn { background: none; border: 1px solid var(--border-color); border-radius: var(--radius-sm); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); transition: all 0.2s; flex-shrink: 0; }
.sidebar-toggle-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.sidebar-toggle-btn svg { width: 18px; height: 18px; }
.topbar-left { display: flex; align-items: center; gap: 14px; }

/* Tooltip for collapsed sidebar items */
.sidebar-tooltip { position: fixed; background: #1e293b; color: #fff; padding: 5px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; pointer-events: none; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.3); white-space: nowrap; animation: tooltipFadeIn 0.15s ease; }
@keyframes tooltipFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* Form Utilities */
.form-group { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text-main); }
.form-group .help { font-size: 12px; color: var(--text-muted); margin: 0; }
.form-group input, .form-group select, .form-group textarea { width: 100%; }
input.is-invalid, select.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }

/* Info Item (used in show/detail views) */
.info-item { margin-bottom: 16px; }
.info-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 4px; }
.info-value { font-size: 14px; color: var(--text-main); font-weight: 500; }

/* Alert base */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 14px 18px; border-radius: var(--radius-md); font-size: 13.5px; margin-bottom: 16px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg-main); margin: 0; padding: 0; }
.topbar { background: rgba(255,255,255,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-color); padding: 16px 32px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; align-self: flex-start; }
.topbar .page-title { font-size: 18px; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.topbar .user { display: flex; align-items: center; gap: 14px; }
.topbar img.avatar, .topbar .avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 2px 8px rgba(0,0,0,0.1); border: 2px solid #fff; }
.topbar .user-info { display: flex; flex-direction: column; }
.topbar .user-name { font-weight: 600; font-size: 13.5px; color: var(--text-main); }
.topbar .user-role { font-size: 11px; color: var(--text-muted); }
.content { padding: 24px; }
/* Buttons & Inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; font-size: 13.5px; font-weight: 600; border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease; background: var(--primary); color: #fff !important; box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2); }
.btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); text-decoration: none; }
.btn-secondary { background: #fff; color: var(--text-main) !important; border-color: var(--border-color); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-ghost { background: transparent; color: var(--text-muted) !important; box-shadow: none; }
.btn-ghost:hover { background: #f1f5f9; color: var(--text-main) !important; }
.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-main) !important; box-shadow: none; }
.btn-outline:hover { background: var(--bg-main); border-color: #cbd5e1; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea { width: 100%; padding: 9px 14px; font-family: var(--font); font-size: 13.5px; background: #fff; border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-main); transition: all 0.2s ease; box-shadow: var(--shadow-sm); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

/* Cards & Grid */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 24px; transition: all 0.2s ease; }
.card:hover { box-shadow: var(--shadow-md); }
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1024px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* KPI Cards */
.kpi { position: relative; overflow: hidden; padding: 22px 24px; display: flex; flex-direction: column; justify-content: space-between; }
.kpi::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, var(--primary), #60a5fa); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.kpi .label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.kpi .value { font-size: 32px; font-weight: 800; color: var(--text-main); letter-spacing: -0.03em; line-height: 1.1; }
.kpi .subtext { font-size: 12px; color: var(--text-light); margin-top: 8px; display: flex; align-items: center; gap: 4px; }

/* Data Tables */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.toolbar .filters { display: flex; gap: 12px; align-items: center; flex: 1; max-width: 600px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; text-align: left; }
th { padding: 12px 16px; background: #f8fafc; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); border-bottom: 1px solid var(--border-color); }
th:first-child { border-top-left-radius: var(--radius-md); }
th:last-child { border-top-right-radius: var(--radius-md); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border-light); color: var(--text-main); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-secondary { background: #f1f5f9; color: var(--text-muted); }
.badge-dark { background: #0f172a; color: #fff; }
.badge-mid { background: #e2e8f0; color: #334155; }
.badge-light { background: #f8fafc; color: #64748b; border: 1px solid #e2e8f0; }

/* Alert & Status */
.alert { padding: 14px 18px; border-radius: var(--radius-md); font-size: 13.5px; margin-bottom: 20px; display: flex; align-items: center; gap: 12px; }
.alert-success { background: var(--success-bg); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-bg); color: #991b1b; border: 1px solid #fecaca; }

/* Pagination */
.pagination { display: flex; gap: 4px; margin-top: 20px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.pagination ul { display: flex; gap: 4px; list-style: none; padding: 0; margin: 0; align-items: center; }
.pagination li { display: inline-flex; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--text-main); background: #fff; transition: all 0.15s ease; text-decoration: none; line-height: 1; }
.pagination a:hover { background: var(--bg-main); border-color: #cbd5e1; text-decoration: none; }
.pagination li.active span { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination li.disabled span { opacity: 0.4; cursor: not-allowed; background: #f8fafc; }

/* LANDING PAGE STYLES */
.landing-hero-wrap { position: relative; background: #090d16; color: #fff; overflow: hidden; padding: 64px 24px 140px; }
#three-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.landing-hero-content { position: relative; z-index: 2; max-width: 900px; margin: 0 auto; text-align: center; }
.landing-hero-content h1 { font-size: 52px; font-weight: 800; line-height: 1.15; color: #fff; margin-bottom: 20px; letter-spacing: -0.04em; background: linear-gradient(135deg, #fff 40%, #93c5fd 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.landing-hero-content p { font-size: 19px; color: #94a3b8; max-width: 680px; margin: 0 auto 36px; line-height: 1.6; }
.glass-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; background: rgba(255,255,255,0.08); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.15); border-radius: 999px; font-size: 13px; font-weight: 600; color: #60a5fa; margin-bottom: 24px; }

/* LOGIN PAGE STYLES */
.auth-split { display: flex; min-height: 100vh; background: #0f172a; }
.auth-canvas-container { flex: 1; position: relative; background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%); overflow: hidden; display: flex; align-items: center; justify-content: center; }
#login-three-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.auth-canvas-overlay { position: relative; z-index: 2; padding: 48px; max-width: 520px; color: #fff; }
.auth-panel { width: 480px; background: #fff; display: flex; flex-direction: column; justify-content: center; padding: 60px 48px; box-shadow: -10px 0 40px rgba(0,0,0,0.1); z-index: 5; }

/* Timeline & Journey List */
.timeline-item { position: relative; padding-left: 20px; border-left: 2px solid var(--border-color); margin-bottom: 16px; }
.timeline-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }

/* Responsive */
@media (max-width: 1024px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .auth-canvas-container { display: none; }
    .auth-panel { width: 100%; max-width: 480px; margin: 0 auto; box-shadow: none; padding: 40px 24px; }
    .content { padding: 20px; }
    .topbar { padding: 16px 20px; }
    .landing-hero-content h1 { font-size: 38px; }
}

.empty-state { text-align: center; padding: 50px 20px; color: var(--text-muted); font-size: 14px; }
.help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Calendar Styles */
.calendar-day-header { background: #0f172a; color: #fff; padding: 12px 8px; text-align: center; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; }

.calendar-day { border: 1px solid var(--border-light); padding: 10px; min-height: 320px; cursor: pointer; position: relative; background: #fff; transition: all 0.2s; vertical-align: top; overflow-y: auto; scrollbar-width: thin; }
.calendar-day:hover { background: var(--primary-light); }
.calendar-day.empty { background: #f8fafc; cursor: default; border-color: #f1f5f9; }
.calendar-day.past { background: #f8fafc; opacity: 0.6; }
.calendar-day.today { background: #dbeafe; border-color: var(--primary); border-width: 2px; }

.day-number { font-weight: 600; font-size: 14px; margin-bottom: 8px; color: var(--text-main); display: inline-block; margin-top: 2px; }

.calendar-count { position: absolute; top: 8px; right: 8px; background: #10b981; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 10px; min-width: 20px; text-align: center; z-index: 10; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

.plan-badge { background: #dbeafe; border: 2px solid #3b82f6; border-radius: 6px; padding: 6px 8px; margin: 4px 0; font-size: 11px; line-height: 1.3; color: var(--text-main); box-shadow: 0 1px 3px rgba(0,0,0,0.1); min-height: 40px; position: relative; }
.plan-badge-name { font-weight: 700; font-size: 12px; color: var(--text-main); line-height: 1.2; margin-bottom: 2px; }
.plan-badge-address { font-size: 10px; color: var(--text-muted); line-height: 1.1; }

.plan-delete-btn {
    position: absolute;
    top: 2px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: all 0.2s;
    z-index: 5;
}

.plan-delete-btn:hover {
    opacity: 1;
    background: #ef4444;
    transform: scale(1.1);
}

.plan-badge:hover .plan-delete-btn {
    opacity: 1;
}
@media (max-width: 1024px) {
    .calendar-day { min-height: 220px; }
    .day-number { font-size: 12px; }
    .plan-badge { font-size: 10px; padding: 4px 6px; margin: 3px 0; }
    .plan-badge-name { font-size: 10px; }
    .plan-badge-address { font-size: 9px; }
    .plan-delete-btn {
        width: 16px;
        height: 16px;
        font-size: 10px;
        top: 1px;
        right: 3px;
    }
}
