/* ==========================================================================
   INVOSOFT CRM ENTERPRISE SAAS DESIGN SYSTEM
   Visual Identity & Component Primitives
   ========================================================================== */

:root {
    /* Exact Color Tokens from Provided Design System */
    --inv-primary: #9DFF00;            /* Electric Lime Green */
    --inv-primary-dark: #385208;       /* Primary Dark Olive Green */
    --inv-primary-hover: #8ce600;
    --inv-primary-glow: rgba(157, 255, 0, 0.35);

    --inv-secondary: #00275E;          /* Deep Navy Blue */
    --inv-secondary-dark: #00183B;
    --inv-secondary-light: #1A4685;
    --inv-secondary-glow: rgba(0, 39, 94, 0.25);

    --inv-tertiary: #F4F4F4;           /* Light Soft Gray */
    --inv-neutral: #6F767E;            /* Muted Slate Gray */
    --inv-neutral-dark: #1A1D1F;       /* Charcoal Text/Surface */

    /* Surface & Canvas Colors */
    --inv-bg-canvas: #EEF3FA;
    --inv-bg-surface: #FFFFFF;
    --inv-bg-card: #FFFFFF;
    --inv-bg-card-hover: #F8FAFD;
    --inv-bg-input: #E6EEF9;
    --inv-bg-pill: #E4ECF7;

    --inv-border-subtle: #E0E7F2;
    --inv-border-medium: #C8D4E6;
    --inv-border-accent: rgba(157, 255, 0, 0.7);

    --inv-text-primary: #1A1D1F;
    --inv-text-secondary: #4A525D;
    --inv-text-muted: #6F767E;
    --inv-text-white: #FFFFFF;
    --inv-text-lime: #9DFF00;

    /* Legacy Backward-Compatibility Aliases */
    --de-bg-canvas: var(--inv-bg-canvas);
    --de-bg-surface: var(--inv-bg-surface);
    --de-bg-card: var(--inv-bg-card);
    --de-bg-card-hover: var(--inv-bg-card-hover);
    --de-bg-input: var(--inv-bg-input);

    --de-border-subtle: var(--inv-border-subtle);
    --de-border-medium: var(--inv-border-medium);
    --de-border-accent: var(--inv-border-accent);

    --de-text-primary: var(--inv-text-primary);
    --de-text-secondary: var(--inv-text-secondary);
    --de-text-muted: var(--inv-text-muted);
    --de-text-white: var(--inv-text-white);

    --de-accent-primary: var(--inv-primary);
    --de-accent-hover: var(--inv-primary-hover);
    --de-accent-light: var(--inv-primary);
    --de-accent-glow: var(--inv-primary-glow);

    --de-accent-secondary: var(--inv-secondary);
    --de-accent-secondary-hover: var(--inv-secondary-dark);
    --de-accent-secondary-light: var(--inv-secondary-light);
    --de-accent-secondary-glow: var(--inv-secondary-glow);

    --de-status-success: #385208;
    --de-status-success-bg: rgba(157, 255, 0, 0.2);
    --de-status-warning: #d97706;
    --de-status-warning-bg: #fef3c7;
    --de-status-danger: #C02626;
    --de-status-danger-bg: #fee2e2;
    --de-status-info: #00275E;
    --de-status-info-bg: #dbeafe;

    /* Layout Dimensions */
    --de-topbar-height: 64px;
    --de-sidebar-width: 240px;
    --de-sidebar-collapsed-width: 72px;

    /* Soft Curves from Provided Design System */
    --de-radius-sm: 8px;
    --de-radius-md: 12px;
    --de-radius-lg: 18px;
    --de-radius-pill: 24px;
    --de-shadow-card: 0 4px 12px rgba(0, 39, 94, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
    --de-shadow-dropdown: 0 12px 28px -4px rgba(0, 39, 94, 0.15);
}

/* Reset & Global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--de-bg-canvas);
    color: var(--de-text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(157, 255, 0, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 39, 94, 0.04) 0px, transparent 50%);
    background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6, .de-brand-text, .inv-heading {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 700;
}

/* Top App Bar */
.de-topbar {
    height: var(--de-topbar-height);
    background: #00275e;
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 500;
}

.de-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}

.de-brand-icon, .inv-brand-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--de-radius-md);
    background: var(--inv-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--inv-secondary);
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(157, 255, 0, 0.4);
}

.de-brand-name, .inv-brand-name {
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    color: #ffffff;
    font-weight: 800;
}

.de-brand-pill, .inv-brand-pill {
    background: rgba(157, 255, 0, 0.2);
    color: var(--inv-primary);
    border: 1px solid rgba(157, 255, 0, 0.5);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 800;
}

/* Global Search Trigger Bar */
.de-search-trigger {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--de-radius-md);
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.85rem;
    width: 340px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.de-search-trigger:hover {
    border-color: #90bd1a;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.de-kbd {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.7rem;
    margin-left: auto;
    font-family: monospace;
}

/* Topbar Action Cluster */
.de-topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Dropdown & Selectors */
.de-selector-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--de-radius-md);
    padding: 6px 14px;
    color: #ffffff;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.de-selector-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

/* Sidebar Navigation */
.de-sidebar {
    width: var(--de-sidebar-width);
    position: fixed;
    top: var(--de-topbar-height);
    bottom: 0;
    left: 0;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 400;
    transition: width 0.25s ease;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.de-sidebar::-webkit-scrollbar,
.de-sidebar *::-webkit-scrollbar {
    width: 0px !important;
    height: 0px !important;
    display: none !important;
}

.de-sidebar.collapsed {
    width: var(--de-sidebar-collapsed-width);
    padding: 24px 8px;
    overflow: visible !important;
}

.de-sidebar.collapsed .de-nav-text,
.de-sidebar.collapsed .de-nav-label {
    display: none !important;
}

.de-sidebar.collapsed .de-nav-item {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
    width: 100%;
    position: relative;
}

.de-sidebar.collapsed .de-nav-item i {
    font-size: 1.25rem;
    width: auto;
    margin: 0;
}

.de-sidebar.collapsed .de-btn {
    padding: 10px 0;
    justify-content: center;
}

/* Sidebar Collapsed Hover Name Tooltip Effect */
.de-sidebar.collapsed .de-nav-item[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: #00275E;
    color: #FFFFFF;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 39, 94, 0.28);
    z-index: 99999;
    pointer-events: none;
    opacity: 1;
}

.de-sidebar.collapsed .de-nav-item[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    left: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%);
    border-width: 5px 7px 5px 0;
    border-style: solid;
    border-color: transparent #00275E transparent transparent;
    z-index: 99999;
    pointer-events: none;
}

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

.de-nav-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
    padding: 12px 12px 6px 12px;
}

.de-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--de-radius-md);
    color: #475569;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.de-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.de-nav-item:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.de-nav-item.active {
    background: rgba(144, 189, 26, 0.15);
    color: #00275e;
    border: 1px solid rgba(144, 189, 26, 0.6);
    font-weight: 700;
}

/* Main Content Area */
.de-main-content {
    margin-top: var(--de-topbar-height);
    margin-left: var(--de-sidebar-width);
    padding: 32px;
    flex: 1;
    transition: margin-left 0.25s ease;
}

.de-sidebar.collapsed + .de-main-content {
    margin-left: var(--de-sidebar-collapsed-width);
}

/* Page Header Block */
.de-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}

.de-page-title {
    font-size: 1.75rem;
    color: var(--de-text-primary);
    margin-bottom: 4px;
}

.de-page-subtitle {
    font-size: 0.9rem;
    color: var(--de-text-secondary);
}

/* Cards & Grid System */
.de-card {
    background: var(--de-bg-card);
    border: 1px solid var(--de-border-subtle);
    border-radius: var(--de-radius-lg);
    box-shadow: var(--de-shadow-card);
    backdrop-filter: blur(12px);
    overflow: hidden;
}

.de-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--de-border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.de-card-body {
    padding: 24px;
}

.de-card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--de-border-subtle);
    background: #f8fafc;
}

/* Button Primitives from Provided Design System */
.de-btn, .inv-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--de-radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

/* Primary Button (Dark Green #385208 from Image) */
.de-btn-primary, .inv-btn-primary {
    background: var(--inv-primary-dark);
    color: #FFFFFF;
    font-weight: 700;
    border-color: var(--inv-primary-dark);
    box-shadow: 0 4px 12px rgba(56, 82, 8, 0.25);
}

.de-btn-primary:hover, .inv-btn-primary:hover {
    background: #2D4306;
    color: #FFFFFF;
    transform: translateY(-1px);
}

/* Lime Primary Button (#9DFF00 from Image) */
.de-btn-lime, .inv-btn-lime {
    background: var(--inv-primary);
    color: #1A1D1F;
    font-weight: 700;
    border-color: var(--inv-primary);
    box-shadow: 0 4px 14px var(--inv-primary-glow);
}

.de-btn-lime:hover, .inv-btn-lime:hover {
    background: var(--inv-primary-hover);
    color: #1A1D1F;
    transform: translateY(-1px);
}

/* Secondary Button (#E4ECF7 from Image) */
.de-btn-secondary, .inv-btn-secondary {
    background: var(--inv-bg-pill);
    color: #1F242B;
    border-color: var(--inv-border-medium);
}

.de-btn-secondary:hover, .inv-btn-secondary:hover {
    background: #D8E5F8;
    color: #00275E;
    border-color: #B2C6E2;
}

/* Inverted Button (#1F242B from Image) */
.de-btn-inverted, .inv-btn-inverted {
    background: #1F242B;
    color: #FFFFFF;
    border-color: #1F242B;
}

.de-btn-inverted:hover, .inv-btn-inverted:hover {
    background: #0F1216;
    color: #FFFFFF;
}

/* Outlined Button (#C8D4E6 Border from Image) */
.de-btn-outlined, .inv-btn-outlined {
    background: #FFFFFF;
    color: #1F242B;
    border-color: var(--inv-border-medium);
}

.de-btn-outlined:hover, .inv-btn-outlined:hover {
    background: #F4F7FC;
    border-color: #98ADC9;
    color: #00275E;
}

/* Action Circle Icon Buttons from Image */
.inv-icon-btn, .de-btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.inv-icon-btn-lime { background: var(--inv-primary); color: #1A1D1F; }
.inv-icon-btn-primary { background: var(--inv-primary-dark); color: var(--inv-primary); }
.inv-icon-btn-navy { background: var(--inv-secondary); color: #FFFFFF; }
.inv-icon-btn-neutral { background: var(--inv-neutral); color: #FFFFFF; }
.inv-icon-btn-danger { background: #C02626; color: #FFFFFF; }

.inv-icon-btn:hover, .de-btn-icon:hover { 
    transform: scale(1.1) translateY(-2px); 
    box-shadow: 0 6px 16px rgba(0, 39, 94, 0.15);
}

.de-btn:active, .inv-btn:active {
    transform: scale(0.97);
}

.de-btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

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

/* Card Interactive Hover Elevation */
.de-card, .inv-card {
    background: var(--de-bg-card);
    border: 1px solid var(--de-border-subtle);
    border-radius: var(--de-radius-lg);
    box-shadow: var(--de-shadow-card);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.de-card:hover, .inv-card:hover {
    box-shadow: 0 8px 24px rgba(0, 39, 94, 0.08);
    border-color: var(--inv-border-medium);
}

.de-card.interactive:hover, .inv-card.interactive:hover {
    transform: translateY(-3px);
    border-color: var(--inv-primary);
}

/* Data Tables */
.de-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--de-radius-md);
}

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

.de-table th {
    background: #EBF1FA;
    color: var(--inv-secondary);
    padding: 14px 20px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #CBD5E1;
}

.de-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--de-border-subtle);
    color: var(--de-text-primary);
    vertical-align: middle;
    transition: background 0.15s ease;
}

.de-table tr:hover td {
    background: #F4F8FE;
}

/* Badges & Pills */
.de-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--de-radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.de-badge-success { background: rgba(157, 255, 0, 0.2); color: #2E4D00; border: 1px solid rgba(56, 82, 8, 0.3); }
.de-badge-warning { background: #FEF3C7; color: #D97706; border: 1px solid rgba(245, 158, 11, 0.3); }
.de-badge-danger { background: #FEE2E2; color: #DC2626; border: 1px solid rgba(239, 68, 68, 0.3); }
.de-badge-info { background: #DBEAFE; color: #00275E; border: 1px solid rgba(0, 39, 94, 0.25); }
.de-badge-purple { background: rgba(168, 85, 247, 0.15); color: #9333EA; border: 1px solid rgba(168, 85, 247, 0.3); }

/* Form Controls with Lime Focus Ring */
.de-form-group {
    margin-bottom: 20px;
}

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

.de-input, .de-select, .de-textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--de-radius-md);
    background: var(--inv-bg-input);
    border: 1px solid var(--inv-border-medium);
    color: var(--de-text-primary);
    font-size: 0.92rem;
    outline: none;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.de-input:focus, .de-select:focus, .de-textarea:focus {
    border-color: var(--inv-primary);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px var(--inv-primary-glow);
}

/* Modals & Scale-In Keyframe Animations */
.de-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 39, 94, 0.55);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    transition: opacity 0.25s ease;
}

.de-modal-overlay.active {
    display: flex;
}

.de-modal {
    background: var(--de-bg-surface);
    border: 1px solid var(--de-border-medium);
    border-radius: var(--de-radius-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--de-shadow-dropdown);
    animation: invModalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes invModalIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Page Loader Top Progress Bar */
.inv-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--inv-primary), var(--inv-secondary), var(--inv-primary));
    background-size: 200% 100%;
    z-index: 99999;
    animation: invLoaderPulse 1.5s infinite linear;
    display: none;
}

.inv-page-loader.active {
    display: block;
}

@keyframes invLoaderPulse {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* CSS Spinner Indicator */
.inv-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: invSpin 0.8s linear infinite;
    display: inline-block;
}

.inv-spinner-dark {
    border-color: rgba(0, 39, 94, 0.2);
    border-top-color: var(--inv-secondary);
}

@keyframes invSpin {
    to { transform: rotate(360deg); }
}

/* Status State Containers */
.de-empty-state, .de-loading-state, .de-error-state, .de-permission-denied {
    padding: 60px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.de-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    color: var(--de-text-muted);
}

.de-permission-denied .de-state-icon {
    color: var(--de-status-danger);
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .de-main-content {
        padding: 20px;
    }
    .de-search-trigger {
        width: 180px;
    }
}

@media (max-width: 640px) {
    .de-topbar {
        padding: 0 12px;
    }
    .de-search-trigger {
        display: none;
    }
    .de-sidebar {
        display: none;
    }
    .de-main-content {
        margin-left: 0;
        padding: 16px;
    }
}
