/* === Sales Register - Modern UI === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg: #0f172a; --bg2: #1e293b; --bg3: #334155;
  --surface: rgba(30,41,59,.85); --surface2: rgba(51,65,85,.6);
  --border: rgba(148,163,184,.15); --border2: rgba(148,163,184,.25);
  --text: #f1f5f9; --text2: #94a3b8; --text3: #64748b;
  --accent: #3b82f6; --accent2: #2563eb; --accent-glow: rgba(59,130,246,.25);
  --green: #10b981; --green2: #059669; --red: #ef4444; --yellow: #f59e0b;
  --radius: 12px; --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }

/* === LOGIN === */
.login-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface); backdrop-filter: blur(20px); border: 1px solid var(--border);
  border-radius: 20px; padding: 40px; width: 100%; max-width: 420px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 28px; font-weight: 700; background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.login-logo p { color: var(--text2); font-size: 14px; margin-top: 4px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 15px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.form-input::placeholder { color: var(--text3); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border: none; border-radius: var(--radius-sm); font-family: inherit;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; outline: none;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), #6366f1); color: #fff; width: 100%; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 25px var(--accent-glow); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg3); }
.btn-danger { background: rgba(239,68,68,.15); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-xs { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 8px; min-width: 36px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.2); color: #fca5a5; }
.alert-success { background: rgba(16,185,129,.1); border: 1px solid rgba(16,185,129,.2); color: #6ee7b7; }

/* === MAIN LAYOUT === */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--surface); backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.app-header h1 { font-size: 18px; font-weight: 700; background: linear-gradient(135deg, #3b82f6, #8b5cf6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.user-badge {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  background: var(--surface2); border-radius: 20px; font-size: 13px; color: var(--text2);
}
.user-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #8b5cf6); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; }
.app-content { flex: 1; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }

/* === TABS === */
.tabs { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: var(--radius); margin-bottom: 24px; overflow-x: auto; }
.tab {
  padding: 10px 20px; border: none; background: transparent; color: var(--text2);
  font-family: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  border-radius: var(--radius-sm); transition: all .2s; white-space: nowrap;
}
.tab.active { background: var(--accent); color: #fff; }
.tab:hover:not(.active) { background: var(--surface2); color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* === CARDS === */
.card {
  background: var(--surface); backdrop-filter: blur(12px); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px; margin-bottom: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text2); margin-top: 2px; }

/* === UPLOAD ZONE === */
.upload-zone {
  border: 2px dashed var(--border2); border-radius: var(--radius); padding: 48px 24px;
  text-align: center; cursor: pointer; transition: all .3s;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-glow); }
.upload-zone svg { width: 48px; height: 48px; color: var(--text3); margin-bottom: 12px; }
.upload-zone p { color: var(--text2); font-size: 14px; }
.upload-zone .hint { font-size: 12px; color: var(--text3); margin-top: 4px; }
.upload-zone input { display: none; }

/* === TABLE === */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--bg2); }
th { padding: 10px 14px; text-align: left; font-weight: 600; color: var(--text2); white-space: nowrap; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(59,130,246,.04); }

/* === STATS === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; }
.stat-label { font-size: 12px; color: var(--text3); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-value.green { color: var(--green); }
.stat-value.blue { color: var(--accent); }
.stat-value.yellow { color: var(--yellow); }

/* === FORM GRID === */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }

/* === PARTY LIST === */
.party-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; transition: all .2s;
}
.party-item:hover { border-color: var(--accent); }
.party-item.selected { border-color: var(--accent); background: rgba(59,130,246,.08); }
.party-name { font-weight: 600; font-size: 14px; }
.party-meta { font-size: 12px; color: var(--text3); }
.party-actions { display: flex; gap: 4px; }

/* === VOUCHERS === */
.voucher-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 12px; overflow: hidden;
}
.voucher-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface2); cursor: pointer;
}
.voucher-number { font-weight: 600; font-size: 14px; }
.voucher-total { font-weight: 700; color: var(--green); }
.voucher-date { font-size: 12px; color: var(--text3); }
.voucher-body { padding: 0 16px 12px; display: none; }
.voucher-body.open { display: block; }

/* === MODAL === */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 500px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* === PROGRESS === */
.progress-bar { width: 100%; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #8b5cf6); border-radius: 3px; transition: width .3s; }

/* === SPINNER === */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 640px) {
  .app-header { padding: 10px 16px; }
  .app-content { padding: 16px; }
  .tabs { gap: 2px; }
  .tab { padding: 8px 14px; font-size: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
