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

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-active: rgba(99, 102, 241, 0.4);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4), 0 2px 8px -1px rgba(0, 0, 0, 0.2);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

/* App Wrapper Layout */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background-color: #0b0f19;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    letter-spacing: 0.5px;
}

.sidebar-brand span {
    color: var(--primary);
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #fff;
    background-color: var(--bg-hover);
}

.nav-link.active {
    color: #fff;
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-link i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 40px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 32px;
    width: calc(100% - 280px);
}

/* Header/Top Bar */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.top-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(135deg, #fff 50%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Card layout (Glassmorphism) */
.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
}

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

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

/* Dashboard Statistics Grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    font-size: 1.5rem;
}

.stat-icon.primary { background-color: rgba(99, 102, 241, 0.15); color: var(--primary); }
.stat-icon.secondary { background-color: rgba(14, 165, 233, 0.15); color: var(--secondary); }
.stat-icon.success { background-color: rgba(16, 185, 129, 0.15); color: var(--success); }
.stat-icon.warning { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.danger { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

@media (max-width: 1024px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Tables styling */
.table-responsive {
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table-custom td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.925rem;
    color: var(--text-main);
}

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

.table-custom tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Badge components */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge.primary { background-color: rgba(99, 102, 241, 0.15); color: var(--primary); }
.badge.success { background-color: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge.warning { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge.danger { background-color: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge.muted { background-color: rgba(148, 163, 184, 0.15); color: var(--text-muted); }

/* Forms & Inputs styling */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-control {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 16px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Button components */
.btn-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 0.95rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.12);
}

.btn-danger {
    background-color: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Stock Indicator Dot */
.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.indicator-dot.active { background-color: var(--success); }
.indicator-dot.warning { background-color: var(--warning); }
.indicator-dot.danger { background-color: var(--danger); }

/* Custom Progress Bar */
.progress-bar-custom {
    height: 8px;
    background-color: var(--bg-hover);
    border-radius: 99px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary);
    border-radius: 99px;
    transition: width 0.3s ease;
}

/* Utilities */
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
}

/* Tom Select Premium Dark Mode Overrides */
/* Reset bootstrap or custom form-control styling inherited by the outer wrapper */
.ts-wrapper.form-control {
    padding: 0 !important;
    background-color: transparent !important;
    border: none !important;
    box-shadow: none !important;
    height: auto !important;
    min-height: 0 !important;
}

/* Outer Wrapper Styling */
.ts-wrapper.searchable-select {
    background-color: rgba(15, 23, 42, 0.6) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 0 !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
    box-shadow: none !important;
    display: inline-block;
    width: 100%;
    vertical-align: middle;
    box-sizing: border-box;
}

/* Control (the input area) styling */
.ts-wrapper.searchable-select .ts-control {
    background: transparent !important;
    border: none !important;
    color: #fff !important;
    padding: 8px 16px !important;
    font-family: var(--font-body) !important;
    font-size: 0.95rem !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    min-height: 42px;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

/* Active focus ring matching theme */
.ts-wrapper.searchable-select.focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
}

.ts-wrapper.searchable-select.focus .ts-control {
    border-color: var(--primary) !important;
}

/* Styled Dropdown Panel */
.ts-dropdown.searchable-select {
    background-color: #1e293b !important; /* Solid card dark background for text readability */
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.6), 0 8px 16px -8px rgba(0, 0, 0, 0.6) !important;
    color: #fff !important;
    font-family: var(--font-body) !important;
    z-index: 100000 !important;
    margin-top: 4px;
    overflow: hidden;
}

/* Item options */
.ts-dropdown.searchable-select .option {
    padding: 12px 16px !important;
    color: var(--text-main) !important;
    cursor: pointer;
    background-color: transparent !important;
    transition: background-color 0.15s ease, color 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    font-size: 0.9rem !important;
}

.ts-dropdown.searchable-select .option:last-child {
    border-bottom: none !important;
}

/* Active option hover states */
.ts-dropdown.searchable-select .option.active,
.ts-dropdown.searchable-select .active {
    background-color: rgba(99, 102, 241, 0.15) !important; /* Primary light tint */
    color: #fff !important;
}

/* Highlighted matching search characters (Premium styling like Linear/Vercel) */
.ts-dropdown.searchable-select .highlight {
    background: transparent !important;
    color: var(--secondary) !important; /* Sky blue matching highlight */
    font-weight: 700 !important;
}

/* No results state styling */
.ts-dropdown.searchable-select .no-results {
    padding: 16px !important;
    color: var(--text-muted) !important;
    font-size: 0.9rem !important;
    font-style: italic !important;
    text-align: center !important;
}

/* Dropdown list scrollbars */
.ts-dropdown.searchable-select .ts-dropdown-content {
    max-height: 240px;
    overflow-y: auto;
}
.ts-dropdown.searchable-select .ts-dropdown-content::-webkit-scrollbar {
    width: 6px;
}
.ts-dropdown.searchable-select .ts-dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}
.ts-dropdown.searchable-select .ts-dropdown-content::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}
.ts-dropdown.searchable-select .ts-dropdown-content::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* Search Input Styling */
.ts-wrapper.searchable-select .ts-control input {
    color: #fff !important;
    font-family: var(--font-body) !important;
    font-size: 0.95rem !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Selected item display text */
.ts-wrapper.searchable-select.single .ts-control .item {
    color: #fff !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    font-family: var(--font-body) !important;
    font-size: 0.95rem !important;
}

/* Custom Dropdown Arrow */
.ts-wrapper.searchable-select.single .ts-control:after {
    border-color: var(--text-muted) transparent transparent transparent !important;
    right: 16px !important;
    border-width: 5px 5px 0 5px !important;
    transition: transform 0.2s ease;
}

.ts-wrapper.searchable-select.single.open .ts-control:after {
    border-color: transparent transparent var(--text-muted) transparent !important;
    right: 16px !important;
    border-width: 0 5px 5px 5px !important;
}

/* Handle disabled state */
.ts-wrapper.searchable-select.disabled {
    opacity: 0.6;
    background-color: rgba(15, 23, 42, 0.3) !important;
    cursor: not-allowed;
}
.ts-wrapper.searchable-select.disabled .ts-control {
    cursor: not-allowed;
}