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

:root {
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bg-body: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-subtle: #f1f5f9;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --navbar-bg: #0f172a;
    --navbar-border: #1e293b;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* Navbar */
.navbar {
    background-color: var(--navbar-bg);
    border-bottom: 1px solid var(--navbar-border);
    color: #ffffff;
    padding: 0 24px;
    height: 60px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.navbar .brand {
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    color: #ffffff;
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-nav a.nav-link {
    color: #94a3b8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.navbar-nav a.nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.user-info {
    font-size: 13.5px;
    color: #94a3b8;
}

.user-info strong {
    color: #f1f5f9;
}

.btn-logout {
    color: #f87171 !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.25);
    background: rgba(239, 68, 68, 0.08);
    transition: all 0.15s ease;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ffffff !important;
    border-color: rgba(239, 68, 68, 0.5);
}

/* Layout Containers */
.container {
    max-width: 1080px;
    margin: 32px auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 580px;
    margin: 32px auto;
    padding: 0 20px;
}

/* Page Header */
.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0 0 4px 0;
}

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

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

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

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Stats Dashboard */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border-color);
}

.stat-box.stat-blue::before { background: #3b82f6; }
.stat-box.stat-green::before { background: #10b981; }
.stat-box.stat-warning::before { background: #f59e0b; }
.stat-box.stat-purple::before { background: #8b5cf6; }

.stat-box .num {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-box .label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Toolbar & Filters */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Data Table */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    background: #ffffff;
}

th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

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

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

tr:hover td {
    background-color: #f8fafc;
}

.text-dark {
    color: var(--text-primary);
    font-weight: 600;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.badge-ok {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-low {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Form Controls */
form .field {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background-color: #ffffff;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

input::placeholder, textarea::placeholder {
    color: #94a3b8;
}

.input-help {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 5px;
    display: block;
}

/* Callout Box */
.callout-box {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}

.callout-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    background-color: var(--primary);
    color: #ffffff !important;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-sm);
    line-height: 1.25;
}

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

.btn-secondary {
    background-color: #ffffff;
    color: #475569 !important;
    border-color: #cbd5e1;
}

.btn-secondary:hover {
    background-color: #f8fafc;
    color: #0f172a !important;
    border-color: #94a3b8;
}

.btn-outline {
    background-color: #ffffff;
    color: #1e293b !important;
    border-color: #cbd5e1;
}

.btn-outline:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff !important;
}

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

.btn-sm {
    padding: 6px 11px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Login Page */
.center-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0f172a;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    padding: 36px 32px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.login-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Root Landing Cards */
.hero {
    text-align: center;
    padding: 32px 16px 16px;
}

.hero h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.hero p {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0;
}

.landing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 32px;
}

.landing-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    display: block;
    transition: all 0.2s ease;
}

.landing-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: #cbd5e1;
}

.landing-card .title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.landing-card .desc {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.45;
}

/* Footer note */
.footer-note {
    text-align: center;
    font-size: 12.5px;
    color: #94a3b8;
    margin-top: 32px;
}

/* ============================================================
   Link Nama Barang & Modal Pop-Up Mutasi / Log Stok
   ============================================================ */
.barang-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.barang-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Modal Backdrop & Dialog */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    padding: 16px;
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 920px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.96) translateY(10px);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.show .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

.modal-title-group h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 26px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.modal-close-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* Modal Inner Components */
.mutasi-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.mutasi-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    border-left: 4px solid var(--border-color);
}

.mutasi-stat-card.card-blue {
    border-left-color: #2563eb;
    background: #eff6ff;
}

.mutasi-stat-card.card-green {
    border-left-color: #16a34a;
    background: #f0fdf4;
}

.mutasi-stat-card.card-amber {
    border-left-color: #ea580c;
    background: #fff7ed;
}

.mutasi-stat-card.card-purple {
    border-left-color: #7c3aed;
    background: #f5f3ff;
}

.mutasi-stat-card .val {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.mutasi-stat-card .lbl {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 4px;
}

.mutasi-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.mutasi-tabs {
    display: inline-flex;
    background: #f1f5f9;
    padding: 3px;
    border-radius: var(--radius-md);
    gap: 2px;
}

.mutasi-tab-btn {
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.mutasi-tab-btn.active {
    background: #ffffff;
    color: var(--text-primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.badge-masuk {
    background-color: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-keluar {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.text-masuk {
    color: #16a34a;
    font-weight: 700;
}

.text-keluar {
    color: #dc2626;
    font-weight: 700;
}

.modal-loading-box {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px auto;
}

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

@media print {
    body * {
        visibility: hidden;
    }
    #mutasiModalBackdrop, #mutasiModalBackdrop * {
        visibility: visible;
    }
    #mutasiModalBackdrop {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #ffffff;
        padding: 0;
    }
    .modal-dialog {
        box-shadow: none;
        max-width: 100%;
        width: 100%;
    }
    .modal-close-btn, .modal-footer, .mutasi-toolbar {
        display: none !important;
    }
}




