/* ============================================================
   AMBAL FINACERIES — Pawn Broker Management System
   assets/css/style.css
   Theme: Refined luxury — deep navy + gold accent
   ============================================================ */

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

/* ---- Variables ---- */
:root {
  --navy:        #0d1b2a;
  --navy-mid:    #152338;
  --navy-light:  #1e3050;
  --gold:        #c9a84c;
  --gold-light:  #e2c97e;
  --gold-pale:   #f5edd8;
  --cream:       #faf8f3;
  --white:       #ffffff;
  --text:        #1a2637;
  --text-mid:    #4a5568;
  --text-light:  #718096;
  --border:      #e2ddd0;
  --border-dark: #c4bfb2;
  --success:     #2e7d52;
  --success-bg:  #e8f5ee;
  --danger:      #c0392b;
  --danger-bg:   #fdecea;
  --warning:     #b7770d;
  --warning-bg:  #fef9e7;
  --info:        #1a5c8e;
  --info-bg:     #e8f4fd;
  --shadow-sm:   0 1px 3px rgba(13,27,42,0.08);
  --shadow-md:   0 4px 16px rgba(13,27,42,0.12);
  --shadow-lg:   0 8px 32px rgba(13,27,42,0.16);
  --radius:      10px;
  --radius-sm:   6px;
  --radius-lg:   16px;
  --transition:  0.2s ease;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); }

/* ---- Sidebar Navigation ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 28px 20px 20px;
  border-bottom: 1px solid rgba(201,168,76,0.2);
}
.sidebar-logo .shop-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.3;
}
.sidebar-logo .app-sub {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
  margin-top: 4px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.nav-section-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 14px 20px 6px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  font-size: 0.88rem;
  font-weight: 400;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.sidebar-nav a:hover {
  color: var(--gold-light);
  background: rgba(201,168,76,0.08);
  border-left-color: rgba(201,168,76,0.4);
}
.sidebar-nav a.active {
  color: var(--gold);
  background: rgba(201,168,76,0.12);
  border-left-color: var(--gold);
  font-weight: 600;
}
.sidebar-nav a .nav-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.25);
}

/* ---- Main content ---- */
.main-content {
  margin-left: 240px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
}
.topbar-date {
  font-size: 0.8rem;
  color: var(--text-light);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--navy);
  margin: 5px 0;
  border-radius: 2px;
  transition: all 0.3s;
}

.page-body {
  padding: 28px;
  flex: 1;
}

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--gold);
  border-radius: 2px;
}
.card-body { padding: 24px; }

/* ---- Summary Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
  background: var(--gold);
}
.stat-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 6px;
}
.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.stat-card.gold::before { background: var(--gold); }
.stat-card.green::before { background: var(--success); }
.stat-card.red::before { background: var(--danger); }
.stat-card.blue::before { background: var(--info); }

/* ---- Forms ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-mid);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  padding: 9px 13px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
.form-control::placeholder { color: var(--text-light); opacity: 0.8; }

textarea.form-control { resize: vertical; min-height: 80px; }

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23718096'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
  cursor: pointer;
}

/* Smart single-field translation */
.smart-field-wrap {
  position: relative;
}
.smart-field-wrap .form-control {
  padding-right: 36px;
}
.translation-status {
  font-size: 0.71rem;
  padding: 2px 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
  margin-top: 3px;
}
.translation-status.translating { color: #7c3aed; }
.translation-status.success     { color: var(--success); }
.translation-status.error       { color: var(--danger); }
.translation-status.warning     { color: var(--warning); }
.tamil-hint {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  background: #f0e6ff;
  color: #7c3aed;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  margin-left: 6px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--gold);
  color: var(--navy);
}
.btn-primary:hover {
  background: var(--gold-light);
  box-shadow: 0 4px 14px rgba(201,168,76,0.35);
  color: var(--navy);
}
.btn-secondary {
  background: var(--white);
  color: var(--text);
  border: 1.5px solid var(--border-dark);
}
.btn-secondary:hover { background: var(--cream); color: var(--text); }
.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1.5px solid #f5c6c2;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1.5px solid #b2dfcf;
}
.btn-success:hover { background: var(--success); color: #fff; }
.btn-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1.5px solid #b3d7f0;
}
.btn-info:hover { background: var(--info); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 7px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Tables ---- */
.table-wrapper { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
table.data-table thead th {
  background: var(--navy);
  color: rgba(255,255,255,0.85);
  padding: 11px 14px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
table.data-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table.data-table thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
table.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
table.data-table tbody tr:hover { background: #f8f6f0; }
table.data-table tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }
table.data-table tbody td:last-child { white-space: nowrap; }

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-active   { background: #e8f5ee; color: #2e7d52; }
.status-released { background: #e8f4fd; color: #1a5c8e; }
.status-closed   { background: #f3f4f6; color: #6b7280; }
.status-overdue  { background: #fdecea; color: #c0392b; }

/* ---- Search & Filter bar ---- */
.search-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}
.search-bar .search-input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-bar .search-input-wrap svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}
.search-bar input[type="text"],
.search-bar input[type="date"],
.search-bar select {
  padding: 9px 13px 9px 38px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  width: 100%;
  background: var(--white);
  color: var(--text);
}
.search-bar input[type="date"],
.search-bar select { padding-left: 13px; }
.search-bar input:focus, .search-bar select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

/* ---- Toast messages ---- */
.toast-container {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.875rem;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
  cursor: pointer;
}
.toast.success { background: var(--success-bg); color: #1a5c38; border-left: 4px solid var(--success); }
.toast.error   { background: var(--danger-bg);  color: #8b1c0f; border-left: 4px solid var(--danger);  }
.toast.warning { background: var(--warning-bg); color: #7a4f00; border-left: 4px solid var(--warning); }
.toast.info    { background: var(--info-bg);    color: #0d3d5e; border-left: 4px solid var(--info);    }
@keyframes slideInRight {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.pg-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--white);
  border: 1.5px solid var(--border-dark);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all var(--transition);
}
.pg-btn:hover { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.pg-btn.active { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; }
.pg-info { font-size: 0.78rem; color: var(--text-light); margin-left: 8px; }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,27,42,0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: zoomIn 0.2s ease;
}
@keyframes zoomIn {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}
.modal-body { color: var(--text-mid); font-size: 0.9rem; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---- Section divider ---- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}
.section-divider .divider-label {
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  background: var(--white);
  padding: 0 10px 0 0;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--gold), transparent);
}

/* ---- Utility ---- */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-10 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }
.fw-600 { font-weight: 600; }
.text-gold { color: var(--gold); }
.text-muted { color: var(--text-light); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.fs-sm { font-size: 0.82rem; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state svg { opacity: 0.25; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ---- Print styles ---- */
@media print {
  .sidebar, .topbar, .btn, .pagination, .search-bar, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .invoice-box { box-shadow: none; border: 1px solid #ccc; }
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger { display: block; }
  .page-body { padding: 16px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .card-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .stats-grid { grid-template-columns: 1fr; }
  .btn-group { gap: 6px; }
}

/* ---- Sidebar overlay for mobile ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ============================================================
   MOBILE BOTTOM TAB BAR — replaces sidebar on small screens
   ============================================================ */
@media (max-width: 900px) {

  /* Hide old hamburger & sidebar completely on mobile */
  .hamburger { display: none !important; }
  .sidebar   { display: none !important; }
  .sidebar-overlay { display: none !important; }

  /* Push content up so it clears the tab bar */
  .main-content {
    margin-left: 0;
    padding-bottom: 74px; /* height of tab bar */
  }

  /* ---- Bottom Tab Bar ---- */
  .mobile-tabbar {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 200;
    background: var(--navy);
    border-top: 2px solid rgba(201,168,76,0.3);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
    height: 64px;
    align-items: stretch;
  }

  .tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 8px 4px 10px;
    transition: all 0.18s ease;
    position: relative;
    border: none;
    background: none;
    cursor: pointer;
  }

  .tab-item svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255,255,255,0.5);
    transition: stroke 0.18s ease;
    flex-shrink: 0;
  }

  .tab-item:hover,
  .tab-item.active {
    color: var(--gold);
    background: rgba(201,168,76,0.1);
  }
  .tab-item:hover svg,
  .tab-item.active svg {
    stroke: var(--gold);
  }

  /* Gold dot indicator on active tab */
  .tab-item.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--gold);
    border-radius: 3px 3px 0 0;
  }

  /* Centre "Add" tab is special — raised gold circle */
  .tab-item.tab-add {
    color: var(--navy);
    padding-top: 0;
  }
  .tab-add-bubble {
    width: 48px;
    height: 48px;
    background: var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2px;
    box-shadow: 0 4px 14px rgba(201,168,76,0.5);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    margin-top: -16px; /* lift above bar */
  }
  .tab-item.tab-add:hover .tab-add-bubble,
  .tab-item.tab-add.active .tab-add-bubble {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(201,168,76,0.65);
  }
  .tab-item.tab-add svg {
    stroke: var(--navy);
    width: 24px;
    height: 24px;
  }
  .tab-item.tab-add .tab-label {
    font-size: 0.58rem;
    color: var(--gold);
    font-weight: 700;
  }
  .tab-item.tab-add::after { display: none; }
}

/* Hide tab bar on desktop */
@media (min-width: 901px) {
  .mobile-tabbar { display: none; }
}

/* ============================================================
   DASHBOARD — Quick Action Cards (mobile-first big buttons)
   ============================================================ */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 16px 20px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 0.88rem;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.action-card:hover {
  border-color: var(--gold);
  box-shadow: 0 6px 20px rgba(201,168,76,0.18);
  transform: translateY(-2px);
  color: var(--navy);
}

.action-card .ac-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.action-card .ac-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.action-card .ac-sub {
  font-size: 0.7rem;
  color: var(--text-light);
  font-weight: 400;
}

.ac-gold  .ac-icon { background: #fef3d0; }
.ac-green .ac-icon { background: var(--success-bg); }
.ac-blue  .ac-icon { background: var(--info-bg); }
.ac-red   .ac-icon { background: var(--danger-bg); }

@media (max-width: 500px) {
  .action-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .action-card { padding: 18px 10px 16px; }
  .action-card .ac-icon { width: 40px; height: 40px; font-size: 1.25rem; }
  .action-card .ac-label { font-size: 0.78rem; }
}
