/* ============================================
   List Asset RMA - Enterprise Design System (PDDikti Style)
   ============================================ */

:root {
    --primary: #4f46e5; /* Professional Indigo */
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --secondary: #3b82f6; /* Blue accent */
    
    --bg-body: #f8f9fa; /* Light gray background */
    --bg-surface: #ffffff; /* White cards */
    
    --text-main: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    
    --font-family: 'Inter', -apple-system, sans-serif;
    --transition: 200ms ease;
}

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-family); background: var(--bg-body); color: var(--text-main); line-height: 1.5; -webkit-font-smoothing: antialiased; }

/* ---- Utilities ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border: none; border-radius: var(--radius-sm); font-family: var(--font-family); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all var(--transition); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: var(--shadow-sm); }
.btn-secondary { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f3f4f6; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: #f3f4f6; color: var(--text-main); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: #fca5a5; }
.btn-warning { background: #fef3c7; color: var(--warning); }

/* ---- Form Inputs ---- */
input, select, textarea { width: 100%; padding: 10px 14px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-main); font-family: var(--font-family); font-size: 0.875rem; transition: border-color var(--transition); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: 3px solid var(--primary-light); }
input::placeholder, textarea::placeholder { color: #9ca3af; }

/* ---- Landing & Login Screen ---- */
.landing-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; position: fixed; inset: 0; background: #fff; z-index: 1000; text-align: center; }
.login-screen { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: var(--bg-body); }
.login-card { width: 100%; max-width: 420px; padding: 40px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo-icon { width: 56px; height: 56px; background: var(--primary); border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; color: white; margin-bottom: 16px; }
.login-logo h1 { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.login-logo p { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }
.login-field { margin-bottom: 20px; }
.login-field label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.login-input-wrap { position: relative; display: flex; align-items: center; }
.login-input-wrap > svg { position: absolute; left: 14px; color: #9ca3af; pointer-events: none; }
.login-input-wrap input { padding-left: 40px; border-radius: var(--radius-md); }
.toggle-password { position: absolute; right: 10px; background: none; border: none; color: #9ca3af; cursor: pointer; padding: 4px; display: flex; }
.toggle-password:hover { color: var(--text-main); }
.login-error { font-size: 0.875rem; color: var(--danger); min-height: 20px; margin-bottom: 8px; text-align: center; font-weight: 500; }
.login-btn { width: 100%; padding: 12px; font-size: 1rem; border-radius: var(--radius-md); }
.login-footer { text-align: center; margin-top: 24px; font-size: 0.75rem; color: var(--text-muted); }
.login-lockout { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; background: #fee2e2; border-radius: var(--radius-sm); color: var(--danger); font-size: 0.875rem; margin-bottom: 12px; }

/* ---- Top Navbar ---- */
.top-navbar { background: #ffffff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; box-shadow: var(--shadow-sm); }
.nav-container { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 72px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-main); flex-shrink: 0; }
.nav-logo svg { color: var(--primary); }
.nav-logo span { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.025em; }
.nav-links { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.nav-tab { background: transparent; border: none; padding: 8px 16px; border-radius: var(--radius-full); font-size: 0.875rem; font-weight: 500; color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.nav-tab:hover { color: var(--text-main); background: #f3f4f6; }
.nav-tab.active { background: var(--primary-light); color: var(--primary-hover); }
.nav-right { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.nav-user { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 500; color: var(--text-secondary); padding-right: 16px; border-right: 1px solid var(--border); }

/* ---- Hero Banner ---- */
.hero-banner { background: linear-gradient(135deg, #4f46e5, #7c3aed); padding: 48px 24px; color: white; text-align: center; }
.hero-content { max-width: 800px; margin: 0 auto; }
.hero-content h2 { font-size: 2.25rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.025em; text-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.hero-content p { font-size: 1.125rem; opacity: 0.9; line-height: 1.6; }

/* ---- Main Content ---- */
.main-content { max-width: 1280px; margin: -30px auto 60px; padding: 0 24px; position: relative; z-index: 10; }
.tab-content { display: none; background: #ffffff; border-radius: var(--radius-lg); box-shadow: var(--shadow-md); border: 1px solid var(--border); padding: 32px; min-height: 500px; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---- Dashboard Grid ---- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; margin-bottom: 40px; }
.stat-card { display: flex; align-items: center; gap: 20px; padding: 24px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); transition: transform var(--transition); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-blue { background: #eff6ff; color: #3b82f6; }
.stat-green { background: #ecfdf5; color: #10b981; }
.stat-purple { background: #f5f3ff; color: #8b5cf6; }
.stat-orange { background: #fffbeb; color: #f59e0b; }
.stat-red { background: #fef2f2; color: #ef4444; }
.stat-info h3 { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 4px; font-weight: 600; }
.stat-info p { font-size: 1.75rem; font-weight: 700; color: var(--text-main); line-height: 1; }
.dashboard-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(450px, 1fr)); gap: 24px; }
.chart-container { background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; box-shadow: var(--shadow-sm); }
.chart-container h3 { font-size: 1.125rem; font-weight: 600; margin-bottom: 24px; color: var(--text-main); }
.canvas-wrapper { position: relative; height: 320px; width: 100%; display: flex; align-items: center; justify-content: center; }

/* ---- Toolbar (Search & Filter) ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 30px; flex-wrap: wrap; background: #f9fafb; padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--border); }
.toolbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 280px; }
.toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; max-width: 400px; }
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; }
.search-box input { padding-left: 44px; padding-top: 12px; padding-bottom: 12px; border-radius: var(--radius-md); font-size: 0.9375rem; }
.filter-box select { padding-top: 12px; padding-bottom: 12px; border-radius: var(--radius-md); font-size: 0.9375rem; cursor: pointer; }

/* ---- Lists & Cards ---- */
.asset-list { display: flex; flex-direction: column; gap: 16px; }
.asset-card { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition); box-shadow: var(--shadow-sm); }
.asset-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.asset-card-left { display: flex; align-items: center; gap: 20px; }
.asset-card-icon { width: 48px; height: 48px; background: #eff6ff; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--secondary); }
.asset-card-info h3 { font-size: 1.125rem; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }
.asset-card-info .asset-device-type { font-size: 0.875rem; color: var(--text-secondary); }
.bast-card-dept { font-size: 0.8125rem; color: var(--primary); font-weight: 500; background: var(--primary-light); padding: 2px 8px; border-radius: var(--radius-full); margin-top: 4px; display: inline-block; }
.asset-card-right { display: flex; align-items: center; gap: 24px; }
.asset-card-updated { text-align: right; }
.update-label { font-size: 0.75rem; color: #9ca3af; text-transform: uppercase; font-weight: 500; }
.update-date { font-size: 0.9375rem; font-weight: 500; color: var(--text-main); }
.asset-card-arrow { color: #d1d5db; transition: color var(--transition); }
.asset-card:hover .asset-card-arrow { color: var(--primary); }

/* ---- Modals ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.4); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 200; opacity: 0; visibility: hidden; transition: all var(--transition); padding: 20px; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: #ffffff; border-radius: var(--radius-lg); width: 100%; max-width: 760px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); transform: translateY(20px) scale(0.98); transition: transform var(--transition); }
.modal-overlay.active .modal { transform: translateY(0) scale(1); }
.modal-bast-form { max-width: 820px; }
.modal-bast-detail { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 32px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #ffffff; z-index: 10; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--text-main); }
.modal-close { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: #f3f4f6; border: none; border-radius: var(--radius-sm); color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.modal-close:hover { background: #fee2e2; color: var(--danger); }
.modal-body { padding: 32px; }

/* ---- Form Layouts ---- */
.form-section { margin-bottom: 32px; }
.form-section-title { font-size: 0.875rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 20px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group.full-width { grid-column: 1/-1; }
.required { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 16px; padding-top: 24px; border-top: 1px solid var(--border); margin-top: 32px; }

/* ---- Detail Views ---- */
.detail-top { display: flex; gap: 32px; align-items: flex-start; margin-bottom: 32px; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.qr-container { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.qr-code-box { background: white; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); width: 180px; height: 180px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.qr-asset-code { font-size: 1rem; font-weight: 700; color: var(--text-main); }
.detail-summary { display: flex; flex-direction: column; gap: 12px; justify-content: center; height: 100%; }
.detail-asset-code { font-size: 1.75rem; font-weight: 800; color: var(--text-main); }
.detail-device-badge { display: inline-flex; padding: 6px 16px; background: var(--primary-light); color: var(--primary); border-radius: var(--radius-full); font-size: 0.875rem; font-weight: 600; width: fit-content; }
.detail-last-updated { font-size: 0.875rem; color: var(--text-muted); }
.detail-section { background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; margin-bottom: 24px; }
.detail-section-title { font-size: 0.8125rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.detail-field { display: flex; flex-direction: column; gap: 6px; }
.detail-field-label { font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; }
.detail-field-value { font-size: 1rem; color: var(--text-main); font-weight: 600; }
.detail-field-value.empty { color: #9ca3af; font-style: italic; font-weight: 400; }
.detail-actions { display: flex; gap: 16px; padding-top: 24px; border-top: 1px solid var(--border); margin-top: 32px; }

/* ---- Empty States ---- */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 80px 20px; text-align: center; }
.empty-icon { color: #d1d5db; margin-bottom: 20px; }
.empty-state h3 { font-size: 1.25rem; font-weight: 600; color: var(--text-main); margin-bottom: 12px; }
.empty-state p { color: var(--text-muted); font-size: 1rem; margin-bottom: 32px; max-width: 400px; }

/* ---- Upload & Scanner ---- */
.upload-area { display: flex; align-items: center; gap: 16px; }
.upload-status { font-size: 0.875rem; color: var(--success); font-weight: 600; }
.qr-reader { width: 100%; border-radius: var(--radius-md); overflow: hidden; border: 1px solid var(--border); }

/* ---- Toasts ---- */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 12px; }
.toast { display: flex; align-items: center; gap: 16px; padding: 16px 24px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); animation: slideIn 0.3s ease; }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--secondary); }
.toast-message { font-size: 0.9375rem; font-weight: 500; color: var(--text-main); }
@keyframes slideIn { from{transform:translateX(100%);opacity:0} to{transform:translateX(0);opacity:1} }

/* ---- Public Scan ---- */
.public-scan-screen { position: fixed; inset: 0; background: var(--bg-body); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.scan-card { background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 48px; max-width: 480px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.scan-icon { width: 80px; height: 80px; background: #ecfdf5; color: var(--success); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 32px; }
.scan-card h2 { font-size: 1.75rem; font-weight: 700; color: var(--text-main); margin-bottom: 32px; }
.scan-details { text-align: left; background: #f9fafb; border: 1px solid var(--border); padding: 32px; border-radius: var(--radius-md); display: flex; flex-direction: column; gap: 20px; }
.scan-row { display: flex; flex-direction: column; }
.scan-row span { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.scan-row strong { font-size: 1.125rem; color: var(--text-main); font-weight: 600; }

/* ---- Print ---- */
@media print {
    @page { margin: 0; }
    body { padding: 20px; }
    body > *:not(#qrPrintArea) { display: none !important; visibility: hidden !important; }
    #qrPrintArea { display: flex !important; visibility: visible !important; align-items: center; justify-content: center; width: 100vw; height: 100vh; background: #fff; margin: 0; padding: 0; }
}
.qr-print-wrap { text-align: center; padding: 32px; border: 1px solid var(--border); border-radius: 12px; background: #fff; font-family: sans-serif; }
.qr-print-org { font-size: 0.75rem; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 24px; font-weight: 600; }
.qr-print-img { width: 200px; height: 200px; display: block; margin: 0 auto 24px; }
.qr-print-code { font-size: 1.25rem; font-weight: 700; color: var(--text-main); margin-bottom: 8px; }

/* ---- User Management Cards ---- */
.user-card { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; background: #ffffff; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.user-info-left { display: flex; align-items: center; gap: 16px; }
.user-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-light); color: var(--primary); font-weight: 700; font-size: 0.875rem; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-details h4 { font-size: 1rem; font-weight: 600; color: var(--text-main); margin-bottom: 2px; }
.user-role { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 10px; border-radius: var(--radius-full); }
.user-role.admin { background: #dbeafe; color: #1d4ed8; }
.user-role.viewer { background: #f3e8ff; color: #7c3aed; }

/* ---- Scanner ---- */
.scan-hint { text-align: center; color: var(--text-muted); font-size: 0.875rem; padding: 12px 0; }
.modal-scanner { max-width: 480px; }
.modal-scan-result { max-width: 480px; }
.modal-delete { max-width: 440px; }
.scan-result-content { text-align: center; padding: 24px 0; }
.scan-result-icon { color: var(--success); margin-bottom: 16px; }
.scan-result-item { font-size: 1rem; }
.scan-result-value { font-weight: 600; color: var(--text-main); }
.scan-result-actions { display: flex; gap: 12px; justify-content: center; padding-top: 24px; }
.delete-warning { text-align: center; padding: 24px 0; }
.delete-warning svg { color: var(--danger); margin-bottom: 16px; }
.delete-warning p { font-size: 1rem; color: var(--text-main); }
.delete-subtext { font-size: 0.875rem; color: var(--text-muted); margin-top: 8px; }
.delete-actions { display: flex; gap: 12px; justify-content: center; padding-top: 16px; }

/* ---- Settings ---- */
.settings-container h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-main); }
.settings-header p { color: var(--text-muted); font-size: 0.875rem; margin-top: 4px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .nav-container { flex-direction: column; height: auto; padding: 16px; gap: 20px; }
    .nav-links { flex-wrap: wrap; justify-content: center; }
    .nav-right { flex-direction: column; width: 100%; border-top: 1px solid var(--border); padding-top: 16px; }
    .nav-user { border-right: none; padding-right: 0; }
    .hero-banner { padding: 40px 16px; }
    .hero-content h2 { font-size: 1.75rem; }
    .toolbar { flex-direction: column; align-items: stretch; padding: 20px; }
    .toolbar-left, .toolbar-right { flex-direction: column; }
    .search-box { max-width: 100%; }
    .btn { width: 100%; justify-content: center; }
    .form-grid, .detail-grid { grid-template-columns: 1fr; }
    .detail-top { flex-direction: column; align-items: center; text-align: center; }
}
