/* Ultra Modern CRM Design System */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    /* Branding - Royal Blue & Vibrant Accents */
    --primary: #2563eb;
    /* Royal Blue */
    --primary-hover: #1d4ed8;
    /* Darker Blue */
    --primary-soft: #eff6ff;
    /* Light Blue Background */
    --primary-ring: rgba(37, 99, 235, 0.2);

    /* Secondary / Accents */
    --accent: #8b5cf6;
    /* Violet */
    --accent-hover: #7c3aed;

    /* Semantic States */
    --success: #10b981;
    /* Emerald */
    --success-bg: #ecfdf5;
    --success-text: #065f46;

    --warning: #f59e0b;
    /* Amber */
    --warning-bg: #fffbeb;
    --warning-text: #92400e;

    --danger: #ef4444;
    /* Red */
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;

    --info: #3b82f6;
    /* Blue */
    --info-bg: #eff6ff;
    --info-text: #1e40af;

    /* Neutral Scale (Slate) */
    --bg-body: #f1f5f9;
    /* Slate 100 */
    --bg-surface: #ffffff;
    --bg-alt: #f8fafc;
    /* Slate 50 */

    --text-main: #0f172a;
    /* Slate 900 */
    --text-secondary: #475569;
    /* Slate 600 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --text-light: #cbd5e1;
    /* Slate 300 */

    --border: #e2e8f0;
    /* Slate 200 */
    --border-hover: #cbd5e1;
    /* Slate 300 */

    /* Layout Dimensions */
    --sidebar-width: 280px;
    --header-height: 72px;

    /* Component Properties */
    --radius-sm: 0.375rem;
    /* 6px */
    --radius-md: 0.625rem;
    /* 10px */
    --radius-lg: 1rem;
    /* 16px */
    --radius-full: 9999px;

    /* Shadows (Smooth & Layered) */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -1px rgba(15, 23, 42, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -2px rgba(15, 23, 42, 0.02);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.05), 0 10px 10px -5px rgba(15, 23, 42, 0.02);
    --shadow-primary: 0 10px 15px -3px rgba(37, 99, 235, 0.25), 0 4px 6px -2px rgba(37, 99, 235, 0.1);
}

/* Global Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Instrument Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

ul {
    list-style: none;
}

/* Layout Grid */
.app-container {
    display: flex;
    min-height: 100vh;
    background: var(--bg-body);
}

/* Modern Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    /* Slate 900 */
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    padding-bottom: 2rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    font-family: 'Instrument Sans', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
}

.sidebar-brand i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(37, 99, 235, 0.5));
}

.sidebar-nav {
    padding: 1.5rem 1rem;
}

.nav-section-title {
    padding: 0 1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--text-muted);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    color: #94a3b8;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-link i {
    font-size: 1.1em;
    transition: transform 0.2s ease;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link:hover i {
    transform: translateX(2px);
}

.nav-link.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    font-weight: 600;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    max-width: 1600px;
    margin-right: auto;
}

/* Top Navbar */
.top-navbar {
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    margin: -2rem -2rem 2rem -2rem;
    /* Extend to edges */
    position: sticky;
    top: 0;
    z-index: 90;
    box-shadow: var(--shadow-sm);
}

/* Cards */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.card-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5,
.card-header h6 {
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    gap: 0.5rem;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-primary);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    /* Emerald 600 */
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-white,
.btn-light {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    box-shadow: var(--shadow-xs);
}

.btn-white:hover,
.btn-light:hover {
    background: var(--bg-alt);
    color: var(--text-main);
    border-color: var(--border-hover);
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8rem;
}

/* Forms */
.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-main);
    transition: all 0.2s ease;
}

.form-control:hover,
.form-select:hover {
    border-color: var(--border-hover);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ring);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25em 0.8em;
    font-size: 0.75em;
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.3;
}

.bg-success {
    background: var(--success-bg) !important;
    color: var(--success-text) !important;
}

.bg-warning {
    background: var(--warning-bg) !important;
    color: var(--warning-text) !important;
}

.bg-danger {
    background: var(--danger-bg) !important;
    color: var(--danger-text) !important;
}

.bg-info {
    background: var(--info-bg) !important;
    color: var(--info-text) !important;
}

.bg-primary {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
}

.bg-secondary {
    background: #f1f5f9 !important;
    color: #64748b !important;
}

/* Alerts */
.alert {
    border: 0;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table th {
    background: var(--bg-alt);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 0.875rem 1.5rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: 0;
}

.table-hover tr:hover td {
    background: var(--bg-alt);
}

/* Custom Utilities */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

.rounded-circle {
    border-radius: 50% !important;
}

/* Icon Box */
.icon-box {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

/* Timeline Components */
.workflow-timeline .position-absolute.border-start {
    border-left: 2px solid var(--border) !important;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}