/* === CSS Variables & Theming (Premium Dark/Glassmorphism Theme) === */
:root {
    --bg-color: #0f172a; /* Deep modern dark blue */
    --surface: rgba(30, 41, 59, 0.7); /* Translucent dark */
    --surface-solid: #1e293b;
    --primary: #3b82f6; /* Vibrant blue */
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #10b981;
    --border: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(59, 130, 246, 0.5);
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-glass: 0 4px 30px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* === Layout & Containers === */
.container {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
}
.pb-20 { padding-bottom: 80px; }
.mt-10 { margin-top: 10px; }

/* === Glassmorphism Effects === */
.glass, .glass-card, .glass-container {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-glass);
}
.glass-card {
    border-radius: var(--radius);
    padding: 24px;
}

/* === Login Specific === */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container {
    width: 90%;
    max-width: 400px;
    padding: 40px 30px;
    border-radius: 16px;
    text-align: center;
}
.logo h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    background: -webkit-linear-gradient(#60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* === Top Nav === */
.top-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
}
.nav-content {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-info { font-weight: 500; }
.btn-logout {
    color: var(--danger);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* === Typography & Headings === */
.form-title {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

/* === Form Elements === */
.input-group {
    margin-bottom: 16px;
    text-align: left;
}
.input-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}
.required { color: var(--danger); }

input[type="text"], input[type="number"], select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}
input:focus, select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
.readonly-input {
    background: rgba(0, 0, 0, 0.2) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
}

/* === Custom Form Components === */
.barcode-wrapper {
    display: flex;
    gap: 8px;
}
.barcode-wrapper input {
    flex: 1;
}
.btn-scan {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-scan:active { background: rgba(255,255,255,0.1); }

.row-flex {
    display: flex;
    gap: 12px;
}
.col-half { flex: 1; }

.counter-wrapper {
    display: flex;
    align-items: center;
}
.btn-counter {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.btn-counter:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-counter:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.counter-wrapper input {
    border-radius: 0;
    border-left: none;
    border-right: none;
    text-align: center;
    padding: 12px 8px;
}

/* === Buttons === */
.btn {
    display: inline-block;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
    padding: 12px 20px; /* Tambahkan padding default agar tidak pipih */
    font-size: 15px;
    letter-spacing: 0.5px;
}
.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); /* Efek gradien premium */
    color: #fff;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4); /* Efek bayangan (glow) */
}
.btn-primary:hover { 
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
    transform: translateY(-1px);
}
.btn-block { width: 100%; }
.btn-lg { padding: 16px; font-size: 16px; }

.shadow-pulse:active {
    transform: scale(0.98);
}

/* === Alerts & Status === */
.alert {
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
}
.alert-error { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.alert-success { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }
.hidden { display: none !important; }

.offline-badge {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245, 158, 11, 0.9);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 100;
}

/* === Modal Scanner === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}
.modal-content {
    margin: 10% auto;
    width: 90%;
    max-width: 400px;
    position: relative;
    padding: 20px;
}
.close-modal {
    position: absolute;
    right: 15px;
    top: 10px;
    color: var(--text-muted);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.modal-help {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
}
#reader {
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
}

/* === Autocomplete === */
.autocomplete-wrapper {
    position: relative;
    /* Pastikan wrapper ini punya prioritas tinggi saat tumpah ke bawah */
    z-index: 9999; 
}
.autocomplete-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-focus);
    border-radius: var(--radius-sm);
    max-height: 220px;
    overflow-y: auto;
    z-index: 99999; /* Memaksa melayang di atas elemen lain */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.autocomplete-item {
    padding: 10px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.autocomplete-item:last-child {
    border-bottom: none;
}
.autocomplete-item:hover {
    background: rgba(59, 130, 246, 0.2);
}
.autocomplete-item-title {
    font-weight: 600;
    color: var(--text-main);
}
.autocomplete-item-barcode {
    font-size: 12px;
    color: var(--text-muted);
}
