/* ============================================================
   BILLINGPRO — Global Stylesheet
   ============================================================ */

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

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

:root {
  --primary:        #1e40af;
  --primary-hover:  #1d3a9e;
  --primary-light:  #dbeafe;
  --accent:         #0ea5e9;
  --success:        #10b981;
  --success-light:  #d1fae5;
  --danger:         #ef4444;
  --danger-light:   #fef2f2;
  --warning:        #f59e0b;
  --warning-light:  #fffbeb;
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  #1e293b;
  --sidebar-active: #1e40af;
  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --border:         #e2e8f0;
  --text:           #0f172a;
  --text-muted:     #64748b;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:      0 8px 40px rgba(30,64,175,0.13);
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font-family: 'Inter', sans-serif; }

/* LAYOUT */
.app-layout { display: flex; min-height: 100vh; }
.main-wrapper { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.page-content { padding: 28px; flex: 1; }

/* SIDEBAR */
.sidebar { width: 240px; background: var(--sidebar-bg); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto; }
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 36px; height: 36px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.brand-icon svg { width: 20px; height: 20px; }
.brand-name { font-size: 16px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.brand-sub { font-size: 10px; color: #94a3b8; margin-top: 1px; }
.sidebar-nav { padding: 16px 12px; flex: 1; }
.nav-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: #475569; padding: 0 8px; margin-bottom: 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: #94a3b8; font-size: 13.5px; font-weight: 500; transition: background 0.15s, color 0.15s; margin-bottom: 2px; cursor: pointer; text-decoration: none; }
.nav-item:hover { background: var(--sidebar-hover); color: #cbd5e1; }
.nav-item.active { background: var(--sidebar-active); color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.06); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 6px; }
.user-avatar { width: 34px; height: 34px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: #94a3b8; }
.logout-btn { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: #ef4444; background: none; border: none; cursor: pointer; font-size: 13px; font-weight: 500; width: 100%; transition: background 0.15s; }
.logout-btn:hover { background: rgba(239,68,68,0.1); }
.logout-btn svg { width: 16px; height: 16px; }

/* TOPBAR */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 28px; height: 58px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-date { font-size: 12px; color: var(--text-muted); }

/* PAGE HEADER */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.page-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
.breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.breadcrumb a { color: var(--primary); }
.breadcrumb span { margin: 0 6px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border-radius: 14px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }
.stat-icon.orange { background: #ffedd5; color: #ea580c; }
.stat-icon.green { background: #d1fae5; color: #059669; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13.5px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert a { font-weight: 600; color: var(--primary); }
.alert-warning { background: var(--warning-light); border: 1px solid #fde68a; color: #92400e; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error { background: var(--danger-light); border: 1px solid #fecaca; color: #b91c1c; }
.alert-info { background: var(--primary-light); border: 1px solid #bfdbfe; color: var(--primary); }

/* TABLE */
.table-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafc; padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 13px 16px; font-size: 13.5px; color: var(--text); border-bottom: 1px solid #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }
.empty-row { text-align: center !important; color: var(--text-muted) !important; padding: 40px !important; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-unpaid { background: #fef3c7; color: #92400e; }
.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-mono { font-family: monospace; font-size: 12px; background: #f1f5f9; padding: 3px 8px; border-radius: 6px; color: #475569; }
.badge-category { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--primary-light); color: var(--primary); }

/* ACTION BUTTONS */
.action-btns { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.btn-action { padding: 5px 12px; border-radius: 7px; font-size: 12px; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s; white-space: nowrap; }
.btn-action:hover { opacity: 0.75; }
.btn-action.edit { background: #eff6ff; color: #1d4ed8; }
.btn-action.delete { background: var(--danger-light); color: #b91c1c; }
.btn-action.view { background: #f0fdf4; color: #065f46; }
.btn-action.pay { background: #d1fae5; color: #065f46; }

/* BUTTONS */
.btn-primary { padding: 10px 20px; background: linear-gradient(135deg, var(--primary), #2563eb); color: #fff; border: none; border-radius: 9px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: opacity 0.15s, transform 0.1s; text-decoration: none; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-secondary { padding: 10px 20px; background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: 9px; font-size: 13.5px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: background 0.15s; text-decoration: none; }
.btn-secondary:hover { background: #f8fafc; }
.btn-sm { padding: 8px 16px !important; font-size: 13px !important; border-radius: 8px !important; }
.btn-ghost { padding: 8px 14px; background: transparent; color: var(--text-muted); border: none; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background 0.15s; }
.btn-ghost:hover { background: var(--border); }

/* FILTER */
.filter-bar { margin-bottom: 16px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.search-input { width: 100%; padding: 9px 14px 9px 36px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 13.5px; color: var(--text); background: var(--surface); outline: none; transition: border-color 0.15s; }
.search-input:focus { border-color: var(--primary); }
.filter-select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 13.5px; color: var(--text); background: var(--surface); outline: none; cursor: pointer; }
.tab-filters { display: flex; gap: 4px; }
.tab-btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-muted); background: transparent; border: 1px solid transparent; cursor: pointer; transition: background 0.15s, color 0.15s; }
.tab-btn:hover { background: var(--surface); color: var(--text); }
.tab-btn.active { background: var(--surface); color: var(--primary); font-weight: 600; border-color: var(--border); box-shadow: var(--shadow-sm); }

/* SECTION HEADER */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-size: 16px; font-weight: 600; color: var(--text); }
.link-more { font-size: 13px; color: var(--primary); font-weight: 500; cursor: pointer; text-decoration: none; }

/* FORM */
.form-card { background: var(--surface); border-radius: 14px; padding: 28px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 7px; }
.required { color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: -10px; margin-bottom: 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-section-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.form-input { width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: 9px; font-size: 13.5px; color: var(--text); background: #fafafa; outline: none; transition: border-color 0.15s, background 0.15s; resize: vertical; }
.form-input:focus { border-color: var(--primary); background: var(--surface); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 20px; border-top: 1px solid var(--border); margin-top: 8px; }

/* SETTINGS */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 24px; display: flex; align-items: center; gap: 16px; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s; text-decoration: none; color: inherit; }
.settings-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); transform: translateY(-1px); }
.settings-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.settings-icon svg { width: 24px; height: 24px; }
.settings-icon.blue { background: var(--primary-light); color: var(--primary); }
.settings-icon.purple { background: #ede9fe; color: #7c3aed; }
.settings-info { flex: 1; }
.settings-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.settings-desc { font-size: 13px; color: var(--text-muted); }
.settings-arrow { width: 20px; height: 20px; color: #cbd5e1; flex-shrink: 0; }

/* PRICE PREVIEW */
.price-preview { background: linear-gradient(135deg, #eff6ff, #dbeafe); border: 1px solid #bfdbfe; border-radius: 12px; padding: 20px; margin-bottom: 20px; display: none; align-items: center; gap: 24px; flex-wrap: wrap; }
.price-preview.show { display: flex; }
.price-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--primary); font-weight: 600; }
.price-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.price-note { font-size: 12px; color: #3b82f6; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast { padding: 13px 18px; border-radius: 10px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; min-width: 260px; animation: toastIn 0.3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.toast.success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.toast.error { background: var(--danger-light); border: 1px solid #fecaca; color: #b91c1c; }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }

/* LOADING */
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* UTILS */
.text-muted { color: var(--text-muted); }
.text-truncate { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-blue { color: var(--primary); text-decoration: none; font-size: 13px; }
.link-blue:hover { text-decoration: underline; }

/* LOGIN */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); background-image: radial-gradient(ellipse at 20% 50%, rgba(30,64,175,0.07) 0%, transparent 60%), radial-gradient(ellipse at 80% 20%, rgba(14,165,233,0.07) 0%, transparent 60%); padding: 24px 16px; }
.login-wrapper { width: 100%; max-width: 420px; }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo { width: 52px; height: 52px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; box-shadow: 0 4px 16px rgba(30,64,175,0.25); }
.login-logo svg { width: 28px; height: 28px; }
.login-brand-name { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.login-tagline { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-card { background: var(--surface); border-radius: 18px; padding: 36px 32px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.login-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }
.input-wrap { position: relative; }
.input-icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-muted); display: flex; pointer-events: none; }
.input-icon svg { width: 17px; height: 17px; }
.login-input { width: 100%; padding: 11px 14px 11px 40px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 14px; color: var(--text); background: #fafafa; outline: none; transition: border-color 0.15s, background 0.15s, box-shadow 0.15s; }
.login-input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px rgba(30,64,175,0.08); }
.toggle-pwd { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); display: flex; padding: 2px; }
.toggle-pwd:hover { color: var(--text); }
.toggle-pwd svg { width: 17px; height: 17px; }
.remember-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.checkbox-label input { accent-color: var(--primary); width: 15px; height: 15px; }
.btn-login { width: 100%; padding: 12px; background: linear-gradient(135deg, var(--primary), #2563eb); color: #fff; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: opacity 0.15s, transform 0.1s; }
.btn-login:hover { opacity: 0.92; transform: translateY(-1px); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.security-note { margin-top: 24px; padding: 12px; background: var(--primary-light); border-radius: 10px; font-size: 12px; color: var(--primary); display: flex; align-items: flex-start; gap: 8px; }
.security-note svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.login-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-muted); }

/* RESPONSIVE */
@media (max-width: 1024px) { .stats-grid { grid-template-columns: 1fr 1fr; } .form-row-3 { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .sidebar { display: none; } .main-wrapper { margin-left: 0; } .stats-grid { grid-template-columns: 1fr; } .form-row-2 { grid-template-columns: 1fr; } .settings-grid { grid-template-columns: 1fr; } .page-content { padding: 16px; } }
