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

:root {
    --bg-dark: #0b1120;
    --bg-panel: #111827;
    --bg-card: #1f2937;
    --border: #374151;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #8b5cf6;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background-color: var(--bg-dark); color: var(--text-main); font-size: 14px; }
.hidden { display: none !important; }

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── TYPOGRAPHY & UTILITIES ─── */
h1, h2, h3, h4 { font-weight: 700; color: #fff; }
.text-cyan { color: #06b6d4; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 700; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }

/* ─── BUTTONS ─── */
.btn { padding: 8px 16px; border-radius: 6px; font-weight: 500; cursor: pointer; border: none; outline: none; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); color: white; }
.btn-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid var(--warning); }
.btn-warning:hover { background: var(--warning); color: white; }
.btn-info { background: rgba(59, 130, 246, 0.1); color: var(--primary); border: 1px solid var(--primary); }
.btn-info:hover { background: var(--primary); color: white; }
.btn-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }

/* ─── FORMS ─── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--text-muted); }
.req { color: var(--danger); }
.form-input, .form-select, textarea { width: 100%; padding: 10px 12px; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 6px; color: white; font-family: inherit; font-size: 14px; transition: 0.2s; }
.form-input:focus, .form-select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); }
.input-icon-wrap { position: relative; }
.toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-muted); cursor: pointer; }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); color: #fca5a5; padding: 10px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; text-align: center; }

/* ─── LOGIN SCREEN ─── */
.login-screen { position: fixed; inset: 0; background: radial-gradient(circle at center, #111827 0%, #030712 100%); display: flex; align-items: center; justify-content: center; z-index: 2000; }
.login-card { background: var(--bg-panel); border: 1px solid var(--border); padding: 40px; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon { width: 48px; height: 48px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; color: white; margin-bottom: 16px; }
.login-logo h1 { font-size: 24px; margin-bottom: 8px; }
.login-logo p { color: var(--text-muted); font-size: 13px; margin-bottom: 12px; }
.iso-badge { background: rgba(16, 185, 129, 0.1); color: var(--success); border: 1px solid var(--success); padding: 4px 8px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.login-demo-info { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.demo-accounts { display: flex; gap: 8px; margin-top: 8px; }
.demo-btn { flex: 1; padding: 6px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-muted); border-radius: 4px; cursor: pointer; font-size: 11px; transition: 0.2s; }
.demo-btn:hover { background: var(--border); color: white; }

/* ─── APP SHELL & SIDEBAR ─── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; background: var(--bg-panel); border-right: 1px solid var(--border); display: flex; flex-direction: column; transition: 0.3s; }
.sidebar.collapsed { width: 80px; }
.sidebar.collapsed .logo-text, .sidebar.collapsed .nav-item span, .sidebar.collapsed .nav-section-label, .sidebar.collapsed .user-info > div { display: none; }
.sidebar-header { padding: 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }
.sidebar-logo .logo-icon { width: 32px; height: 32px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; }
.logo-text { font-size: 18px; font-weight: 800; color: white; }
.sidebar-toggle { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section-label { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 12px 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: var(--text-muted); text-decoration: none; border-radius: 8px; font-weight: 500; margin-bottom: 4px; transition: 0.2s; cursor: pointer; }
.nav-item i { width: 20px; text-align: center; font-size: 16px; }
.nav-item:hover, .nav-item.active { background: rgba(59, 130, 246, 0.1); color: var(--primary); }
.nav-item.active { font-weight: 600; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar { width: 36px; height: 36px; background: var(--secondary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; }
.user-name { font-size: 13px; font-weight: 600; color: white; margin-bottom: 2px; }
.user-role { font-size: 11px; color: var(--text-muted); }
.btn-logout { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px; border-radius: 6px; transition: 0.2s; }
.btn-logout:hover { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

/* ─── MAIN CONTENT ─── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 32px; background: var(--bg-dark); }
.topbar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 32px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.page-title { font-size: 24px; color: white; margin-bottom: 4px; }
.breadcrumb { font-size: 12px; color: var(--text-muted); }
.topbar-right { text-align: right; }
.topbar-time { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }

/* ─── PAGE ROUTING ─── */
.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ─── CARDS ─── */
.glass-card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.card-header h3 { font-size: 15px; color: white; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--primary); }

/* ─── DASHBOARD ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--bg-panel); border: 1px solid var(--border); padding: 20px; border-radius: 12px; position: relative; overflow: hidden; transition: 0.2s; }
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-icon { position: absolute; right: 20px; top: 20px; font-size: 24px; opacity: 0.2; }
.stat-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: white; font-family: 'JetBrains Mono', monospace; }
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
.chart-card { min-height: 300px; display: flex; flex-direction: column; }
.chart-container { flex: 1; position: relative; min-height: 200px; }
.freezer-list { display: flex; flex-direction: column; gap: 16px; }
.freezer-item .freezer-info { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: white; }
.freezer-bar-track { height: 8px; background: var(--bg-dark); border-radius: 4px; overflow: hidden; }
.freezer-bar-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.bottom-row { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }

/* ─── TABLES ─── */
.table-wrap { overflow-x: auto; margin: -24px; margin-top: 0; padding: 24px; padding-top: 0; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-main); }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-virus { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-bakteri { background: rgba(59, 130, 246, 0.1); color: var(--primary); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-parasit { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-excellent { background: rgba(16, 185, 129, 0.1); color: var(--success); }
.badge-good { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-degraded { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

/* ─── ACTIVITY FEED ─── */
.activity-feed { display: flex; flex-direction: column; gap: 16px; }
.activity-item { display: flex; gap: 12px; position: relative; padding-left: 16px; }
.activity-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--border); }
.activity-dot { position: absolute; left: -3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--text-muted); }
.activity-text { font-size: 13px; color: var(--text-main); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─── PAGE SPECIFIC: INVENTORY ─── */
.page-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding: 16px; }
.toolbar-filters { display: flex; gap: 12px; }

/* ─── PAGE SPECIFIC: STORAGE ─── */
.freezer-summary-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.freezer-summary-card { padding: 16px; min-width: 150px; }
.storage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 8px; margin-top: 16px; }
.storage-cell { aspect-ratio: 1; background: var(--bg-dark); border: 1px solid var(--border); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text-muted); position: relative; cursor: pointer; transition: 0.2s; }
.storage-cell:hover { border-color: var(--primary); }
.storage-cell.occupied { background: rgba(59, 130, 246, 0.1); border-color: var(--primary); color: var(--primary); }
.cell-status { position: absolute; bottom: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; }
.storage-legend { display: flex; gap: 16px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-empty { background: var(--bg-dark); border: 1px solid var(--border); }
.dot-excellent { background: var(--success); }
.dot-good { background: var(--warning); }
.dot-degraded { background: var(--danger); }

/* ─── MODALS ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.modal-box { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.modal-lg { max-width: 900px; }
.modal-sm { max-width: 400px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.btn-close { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; }
.btn-close:hover { color: white; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 12px; background: rgba(0,0,0,0.1); }

/* Tabs */
.form-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.form-tab { padding: 10px 16px; background: none; border: none; color: var(--text-muted); font-weight: 500; font-size: 13px; cursor: pointer; border-bottom: 2px solid transparent; transition: 0.2s; }
.form-tab:hover { color: white; }
.form-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.form-tab-content { display: none; }
.form-tab-content.active { display: block; animation: fadeIn 0.3s; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.info-box { background: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.2); padding: 12px; border-radius: 6px; font-size: 13px; color: var(--text-muted); display: flex; gap: 8px; margin-bottom: 16px; }

/* Detail Modal */
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.detail-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.detail-field label { display: block; font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.detail-field div { font-size: 14px; font-weight: 500; }
.detail-section { margin-bottom: 24px; }
.detail-section h4 { font-size: 13px; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 12px; }
.qr-container { background: var(--bg-dark); border: 1px solid var(--border); padding: 20px; border-radius: 12px; text-align: center; margin-bottom: 20px; }
.qr-container h4 { font-size: 13px; margin-bottom: 16px; color: var(--text-muted); }
.qr-container canvas { margin: 0 auto; border-radius: 8px; background: white; padding: 4px; }
.qr-code-label { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 700; margin-top: 12px; letter-spacing: 1px; }

/* TOAST */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: 8px; background: var(--bg-card); border: 1px solid var(--border); color: white; display: flex; align-items: center; gap: 12px; z-index: 9999; box-shadow: 0 10px 25px rgba(0,0,0,0.5); animation: slideUp 0.3s; }
.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
@keyframes slideUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
