/* 
  Finance Tracker — Bill & Loan Dashboard
  Theme: Light, Premium, Clean
*/

:root {
  --bg-color: #f4f6fa;
  --bg-card: #ffffff;
  
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  
  --border-light: #e2e8f0;
  --border-focus: #38bdf8;
  
  --accent-blue: #0ea5e9;
  --accent-blue-hover: #0284c7;
  --accent-blue-light: #e0f2fe;

  --accent-lime: #a3e635;
  --accent-lime-hover: #84cc16;

  --green-main: #10b981;
  --green-bg: #d1fae5;
  
  --red-main: #ef4444;
  --red-bg: #fee2e2;

  --gold-main: #f59e0b;
  --gold-bg: #fef3c7;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 30px rgba(14, 165, 233, 0.08);

  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

h1, h2, h3, h4 { font-family: var(--font-heading); }

/* Skeleton / Loading */
.loading-spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}

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

/* HEADER */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.logo-area h1 {
  font-size: 1.6rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-lime-hover));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-area p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.month-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.month-nav-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.month-nav-btn:hover { color: var(--accent-blue); }

.current-month-display {
  font-weight: 600;
  font-size: 0.95rem;
  min-width: 140px;
  text-align: center;
}

/* SUMMARY BAR */
.summary-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-item {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 1.2rem 1rem;
  text-align: center;
  box-shadow: var(--shadow-soft);
  border-top: 3px solid var(--border-light);
  transition: transform 0.2s;
}

.summary-item:hover { transform: translateY(-2px); }
.summary-item.total { border-top-color: var(--accent-blue); }
.summary-item.paid { border-top-color: var(--green-main); }
.summary-item.unpaid { border-top-color: var(--red-main); }

.summary-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
}

.summary-value {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  display: block;
}

.summary-item.total .summary-value { color: var(--accent-blue); }
.summary-item.paid .summary-value { color: var(--green-main); }
.summary-item.unpaid .summary-value { color: var(--red-main); }

/* CARD SECTIONS */
.card-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-soft);
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-light);
}

.section-hdr h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

/* BILL ROW */
.bill-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border-left: 3px solid var(--gold-main);
  transition: background 0.2s, opacity 0.3s;
}

.bill-row.paid-row {
  border-left-color: var(--green-main);
  opacity: 0.7;
  background: linear-gradient(to right, rgba(16, 185, 129, 0.04), transparent);
}

.bill-row:hover { background: #f1f5f9; }
.bill-row.paid-row:hover { opacity: 1; }

.bill-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.bill-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.bill-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.bill-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bill-amount {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  min-width: 80px;
  text-align: right;
}

/* TOGGLE SWITCH */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--border-light);
  border-radius: 24px;
  transition: all 0.3s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--green-main);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* BADGES */
.badge {
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge.green { background: var(--green-bg); color: var(--green-main); }
.badge.gold { background: var(--gold-bg); color: var(--gold-main); }
.badge.red { background: var(--red-bg); color: var(--red-main); }
.badge.blue { background: var(--accent-blue-light); color: var(--accent-blue); }

/* SMS SECTION */
.sms-section textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: #f8fafc;
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 12px;
}

.sms-section textarea:focus {
  border-color: var(--accent-blue);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-blue-light);
}

.btn-submit {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-lime-hover));
  color: #fff;
  border: none;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.25);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* PARSE RESULT */
.parse-result {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.parse-result.success {
  background: var(--green-bg);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.parse-result.error {
  background: var(--red-bg);
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.hidden { display: none !important; }

/* EMPTY STATE */
.empty-state {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* TOAST */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: #fff;
  color: var(--text-primary);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  font-weight: 500;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s ease forwards;
  border-left: 4px solid var(--accent-blue);
}

.toast.error { border-left-color: var(--red-main); }
.toast.success { border-left-color: var(--green-main); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast.fade-out {
  animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(50px); }
}

/* FOOTER */
.app-footer {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin-top: 2rem;
  padding: 1rem 0;
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .app-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .summary-bar { grid-template-columns: 1fr; }
  .bill-row { flex-wrap: wrap; gap: 8px; }
  .bill-actions { width: 100%; justify-content: flex-end; }
}
