﻿/* Wrap Web Design CMS — Global Styles (Light Theme) */
:root {
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --surface2:  #f1f5f9;
  --surface3:  #e2e8f0;
  --border:    #e2e8f0;
  --border2:   #f1f5f9;
  --text:      #0f172a;
  --text2:     #475569;
  --muted:     #94a3b8;
  --accent:    #0EA5B7;
  --accent2:   #12C7D8;
  --accent-bg: rgba(14,165,183,0.08);
  --success:   #16a34a;
  --warning:   #d97706;
  --error:     #dc2626;
  --info:      #2563eb;
  --radius:    12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow:    0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1), 0 2px 8px rgba(0,0,0,0.05);
  --sidebar-w: 280px;
  --sidebar-collapsed: 72px;
  --transition: 0.2s cubic-bezier(0.16,1,0.3,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Selection */
::selection { background: rgba(14,165,183,0.15); color: var(--text); }

/* Focus */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Typography */
h1,h2,h3,h4,h5,h6 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.3; color: var(--text); }
p { color: var(--text2); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* Utility */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.w-full { width: 100%; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--muted); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ── Status Badges ── */
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.65rem; border-radius: 100px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.badge-active   { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-inactive { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-expired  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-expiring { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.badge-draft    { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-sent     { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-paid     { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card:hover { border-color: #67e8f9; box-shadow: var(--shadow-md); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.25rem; border-radius: var(--radius-sm);
  font-size: 0.875rem; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none; transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, #0EA5B7, #12C7D8);
  color: #fff;
  box-shadow: 0 1px 3px rgba(14,165,183,0.3), 0 4px 12px rgba(14,165,183,0.15);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(14,165,183,0.35); }
.btn-secondary { background: #ffffff; color: #374151; border: 1px solid #d1d5db; }
.btn-secondary:hover { background: #f9fafb; border-color: #9ca3af; }
.btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; border-color: #f87171; }
.btn-ghost { background: transparent; color: #475569; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }
.btn-sm { padding: 0.375rem 0.875rem; font-size: 0.8rem; }
.btn-icon { padding: 0.5rem; border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── Form Elements ── */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block; font-size: 0.8rem; font-weight: 500;
  color: #374151; margin-bottom: 0.4rem; letter-spacing: 0.01em;
}
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 0.65rem 0.875rem;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  color: #0f172a;
  font-size: 0.875rem; font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #0EA5B7;
  box-shadow: 0 0 0 3px rgba(14,165,183,0.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: #9ca3af; }
.form-select { appearance: none; cursor: pointer; background-color: #ffffff; }
.form-textarea { resize: vertical; min-height: 80px; }

/* ── Table ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  padding: 0.75rem 1rem; text-align: left;
  font-size: 0.72rem; font-weight: 600; color: #64748b;
  letter-spacing: 0.05em; text-transform: uppercase;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a;
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { background: #ffffff; transition: background var(--transition); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .checkbox-col { width: 40px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: 1.5rem 1.5rem 0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1.05rem; font-weight: 600; color: #0f172a; }
.modal-body { padding: 1.5rem; }
.modal-footer { padding: 0 1.5rem 1.5rem; display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ── Toast ── */
.toast-container {
  position: fixed; top: 1.25rem; right: 1.25rem;
  z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  padding: 0.875rem 1.25rem; border-radius: var(--radius);
  font-size: 0.85rem; font-weight: 500;
  display: flex; align-items: center; gap: 0.6rem;
  min-width: 280px; max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1), 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid; pointer-events: all;
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
}
.toast-success { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.toast-error   { background: #fef2f2; border-color: #fecaca; color: #dc2626; }
.toast-warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.toast-info    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(20px); } }

/* ── Confirm Dialog ── */
.confirm-dialog .modal { max-width: 400px; }
.confirm-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto 1rem;
}
.confirm-icon.danger  { background: #fef2f2; color: #dc2626; }
.confirm-icon.warning { background: #fffbeb; color: #d97706; }

/* ── Pagination ── */
.pagination { display: flex; align-items: center; gap: 0.5rem; }
.page-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 500; cursor: pointer;
  background: #ffffff; border: 1px solid #e2e8f0; color: #475569;
  transition: all var(--transition);
}
.page-btn:hover { background: #f1f5f9; color: #0f172a; border-color: #cbd5e1; }
.page-btn.active { background: #0EA5B7; border-color: #0EA5B7; color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Search Bar ── */
.search-bar { position: relative; display: flex; align-items: center; }
.search-bar svg { position: absolute; left: 0.75rem; color: #9ca3af; pointer-events: none; }
.search-bar input { padding-left: 2.25rem; }

/* ── Empty State ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4rem 2rem; gap: 1rem; text-align: center;
}
.empty-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: #f1f5f9; display: flex; align-items: center; justify-content: center;
  color: #94a3b8;
}
.empty-title { font-size: 1rem; font-weight: 600; color: #0f172a; }
.empty-desc { font-size: 0.875rem; color: #64748b; max-width: 300px; }

/* ── Stat Cards ── */
.stat-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: 0.5rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.stat-card:hover { border-color: #67e8f9; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-label { font-size: 0.75rem; font-weight: 500; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; }
.stat-change { font-size: 0.75rem; color: #94a3b8; }

/* ── Spin animation ── */
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMI Status Badges ── */
.badge-overdue    { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-completed  { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.badge-cancelled  { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }
.badge-cash         { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-upi          { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-card         { background: #faf5ff; color: #7c3aed; border: 1px solid #e9d5ff; }
.badge-bank_transfer{ background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }
}

/* ── Responsive Utilities ─────────────────────────────────── */

/* Prevent horizontal overflow site-wide */
html, body { max-width: 100%; overflow-x: hidden; }

/* Table scroll containers */
.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Responsive grid helpers */
.grid-responsive-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-responsive-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

@media (max-width: 1023px) {
  .grid-responsive-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  .grid-responsive-2,
  .grid-responsive-3 { grid-template-columns: 1fr; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}

/* Form responsive */
@media (max-width: 767px) {
  .form-input, .form-select, .form-textarea {
    font-size: 1rem; /* Prevent iOS zoom */
  }
  .btn { white-space: normal; text-align: center; }
}

/* Stack flex rows on mobile */
@media (max-width: 767px) {
  .flex-mobile-col { flex-direction: column !important; }
  .flex-mobile-col > * { width: 100% !important; min-width: 0 !important; }
}
