/* ================================
   GLOBAL TYPOGRAPHY
================================ */
body {
  margin: 0;
  font-family: Inter, system-ui, sans-serif;
  background: #f9fafb;
  color: #111827;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin-top: 0;
  font-weight: 600;
  color: #111827;
  letter-spacing: -0.3px;
}

h1 { font-size: 32px; margin-bottom: 18px; }
h2 { font-size: 26px; margin-bottom: 16px; }
h3 { font-size: 18px; margin-bottom: 12px; }

p {
  margin: 0 0 12px 0;
  color: #374151;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* ================================
   APP LAYOUT
================================ */
#app {
  display: flex;
  height: 100vh;
}

main {
  flex: 1;
  padding: 40px 50px;
  overflow-y: auto;
  background: #f9fafb;
}

.page {
  display: none;
  padding-top: 10px;
}

.page.active {
  display: block;
}

.page h2 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 25px;
  color: #111827;
}

.page h3 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 30px;
  margin-bottom: 12px;
  color: #1f2937;
}

/* ================================
   SIDEBAR (Modern Stripe/Linear Style)
================================ */
.sidebar {
  width: 240px;
  background: #0f172a;
  color: #e2e8f0;
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,0.05);
}

.sidebar-brand {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: 0.3px;
}

.sidebar .user-info {
  margin-bottom: 28px;
  font-size: 14px;
  opacity: 0.9;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  padding: 12px 16px;
  margin-bottom: 6px;
  cursor: pointer;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s ease, color 0.2s ease;
}

.sidebar li:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar li.active {
  background: rgba(255,255,255,0.12);
  color: white;
}

#logoutBtn {
  margin-top: auto;
  padding: 12px 14px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

#logoutBtn:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
}

/* ================================
   BUTTONS (Premium)
================================ */
.primary-btn,
.secondary-btn {
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.primary-btn {
  background: #4f46e5;
  color: white;
}

.primary-btn:hover {
  background: #4338ca;
  transform: translateY(-1px);
}

.secondary-btn {
  background: #6b7280;
  color: white;
}

.secondary-btn:hover {
  background: #4b5563;
  transform: translateY(-1px);
}

/* ================================
   DASHBOARD CARDS
================================ */
.dashboard-cards {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.dashboard-cards .card {
  flex: 1;
  background: white;
  padding: 24px;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s ease, transform 0.15s ease;
}

.dashboard-cards .card:hover {
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.dashboard-cards .card h3 {
  margin: 0 0 10px 0;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  letter-spacing: 0.2px;
}

.dashboard-cards .card p {
  font-size: 28px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

/* ================================
   INVOICE LIST (Modern)
================================ */
.invoice-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.invoice-card:hover {
  border-color: #d1d5db;
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.invoice-left strong {
  font-size: 15px;
  color: #111827;
}

.invoice-date {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
  display: block;
}

.invoice-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-total {
  font-weight: 600;
  color: #111827;
  font-size: 15px;
}

.view-btn,
.delete-btn {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.view-btn {
  border: 1px solid #3b82f6;
  color: #3b82f6;
  background: #f0f7ff;
}

.view-btn:hover {
  background: #e0efff;
}

.delete-btn {
  border: 1px solid #ef4444;
  color: #ef4444;
  background: #fff5f5;
}

.delete-btn:hover {
  background: #ffecec;
}

/* ================================
   MODAL (Modern Stripe Style)
================================ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-content {
  background: #ffffff;
  width: 460px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 14px;
  padding: 28px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
  position: relative;
  animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: #f3f4f6;
  color: #111827;
  border: none;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s ease;
}

.close-btn:hover {
  background: #e5e7eb;
}

.modal-item {
  padding: 12px 0;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}

.modal-totals p {
  margin: 6px 0;
  font-size: 15px;
}

/* ================================
   INVOICE FORM (Stripe Style)
================================ */
#invoicePage {
  max-width: 900px;
  margin: auto;
}

#invoicePage h2 {
  font-size: 22px;
  margin-bottom: 16px;
  color: #111827;
}

.form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
  display: block;
}

.form-group input,
.form-group select {
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  margin-bottom: 15px;
}

.items-table th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  padding: 10px;
  text-align: left;
}

.items-table td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.items-table td input {
  width: 100%;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
}

.items-table td input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.add-item-btn {
  background: #4f46e5;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  color: white;
  cursor: pointer;
  transition: background 0.2s ease;
}

.add-item-btn:hover {
  background: #4338ca;
}

.totals {
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-top: 20px;
  max-width: 300px;
}

.totals div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 15px;
}

/* ================================
   CLIENTS UI
================================ */
.clients-header {
  margin-bottom: 25px;
}

.clients-header h2 {
  font-size: 28px;
  font-weight: 600;
  color: #111827;
}

.clients-subtitle {
  color: #6b7280;
  font-size: 14px;
  margin-top: 4px;
}

.client-card,
.client-list-card {
  background: #ffffff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  margin-bottom: 24px;
}

.client-card h3,
.client-list-card h3 {
  margin-bottom: 16px;
  font-size: 18px;
  color: #111827;
}

.client-form label {
  display: block;
  font-size: 14px;
  color: #374151;
  margin-bottom: 6px;
}

.client-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
}

.client-list .client-item {
  padding: 14px 0;
  border-bottom: 1px solid #e5e7eb;
}

.client-list .client-item:last-child {
  border-bottom: none;
}

.client-item strong {
  display: block;
  font-size: 15px;
  color: #111827;
}

.client-item span {
  font-size: 13px;
  color: #6b7280;
}

.client-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.client-search-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* ================================
   NOTES TOOLTIP
================================ */
.notes-icon {
  cursor: pointer;
  font-size: 14px;
  margin-right: 8px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.notes-icon:hover {
  opacity: 1;
}

.notes-tooltip {
  position: fixed;
  max-width: 260px;
  background: #1f1f1f;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
  box-shadow: 0 4px 18px rgba(0,0,0,0.25);
  z-index: 9999;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}

.notes-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* ================================
   LOADING OVERLAY
================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 45px;
  height: 45px;
  border: 4px solid #ddd;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================
   TOAST
================================ */
.toast {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: #4f46e5;
  color: white;
  padding: 14px 20px;
  border-radius: 8px;
  font-size: 15px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  z-index: 999999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}
