/* shared/style.css – BillEase Global Styles */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:     #2563eb;
  --primary-dk:  #1d4ed8;
  --success:     #16a34a;
  --warning:     #d97706;
  --danger:      #dc2626;
  --secondary:   #6b7280;
  --bg:          #f8fafc;
  --surface:     #ffffff;
  --border:      #e2e8f0;
  --text:        #1e293b;
  --text-muted:  #64748b;
  --radius:      8px;
  --shadow:      0 1px 3px rgba(0,0,0,.1);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* Layout */
.container  { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.page       { padding: 24px 0; }
.card       { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }

/* Nav */
.nav        { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 20px; display: flex; align-items: center; gap: 4px; height: 56px; position: sticky; top: 0; z-index: 100; }
.nav-brand  { font-size: 18px; font-weight: 700; color: var(--primary); margin-right: 16px; text-decoration: none; }
.nav-link   { padding: 8px 12px; border-radius: 6px; color: var(--text-muted); text-decoration: none; font-size: 13px; font-weight: 500; transition: all .15s; }
.nav-link:hover, .nav-link.active { background: #eff6ff; color: var(--primary); }

/* Buttons */
.btn        { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; font-size: 13px; font-weight: 500; transition: all .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--primary);   color: #fff; border-color: var(--primary); }
.btn-primary:hover  { background: var(--primary-dk); }
.btn-success  { background: var(--success);   color: #fff; }
.btn-success:hover  { background: #15803d; }
.btn-danger   { background: var(--danger);    color: #fff; }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--border); }
.btn-outline:hover  { background: var(--bg); }
.btn-sm       { padding: 4px 10px; font-size: 12px; }
.btn-lg       { padding: 12px 24px; font-size: 15px; }
.btn-block    { width: 100%; justify-content: center; }

/* Forms */
.form-group  { margin-bottom: 14px; }
.form-label  { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.form-control { width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 14px; color: var(--text); background: var(--surface); transition: border-color .15s; outline: none; }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
select.form-control { cursor: pointer; }

/* Tables */
.table-wrap  { overflow-x: auto; }
table        { width: 100%; border-collapse: collapse; }
th           { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 10px 12px; border-bottom: 2px solid var(--border); white-space: nowrap; }
td           { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td  { background: #f8fafc; }
.td-right    { text-align: right; }
.td-center   { text-align: center; }

/* Badges */
.badge           { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-success   { background: #dcfce7; color: #166534; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-danger    { background: #fee2e2; color: #991b1b; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-info      { background: #dbeafe; color: #1e40af; }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.stat-card  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); margin-top: 4px; }
.stat-value.green  { color: var(--success); }
.stat-value.red    { color: var(--danger); }
.stat-value.amber  { color: var(--warning); }

/* Toast notifications */
.toast { position: fixed; bottom: 24px; right: 24px; padding: 12px 20px; border-radius: var(--radius); color: #fff; font-size: 13px; font-weight: 500; z-index: 9999; animation: slideIn .25s ease; max-width: 320px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.toast-success  { background: var(--success); }
.toast-error    { background: var(--danger); }
.toast-warning  { background: var(--warning); }
@keyframes slideIn { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal          { background: var(--surface); border-radius: 12px; padding: 24px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header   { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title    { font-size: 16px; font-weight: 700; }
.modal-close    { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }

/* Misc */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.fw-bold     { font-weight: 700; }
.mt-16       { margin-top: 16px; }
.mt-24       { margin-top: 24px; }
.flex        { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.hidden      { display: none !important; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.low-stock-row td { background: #fff7ed !important; }
.out-stock-row td { background: #fff1f2 !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
@media (max-width: 640px) { .hide-mobile { display: none; } }
