* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary:      #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar-bg:   #1e293b;
    --sidebar-text: #cbd5e1;
    --bg:           #f1f5f9;
    --white:        #ffffff;
    --text:         #1e293b;
    --text-muted:   #64748b;
    --border:       #e2e8f0;
    --success:      #16a34a;
    --danger:       #dc2626;
    --warning:      #d97706;
    --info:         #0891b2;
    --shadow:       0 1px 3px rgba(0, 0, 0, 0.1);
    --radius:       8px;
    --radius-lg:    12px;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
}

/* ===== UTILITIES ===== */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mb-3        { margin-bottom: 12px; }
.link-small  { font-size: 12px; color: var(--primary); text-decoration: none; }
.link-small:hover { text-decoration: underline; }

.search-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
}

.code-tag {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.text-muted-sm {
    font-size: 12px;
    color: var(--text-muted);
}

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.drop-zone:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.drop-zone-icon {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.drop-zone-text {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.file-preview {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
    font-size: 13px;
}

/* ===== LOGIN ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5e7396 0%, #1548b8 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo i  { font-size: 48px; color: var(--primary); }
.login-logo h2 { font-size: 22px; margin-top: 8px; color: var(--text); }
.login-logo p  { color: var(--text-muted); font-size: 13px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12px;
    transition: border 0.2s;
    background: var(--white);
    color: var(--text);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary   { background: var(--primary);  color: white; }
.btn-primary:hover   { background: var(--primary-dark); }
.btn-success   { background: var(--success);  color: white; }
.btn-success:hover   { background: #15803d; }
.btn-danger    { background: var(--danger);   color: white; }
.btn-danger:hover    { background: #b91c1c; }
.btn-warning   { background: var(--warning);  color: white; }
.btn-warning:hover   { background: #b45309; }
.btn-secondary { background: #64748b;         color: white; }
.btn-secondary:hover { background: #475569; }

.btn-sm    { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger  { background: #fef2f2; color: var(--danger);  border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: var(--warning); border: 1px solid #fde68a; }

/* ===== LAYOUT ===== */
.wrapper { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    font-size: 18px;
    font-weight: 700;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i { color: var(--primary); font-size: 22px; }

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 12px;
    transition: all 0.2s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: var(--primary);
    color: white;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-right: 12px;
}

.sidebar-menu li a i { width: 18px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer a {
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-footer a:hover { color: white; }

.main-content {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--white);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.toggle-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text);
    padding: 8px;
}

.navbar-right { display: flex; align-items: center; gap: 12px; }

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.badge-role {
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-role.admin { background: #dbeafe; color: var(--primary); }
.badge-role.user  { background: #dcfce7; color: var(--success); }

/* ===== CONTENT ===== */
.content { padding: 24px; flex: 1; }

.page-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #dbeafe; color: var(--primary); }
.stat-icon.green  { background: #dcfce7; color: var(--success); }
.stat-icon.red    { background: #fee2e2; color: var(--danger); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.cyan   { background: #cffafe; color: var(--info); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-info h3 { font-size: 22px; font-weight: 700; }
.stat-info p  { font-size: 12px; color: var(--text-muted); }

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-header h3 { font-size: 14px; font-weight: 600; }
.card-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 20px; }

/* ===== TABLES ===== */
.table-responsive { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 12px; }

thead th {
    background: #f8fafc;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ===== BADGES ===== */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending   { background: #fef3c7; color: var(--warning); }
.badge-disetujui { background: #dcfce7; color: var(--success); }
.badge-ditolak   { background: #fee2e2; color: var(--danger); }

/* ===== MODALS ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 { font-size: 18px; font-weight: 700; }

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    text-decoration: none;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.4; display: block; }
.empty-state p { font-size: 15px; }

/* ===== SIDEBAR SUBMENU ===== */
.sidebar-menu .submenu {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.15);
}

.sidebar-menu .has-submenu.open .submenu { max-height: 300px; }

.sidebar-menu .submenu li a {
    padding: 8px 20px 8px 36px;
    font-size: 11px;
    color: #94a3b8;
}

.sidebar-menu .submenu li a:hover,
.sidebar-menu .submenu li a.active {
    color: white;
    background: rgba(37, 99, 235, 0.5);
    margin-right: 0;
}

.sidebar-menu .has-submenu > a { cursor: pointer; }

.toggle-icon {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.3s;
}

.sidebar-menu .has-submenu.open .toggle-icon { transform: rotate(180deg); }

/* ===== KARTU STOK TABLE ===== */
.kartu-table thead th { background: #14532d; color: white; font-size: 12px; }
.kartu-table tbody tr.row-masuk      { background: #f0fdf4; }
.kartu-table tbody tr.row-keluar     { background: #fff5f5; }
.kartu-table tbody tr.row-retur      { background: #fffbeb; }
.kartu-table tbody tr.row-penyesuaian { background: #f0f9ff; }

/* ===== PRINT STYLES ===== */
@media print {
    .sidebar,
    .navbar,
    .card-header .btn,
    .card-header form,
    .card-header .actions,
    form,
    .modal-overlay,
    .no-print { display: none !important; }

    .main-content { margin-left: 0 !important; }
    .content { padding: 0 !important; }

    body { font-size: 11px; }

    table { width: 100%; border-collapse: collapse; }

    thead th {
        background: #1e3a5f !important;
        color: white !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 6px 8px;
    }

    tbody td { padding: 5px 8px; border-bottom: 1px solid #ddd; }

    .stat-card,
    .stats-grid { display: none !important; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .content { padding: 16px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .modal { margin: 16px; }
}
