/**
 * OSIRIS Dashboard - Brand-Aligned Design
 * Dream. Travel. Experience.
 *
 * Version: 2025-10-26-alignment-fix-v2
 *
 * Color Palette:
 * - Primary Blue: #005A8B
 * - Secondary Turquoise: #00A6D6
 * - Orange Accent: #FF8C00
 * - Background: #F5F7FA
 * - Surface: #FFFFFF
 */

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

:root {
    /* Dark Theme Colors - Professional Slate/Navy Palette */
    --color-primary: #2563eb;
    --color-primary-dark: #1e40af;
    --color-primary-light: #3b82f6;
    --color-secondary: #475569;
    --color-secondary-light: #64748b;
    --color-accent: #0ea5e9;
    --color-accent-dark: #0284c7;
    --color-accent-light: #38bdf8;

    /* Dark Neutral Colors */
    --color-background: #0f1419;
    --color-background-light: #1a1f2e;
    --color-surface: #1e2936;
    --color-surface-light: #2d3748;
    --color-border: #374151;
    --color-text-primary: #e5e7eb;
    --color-text-secondary: #9ca3af;
    --color-text-light: #6b7280;

    /* Status Colors - Dark Theme Adjusted */
    --color-success: #10b981;
    --color-success-light: #065f46;
    --color-warning: #f59e0b;
    --color-warning-light: #78350f;
    --color-danger: #ef4444;
    --color-danger-light: #7f1d1d;
    --color-info: #3b82f6;
    --color-info-light: #1e3a8a;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing System */
    --spacing-xs: 0.5rem;     /* 8px */
    --spacing-sm: 1rem;       /* 16px */
    --spacing-md: 1.5rem;     /* 24px */
    --spacing-lg: 2rem;       /* 32px */
    --spacing-xl: 3rem;       /* 48px */
    --spacing-2xl: 4rem;      /* 64px */

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 8px 24px rgba(0, 0, 0, 0.15);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

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

/* Dark theme animated gradient background */
@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

html {
    background: linear-gradient(-45deg, #0f1419, #1a1f2e, #1c2333, #141b24, #0f1419);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    scroll-behavior: smooth;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body {
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;
    color: var(--color-text-primary);
    background: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
    animation: fadeIn 0.5s ease;
}

/* Subtle dark background pattern overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(14, 165, 233, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(59, 130, 246, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text-primary);
    margin-bottom: var(--spacing-md);
}

h1 { font-size: 2.25rem; font-weight: 700; }
h2 { font-size: 1.875rem; font-weight: 600; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
    color: #60a5fa;
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: #93c5fd;
}

/* ============================================================================
   HEADER & NAVIGATION
   ============================================================================ */

.dashboard-header {
    background: #1a2942;
    padding: 1rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-lg);
}

.dashboard-logo {
    display: flex;
    align-items: center;
    transition: var(--transition);
    color: #ffffff !important;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.05em;
}

.dashboard-logo:hover {
    color: #ffffff !important;
    opacity: 0.9;
    transform: translateY(-1px);
}

.dashboard-nav {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.dashboard-nav a {
    font-size: 0.9375rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    padding: var(--spacing-xs) 0;
    transition: var(--transition);
}

.dashboard-nav a:hover {
    color: #ffffff;
}

.dashboard-nav a.active {
    color: #ffffff;
    font-weight: 600;
}

.dashboard-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-accent);
    border-radius: 2px 2px 0 0;
}

.dashboard-nav a.btn-logout {
    padding: var(--spacing-xs) var(--spacing-md);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-md);
    color: #ffffff;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.05);
}

.dashboard-nav a.btn-logout:hover {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-surface);
}

/* ============================================================================
   SEARCH BAR
   ============================================================================ */

.search-container {
    flex: 0 0 auto;
    width: 320px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.75rem;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 0.875rem;
    border-radius: 50px;
    transition: all 0.3s ease-in-out;
    outline: none;
}

.search-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(14, 165, 233, 0.1);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}


.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: rgba(30, 41, 54, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    max-height: 450px;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
}

.search-result-item {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.search-result-item:first-child {
    border-radius: 12px 12px 0 0;
}

.search-result-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.search-result-item:hover {
    background: rgba(37, 99, 235, 0.15);
}

.search-result-content {
    flex: 1;
}

.search-result-title {
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--color-text-primary);
}

.search-result-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.search-result-type {
    padding: 0.375rem 0.75rem;
    background: rgba(37, 99, 235, 0.2);
    color: var(--color-accent-light);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 50px;
    letter-spacing: 0.05em;
    border: 1px solid rgba(37, 99, 235, 0.3);
}

/* ============================================================================
   MAIN CONTENT & LAYOUT
   ============================================================================ */

.dashboard-main {
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--spacing-xl) var(--spacing-lg);
    position: relative;
    z-index: 1;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    color: #ffffff;
    letter-spacing: -0.02em;
}

/* 12-Column Grid System */
.container-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--spacing-lg);
}

/* ============================================================================
   STAT CARDS
   ============================================================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card {
    background: rgba(30, 41, 54, 0.85);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(55, 65, 81, 0.6);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
    animation: slideInUp 0.6s ease backwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15), transparent);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
}

.stat-card:hover {
    box-shadow: 0 12px 40px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(37, 99, 235, 0.6);
    background: rgba(30, 41, 54, 0.95);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover::after {
    width: 300px;
    height: 300px;
}

.stat-value {
    font-family: var(--font-family);
    font-size: 2.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--spacing-sm);
    line-height: 1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.stat-label svg,
.stat-label i {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

/* ============================================================================
   COMPANY CARDS (SUPPLIERS/CLIENTS)
   ============================================================================ */

.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

.item-card {
    background: rgba(30, 41, 54, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease-in-out;
    border: 1px solid rgba(55, 65, 81, 0.6);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    min-height: 160px;
}

.item-card:hover {
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.35), 0 4px 12px rgba(0, 0, 0, 0.25);
    transform: translateY(-6px);
    border-color: rgba(37, 99, 235, 0.6);
    background: rgba(30, 41, 54, 0.95);
}

.item-card-header {
    padding: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    flex: 1;
}

.company-logo {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: rgba(30, 58, 95, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
}

.company-logo svg {
    width: 32px;
    height: 32px;
    color: var(--color-primary);
}

.item-card-title {
    font-family: var(--font-family);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4;
    flex: 1;
}

.item-card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-weight: 500;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.item-card-footer svg,
.item-card-footer i {
    width: 16px;
    height: 16px;
    color: var(--color-primary);
}

/* ============================================================================
   TABLES
   ============================================================================ */

.data-table {
    width: 100%;
    background: rgba(30, 41, 54, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(55, 65, 81, 0.6);
    overflow: hidden;
    border-collapse: collapse;
}

.data-table thead {
    background: rgba(37, 99, 235, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    padding: 0.875rem var(--spacing-md);
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--color-accent-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid rgba(37, 99, 235, 0.2);
}

.data-table th:last-child {
    text-align: right;
}

.data-table td {
    padding: 0.875rem var(--spacing-md);
    border-top: 1px solid rgba(55, 65, 81, 0.25);
    font-size: 14px;
    color: #E0E0E0;
    transition: all 0.2s ease-in-out;
}

.data-table td:last-child {
    text-align: right;
    color: var(--color-text-secondary);
}

.data-table tbody tr {
    transition: all 0.2s ease-in-out;
    background: transparent;
}

/* Zebra Striping */
.data-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.15);
}

/* Hover Highlight */
.data-table tbody tr:hover {
    background: rgba(37, 99, 235, 0.12);
    cursor: pointer;
    transform: translateX(2px);
}

.data-table tbody tr:hover td {
    color: #ffffff;
}

/* Filename truncation with tooltip */
.data-table td:first-child {
    max-width: 280px;
}

.filename-cell {
    display: inline-block;
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
    cursor: pointer;
}

.filename-cell:hover::after {
    content: attr(data-full-name);
    position: absolute;
    left: 0;
    top: calc(100% + 0.5rem);
    background: rgba(0, 0, 0, 0.95);
    color: #ffffff;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    white-space: normal;
    word-break: break-all;
    z-index: 1000;
    min-width: 200px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
}

/* ============================================================================
   CONFIDENCE BAR
   ============================================================================ */

.confidence-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: #E5E7EB;
    border-radius: 99px;
    overflow: hidden;
    max-width: 100px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success), #059669);
    transition: width 0.3s ease;
    border-radius: 99px;
}

.confidence-fill.medium {
    background: linear-gradient(90deg, var(--color-warning), #D97706);
}

.confidence-fill.low {
    background: linear-gradient(90deg, var(--color-danger), #DC2626);
}

.confidence-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    min-width: 45px;
}

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 0.4rem 0.8rem !important;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.2;
    text-align: center !important;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-secondary {
    background: rgba(71, 85, 105, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(71, 85, 105, 0.3);
}

.badge svg,
.badge i {
    width: 12px !important;
    height: 12px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 0.35rem 0 0 !important;
}

/* Ensure Lucide-generated SVGs are properly constrained */
.badge svg {
    stroke-width: 2;
    min-width: 12px !important;
    max-width: 12px !important;
    min-height: 12px !important;
    max-height: 12px !important;
}

.badge-verified {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.25), rgba(37, 99, 235, 0.2));
    color: var(--color-accent-light);
    border: 1px solid rgba(14, 165, 233, 0.5);
    padding: 0.35rem;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.badge-verified:hover {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(37, 99, 235, 0.3));
    transform: scale(1.1);
}

.badge-verified i {
    width: 14px;
    height: 14px;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
    padding: 0.7rem 1.3rem;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center !important;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    backdrop-filter: blur(10px);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4), 0 2px 6px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-accent-light), var(--color-accent));
    box-shadow: 0 6px 25px rgba(14, 165, 233, 0.5), 0 4px 12px rgba(0, 0, 0, 0.25);
    color: #ffffff;
    transform: translateY(-2px);
}

.btn svg,
.btn i {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin: 0 0.5rem 0 0 !important;
}

/* Ensure Lucide-generated SVGs in buttons are properly constrained */
.btn svg[data-lucide],
.btn i[data-lucide] {
    stroke-width: 2;
}

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary-dark), var(--color-primary)) !important;
    padding: var(--spacing-lg);
}

.login-card {
    background: rgba(30, 41, 54, 0.95);
    backdrop-filter: blur(20px);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(55, 65, 81, 0.5);
    min-width: 420px;
    max-width: 500px;
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-md);
}

.login-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--spacing-sm);
    color: #ffffff;
    letter-spacing: 0.05em;
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-check-input {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--color-accent);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #ffffff;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #ffffff;
}

.form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2), 0 2px 8px rgba(14, 165, 233, 0.1);
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.error-message {
    background: var(--color-danger-light);
    color: #991B1B;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    font-size: 0.9375rem;
    border-radius: var(--radius-md);
    border-left: 4px solid var(--color-danger);
    font-weight: 500;
}

/* ============================================================================
   INVOICE PREVIEW
   ============================================================================ */

.invoice-preview {
    background: rgba(30, 41, 54, 0.85);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(55, 65, 81, 0.6);
    cursor: pointer;
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.invoice-preview::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s;
}

.invoice-preview:hover::before {
    left: 100%;
}

.invoice-preview:hover {
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.2);
    transform: translateY(-4px);
    border-color: rgba(37, 99, 235, 0.3);
    background: rgba(30, 41, 54, 0.95);
}

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.invoice-filename {
    font-family: var(--font-family);
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.invoice-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.invoice-meta-item {
    font-size: 0.875rem;
}

.invoice-meta-label {
    color: var(--color-text-secondary);
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.invoice-meta-value {
    color: var(--color-text-primary);
    font-weight: 500;
}

.invoice-text-preview {
    background: rgba(0, 0, 0, 0.2);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    max-height: 140px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.6;
    font-family: 'Courier New', monospace;
    border: 1px solid var(--color-border);
}

.invoice-text-preview::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.2));
}

/* ============================================================================
   DETAIL SECTIONS
   ============================================================================ */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.detail-section {
    background: rgba(30, 41, 54, 0.85);
    backdrop-filter: blur(10px);
    padding: var(--spacing-lg);
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(55, 65, 81, 0.6);
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.detail-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.5), rgba(14, 165, 233, 0.5));
    opacity: 0;
    transition: opacity 0.3s;
}

.detail-section:hover::before {
    opacity: 1;
}

.detail-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.detail-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--color-border);
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.detail-section h3 svg,
.detail-section h3 i {
    width: 22px;
    height: 22px;
    color: var(--color-primary);
}

.detail-row {
    margin-bottom: var(--spacing-md);
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: var(--spacing-md);
}

.detail-label {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.detail-value {
    font-size: 0.9375rem;
    color: var(--color-text-primary);
    font-weight: 500;
}

/* ============================================================================
   SEARCH FORM
   ============================================================================ */

.search-form {
    background: rgba(30, 41, 54, 0.7);
    backdrop-filter: blur(20px);
    padding: var(--spacing-lg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(55, 65, 81, 0.6);
}

.search-form label {
    color: #ffffff;
    font-weight: 500;
}

/* ============================================================================
   INVOICE TABS
   ============================================================================ */

.invoice-tab {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 0.875rem 1.75rem;
    font-family: var(--font-family);
    font-size: 0.9375rem;
    font-weight: 600;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 50px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin-right: 0.5rem;
}

.invoice-tab:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab-active {
    color: #ffffff !important;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(37, 99, 235, 0.15)) !important;
    border: 1px solid rgba(14, 165, 233, 0.4) !important;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
}

.tab-inactive {
    color: var(--color-text-secondary);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-center { text-align: center; }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }

.loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
}

/* ============================================================================
   LOADING SPINNER & SKELETON
   ============================================================================ */

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(14, 165, 233, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
}

.loading-text {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
}

/* Skeleton Loaders */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.05) 0px,
        rgba(255, 255, 255, 0.1) 40px,
        rgba(255, 255, 255, 0.05) 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-card {
    background: rgba(30, 41, 54, 0.85);
    backdrop-filter: blur(10px);
    padding: var(--spacing-xl);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(55, 65, 81, 0.6);
}

/* ============================================================================
   MODAL
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    padding: 2rem;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
    overflow-y: auto;
}

.modal-overlay[style*="display: flex"] {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    background: rgba(30, 41, 54, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideInUp 0.3s ease;
    margin: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.modal-body {
    color: var(--color-text-primary);
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 1rem;
    margin: 0 -0.5rem;
    padding-left: 0.5rem;
}

.modal-footer {
    padding: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.stat-row:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-row-label {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.stat-row-value {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================================
   USER DROPDOWN
   ============================================================================ */

.user-dropdown {
    position: relative;
}

.user-dropdown-trigger {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.user-dropdown-trigger:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 200px;
    background: rgba(30, 41, 54, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    overflow: visible;
    z-index: 1000;
}

.user-dropdown-header {
    padding: 0.875rem 1rem !important;
    background: rgba(37, 99, 235, 0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9375rem;
}

.user-dropdown-header i {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
}

.user-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0;
}

.user-dropdown-item {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.75rem 1rem !important;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    font-size: 15px;
    white-space: nowrap;
    box-sizing: border-box;
}

.user-dropdown-item i {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
}

.user-dropdown-item:hover {
    background: rgba(37, 99, 235, 0.15);
    color: #ffffff;
}

.user-dropdown-logout {
    color: rgba(239, 68, 68, 0.9);
}

.user-dropdown-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 var(--spacing-lg);
    }

    .dashboard-main {
        padding: var(--spacing-xl) var(--spacing-lg);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .items-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: var(--spacing-md);
        padding: 0 var(--spacing-md);
    }

    .search-container {
        order: 3;
        max-width: 100%;
        width: 100%;
    }

    .dashboard-nav {
        gap: var(--spacing-md);
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .dashboard-nav a.active::after {
        bottom: -0.75rem;
    }

    .dashboard-main {
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .page-title {
        font-size: 1.75rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 2.75rem;
    }

    .items-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-row {
        grid-template-columns: 1fr;
        gap: var(--spacing-xs);
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .login-card {
        min-width: auto;
        width: 100%;
    }

    .invoice-meta {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ============================================================================
   MASTER INVOICE MENU STYLES (NEW 2025-10-20)
   ============================================================================ */

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: none;
    border: none;
    color: var(--color-text-primary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-family);
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-accent);
}

.menu-item:active {
    background: rgba(255, 255, 255, 0.12);
}

.menu-item i {
    flex-shrink: 0;
}

.menu-item span {
    flex: 1;
}

/* Invoice menu dropdown animations */
.invoice-menu-dropdown {
    animation: menuSlideIn 0.2s ease-out;
}

@keyframes menuSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
