@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Theme Constants (https://3cenglify.com Inspired) --- */
:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --color-darkblue: #0f1e36;
    --color-royal: #1e40af;
    --color-royalblue-light: #3b82f6;
    --color-skyblue: #0ea5e9;
    --color-softgray: #e2e8f0;
    --color-border: #cbd5e1;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    
    --font-sans: 'Inter', system-ui, sans-serif;
    --font-display: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-premium: 0 20px 25px -5px rgba(15, 23, 42, 0.03), 0 8px 10px -6px rgba(15, 23, 42, 0.03);
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    overflow-x: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- Font Styling --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
}

code, pre, .mono-text {
    font-family: var(--font-mono);
}

/* --- Layout --- */
#crm-wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
#crm-sidebar {
    width: 280px;
    background-color: var(--color-darkblue);
    color: #f1f5f9;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 50;
    position: relative;
}

#crm-sidebar.collapsed {
    width: 80px;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    white-space: nowrap;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: radial-gradient(circle, var(--color-skyblue) 0%, var(--color-royal) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.2rem;
    color: #ffffff;
}

.brand-text {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    font-family: var(--font-display);
}

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

/* Custom scrollbar for sidebar */
.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.925rem;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-item.active {
    background-color: var(--color-royal);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.3);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --- Main Layout Viewport --- */
#crm-viewport {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* --- Header / Top Bar --- */
#crm-header {
    height: 72px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--color-softgray);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 40;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-sidebar-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.toggle-sidebar-btn:hover {
    background-color: var(--color-softgray);
    color: var(--text-primary);
}

.global-search-container {
    position: relative;
    width: 360px;
}

.global-search-input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background-color: #f1f5f9;
    font-size: 0.875rem;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.global-search-input:focus {
    outline: none;
    border-color: var(--color-royal);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.search-icon-fixed {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.indian-clock {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    background-color: rgba(30, 64, 175, 0.08);
    color: var(--color-royal);
    padding: 6px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(30, 64, 175, 0.12);
}

.user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.avatar-initials {
    width: 38px;
    height: 38px;
    background-color: var(--color-royal);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-display);
    font-size: 0.95rem;
}

/* --- Content Container --- */
#crm-main-content {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
}

/* --- Cards Grid & Stats Cards --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.crm-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-premium);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: transform 0.2s, box-shadow 0.2s;
}

.crm-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -5px rgba(15, 23, 42, 0.05), 0 8px 8px -6px rgba(15, 23, 42, 0.05);
}

.stat-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-info h3 {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-info p {
    font-size: 1.85rem;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-primary);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon.blue { background-color: rgba(30, 64, 175, 0.1); color: var(--color-royal); }
.stat-icon.sky { background-color: rgba(14, 165, 233, 0.1); color: var(--color-skyblue); }
.stat-icon.emerald { background-color: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.stat-icon.amber { background-color: rgba(245, 158, 11, 0.1); color: var(--color-warning); }

/* --- Action Panels & Buttons --- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.btn-primary {
    background-color: var(--color-royal);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.2);
}

.btn-primary:hover {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.25);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-primary);
    border: 1px solid var(--color-border);
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: var(--color-softgray);
}

/* --- Tables & Lists --- */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--color-softgray);
    background-color: #ffffff;
}

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

.crm-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-softgray);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.crm-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--color-softgray);
    color: var(--text-primary);
}

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

.crm-table tbody tr:hover {
    background-color: #f8fafc;
}

/* --- Badges & Status Indication --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge.inquiry { background-color: #f1f5f9; color: #475569; }
.status-badge.interested { background-color: rgba(14, 165, 233, 0.15); color: #0369a1; }
.status-badge.registered { background-color: rgba(245, 158, 11, 0.15); color: #b45309; }
.status-badge.admitted, .status-badge.active, .status-badge.running { background-color: rgba(16, 185, 129, 0.15); color: #047857; }
.status-badge.defaulter, .status-badge.failed { background-color: rgba(239, 68, 68, 0.15); color: #b91c1c; }
.status-badge.completed, .status-badge.passed { background-color: rgba(139, 92, 246, 0.15); color: #6d28d9; }

/* --- Tab Controls --- */
.tabs-navigation {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--color-softgray);
    margin-bottom: 24px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--color-royal);
    border-bottom-color: var(--color-royal);
    font-weight: 600;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* --- Form Fields & Inputs --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group input, .form-group select, .form-group textarea {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-sans);
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-royal);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

/* --- Quick Actions Grid --- */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.quick-action-card {
    background-color: #f8fafc;
    border: 1px solid var(--color-softgray);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action-card:hover {
    background-color: rgba(30, 64, 175, 0.04);
    border-color: rgba(30, 64, 175, 0.2);
    transform: translateY(-2px);
}

.quick-action-card svg {
    margin-bottom: 8px;
    color: var(--color-royal);
}

.quick-action-card p {
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- Document Grid --- */
.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

.doc-card {
    border: 1px solid var(--color-softgray);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    position: relative;
    background-color: #f8fafc;
}

.doc-card-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

/* --- Time Line Activity --- */
.timeline-container {
    position: relative;
    padding-left: 32px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 8px;
    bottom: 8px;
    width: 2px;
    background-color: var(--color-softgray);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-royal);
    border: 2px solid #ffffff;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

.timeline-time {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.timeline-title {
    font-weight: 600;
    font-size: 0.875rem;
}

.timeline-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-premium);
}
@media (max-width: 1024px) {
    #crm-sidebar {
        position: absolute;
        height: 100vh;
        left: -280px;
    }
    #crm-sidebar.active {
        left: 0;
    }
}

@media (max-width: 768px) {
    #crm-header {
        padding: 0 16px;
    }
    #crm-main-content {
        padding: 16px;
    }
    .global-search-container {
        width: 100%;
    }
}
