/* ===================================================
   Batchit — Premium SaaS Theme
   Blue / White / Slate color palette
   =================================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Primary Blue */
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --primary-hover: #1d4ed8;
    --primary-active: #e8f0fe;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);

    /* Backgrounds */
    --bg-body: #f7f8fb;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-main: #f8fafc;
    --bg-input: #f8fafc;
    --bg-hover: #f1f5f9;

    /* Borders */
    --border: #e5e7eb;
    --border-sidebar: #e5edff;
    --border-light: #f1f5f9;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-label: #64748b;
    --text-white: #ffffff;

    /* Accents */
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --topbar-height: 60px;
    --border-radius: 10px;
    --border-radius-sm: 8px;
    --border-radius-xs: 6px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-card: 0 1px 4px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition: all 0.25s ease;
    --transition-fast: all 0.15s ease;
}

/* --- Global Reset --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===================================================
   SIDEBAR
   =================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-sidebar);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .sidebar-user-info {
    display: none;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--border-sidebar);
    min-height: 70px;
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    object-fit: contain;
    border-radius: 8px;
}

.sidebar-logo-icon {
    width: 38px;
    height: 38px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: 3px;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary);
    border-radius: 3px 0 0 3px;
}

.nav-item svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.nav-divider {
    height: 1px;
    background: var(--border-sidebar);
    margin: 12px 0;
}

/* Sidebar Footer / User */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border-sidebar);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: capitalize;
}

.logout-link {
    color: var(--danger) !important;
}

.logout-link:hover {
    background: var(--danger-light) !important;
}

/* ===================================================
   TOPBAR
   =================================================== */
.topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 900;
}

.topbar-toggle {
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--border-radius-xs);
    transition: var(--transition-fast);
}

.topbar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-org-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===================================================
   MAIN CONTENT
   =================================================== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

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

.main-content.no-sidebar {
    margin-left: 0;
}

.page-content {
    padding: 28px;
}

/* ===================================================
   CARDS
   =================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 18px 22px;
    font-weight: 600;
    font-size: 15px;
}

.card-body {
    padding: 22px;
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 22px;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 20px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 18px;
    transition: var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.btn-outline-primary {
    border: 1.5px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-light);
    color: var(--primary-hover);
}

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-light {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-light:hover {
    background: var(--border);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

/* ===================================================
   FORMS
   =================================================== */
.form-control,
.form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 10px 14px;
    font-size: 14px;
    transition: var(--transition-fast);
    background: var(--bg-input);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
    background: white;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-label);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ===================================================
   TABLES
   =================================================== */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--bg-main);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: var(--bg-hover);
}

/* ===================================================
   BADGES & TAGS
   =================================================== */
.badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(37, 99, 235, 0.15);
}

.tag .tag-remove {
    cursor: pointer;
    opacity: 0.6;
    transition: var(--transition-fast);
}

.tag .tag-remove:hover {
    opacity: 1;
}

/* ===================================================
   MODALS
   =================================================== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-light);
    padding: 18px 22px;
}

.modal-title {
    font-weight: 700;
    font-size: 17px;
}

.modal-body {
    padding: 22px;
}

.modal-footer {
    border-top: 1px solid var(--border-light);
    padding: 14px 22px;
}

/* ===================================================
   EMPTY STATES
   =================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    opacity: 0.3;
    margin-bottom: 16px;
}

.empty-state h5 {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ===================================================
   PAGE HEADERS
   =================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-header .page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ===================================================
   SEARCH
   =================================================== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 38px;
    background: white;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.4;
}

/* ===================================================
   TOGGLE SWITCH
   =================================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 24px;
    transition: var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

input:checked + .toggle-slider {
    background: var(--primary);
}

input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ===================================================
   ANIMATIONS
   =================================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.animate-slide-in {
    animation: slideInRight 0.3s ease forwards;
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 16px;
    }

    .page-header h1 {
        font-size: 20px;
    }

    .stat-card .stat-value {
        font-size: 22px;
    }
}

/* ===================================================
   UTILITIES
   =================================================== */
.text-primary-color { color: var(--primary); }
.text-success-color { color: var(--success); }
.text-warning-color { color: var(--warning); }
.text-danger-color { color: var(--danger); }
.text-muted-color { color: var(--text-muted); }
.bg-primary-light { background: var(--primary-light); }
.bg-success-light { background: var(--success-light); }
.bg-warning-light { background: var(--warning-light); }
.bg-danger-light { background: var(--danger-light); }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
