/* IKIGAI - Modern ERP Styles */

:root {
    --sidebar-width: 240px;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --sidebar-active: #3b82f6;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --body-bg: #f1f5f9;
    --card-border: #e2e8f0;
    --text-primary: #1e293b;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-size: 0.875rem;
    background-color: var(--body-bg);
    color: var(--text-primary);
}

/* ─── Sidebar ─────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    overflow-y: auto;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand i {
    font-size: 1.3rem;
    color: var(--accent);
}

.sidebar-nav {
    padding: 0.75rem 0;
    flex: 1;
}

.sidebar-section {
    padding: 0.5rem 1.25rem 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.3);
    margin-top: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.825rem;
    font-weight: 450;
    border-radius: 0;
    transition: all 0.15s;
    position: relative;
}

.sidebar-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
}

.sidebar-link.active {
    color: var(--sidebar-text-active);
    background: rgba(59,130,246,0.15);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.sidebar-link i {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
    opacity: 0.7;
}

.sidebar-link.active i,
.sidebar-link:hover i {
    opacity: 1;
}

.sidebar-link .badge {
    margin-left: auto;
    font-size: 0.65rem;
    padding: 0.2em 0.5em;
}

.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 0.4rem 0;
}

.sidebar-user:hover {
    color: #fff;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
    font-weight: 600;
}

/* ─── Main content ────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar-title {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.content-wrapper {
    padding: 1.5rem;
}

/* ─── Cards ───────────────────────────────────────── */
.card {
    border: 1px solid var(--card-border);
    border-radius: 0.625rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid var(--card-border);
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.825rem;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    background: #fafbfc;
    border-top: 1px solid var(--card-border);
    padding: 0.75rem 1rem;
}

/* ─── Tables ──────────────────────────────────────── */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom-width: 1px;
    padding: 0.6rem 0.75rem;
    background: #fafbfc;
}

.table td {
    vertical-align: middle;
    padding: 0.6rem 0.75rem;
    font-size: 0.84rem;
    border-bottom: 1px solid #f1f5f9;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

.table-light th {
    background: #fafbfc;
}

/* ─── Buttons ─────────────────────────────────────── */
.btn {
    font-size: 0.825rem;
    font-weight: 500;
    border-radius: 0.5rem;
    padding: 0.4rem 0.85rem;
    transition: all 0.15s;
}

.btn-sm {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.4rem;
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

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

.btn-outline-primary {
    color: var(--accent);
    border-color: var(--accent);
}

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

/* ─── Badges ──────────────────────────────────────── */
.badge {
    font-weight: 550;
    letter-spacing: 0.01em;
    font-size: 0.72rem;
    padding: 0.3em 0.6em;
    border-radius: 0.375rem;
}

/* ─── Forms ───────────────────────────────────────── */
.form-control, .form-select {
    font-size: 0.84rem;
    border-radius: 0.5rem;
    border-color: #d1d5db;
    padding: 0.45rem 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.form-control-sm, .form-select-sm {
    font-size: 0.8rem;
    padding: 0.3rem 0.55rem;
    border-radius: 0.4rem;
}

.form-label {
    font-weight: 550;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

/* ─── Alerts ──────────────────────────────────────── */
.alert {
    border-radius: 0.5rem;
    font-size: 0.84rem;
    padding: 0.65rem 1rem;
    border: none;
}

.alert-success { background: #ecfdf5; color: #065f46; }
.alert-danger  { background: #fef2f2; color: #991b1b; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-info    { background: #eff6ff; color: #1e40af; }

/* ─── Nav pills / tabs ────────────────────────────── */
.nav-pills .nav-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 0.5rem;
    padding: 0.4rem 0.85rem;
}

.nav-pills .nav-link.active {
    background: var(--accent);
}

.nav-tabs .nav-link {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 0.5rem 0.5rem 0 0;
}

/* ─── KPI / stat cards ────────────────────────────── */
.stat-card {
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

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

/* ─── Page headers ────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 650;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

h4 {
    font-size: 1.15rem;
}

/* ─── Product thumbnails ──────────────────────────── */
.product-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid var(--card-border);
}

/* ─── Supplier cards ──────────────────────────────── */
.card.h-100 {
    transition: transform 0.15s, box-shadow 0.15s;
}

.card.h-100:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ─── Scrollbar ───────────────────────────────────── */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* ─── Responsive ──────────────────────────────────── */
.sidebar-toggle {
    display: none;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1039;
    }

    .sidebar-overlay.show {
        display: block;
    }

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

    .sidebar-toggle {
        display: inline-flex;
    }

    .topbar {
        padding: 0 1rem;
    }

    .content-wrapper {
        padding: 1rem;
    }
}

/* ─── Print ───────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .btn, .nav-pills, form, .sidebar-toggle {
        display: none !important;
    }
    .main-content {
        margin-left: 0;
    }
    .card {
        border: 1px solid #ddd;
        box-shadow: none;
    }
}

/* ─── Google Fonts import ─────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;550;600;700&display=swap');
