/* Clean, Modern & Mobile-First Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-dark: #090D16;
  --bg-card: #111827;
  --bg-card-hover: #1F2937;
  --bg-input: #1F2937;
  --border-color: #1F2937;
  --border-glow: #374151;

  --text-main: #F9FAFB;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;

  --accent-primary: #3B82F6;
  --accent-primary-gradient: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
  --accent-success: #10B981;
  --accent-success-gradient: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --accent-danger: #EF4444;
  --accent-danger-gradient: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
  --accent-warning: #F59E0B;
  --accent-purple: #8B5CF6;
  --accent-cyan: #06B6D4;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);

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

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 80px; /* space for mobile nav */
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--text-main);
  font-weight: 600;
}

/* App Header & Navigation */
.app-header {
  background: rgba(17, 24, 39, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1.5rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #06B6D4, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
}

.logo-badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.2);
  color: var(--accent-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  color: var(--accent-primary);
  font-weight: 600;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Mobile Bottom Nav */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0.25rem;
  z-index: 100;
}

.mobile-nav-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 500;
  gap: 0.2rem;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  flex: 1;
}

.mobile-nav-link.active {
  color: var(--accent-primary);
  font-weight: 600;
}

.mobile-nav-icon {
  font-size: 1.25rem;
}

/* Main Container Layout */
.main-container {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

/* Auth Layout */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-card);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-header .logo-icon {
  margin: 0 auto 1rem auto;
  width: 48px;
  height: 48px;
  font-size: 1.75rem;
}

/* Cards & Layout Grid */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: var(--border-glow);
}

.card-title {
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-amount {
  font-size: 1.65rem;
  font-weight: 700;
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
}

.card-amount.income {
  color: var(--accent-success);
}

.card-amount.expense {
  color: var(--accent-danger);
}

.card-amount.balance {
  color: var(--text-main);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25em;
}

.type-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 4px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
}

.type-btn {
  flex: 1;
  padding: 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.type-btn.active.expense {
  background: var(--accent-danger);
  color: #FFF;
}

.type-btn.active.income {
  background: var(--accent-success);
  color: #FFF;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-primary-gradient);
  color: #FFF;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #374151;
  color: #F3F4F6;
}

.btn-secondary:hover {
  background: #4B5563;
}

.btn-danger {
  background: var(--accent-danger-gradient);
  color: #FFF;
}

.btn-danger:hover {
  opacity: 0.92;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Transaction List Table / Cards */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.tx-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.tx-table th {
  text-align: left;
  padding: 0.85rem 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.tx-table td {
  padding: 0.95rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
  vertical-align: middle;
}

.tx-table tr:last-child td {
  border-bottom: none;
}

.tx-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.tx-row.deleted-row {
  opacity: 0.45;
  text-decoration: line-through;
}

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-shortcut {
  background: rgba(139, 92, 246, 0.2);
  color: var(--accent-purple);
}

.badge-web {
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
}

.badge-edited {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent-warning);
}

.badge-deleted {
  background: rgba(239, 68, 68, 0.2);
  color: var(--accent-danger);
}

/* Modal Dialog */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  padding: 1rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  padding: 1.75rem;
  box-shadow: var(--shadow-card);
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Responsive Utilities */
@media (min-width: 768px) {
  .mobile-nav {
    display: none;
  }
}

@media (max-width: 767px) {
  .desktop-nav {
    display: none;
  }
  body {
    padding-bottom: 85px;
  }
  .card-amount {
    font-size: 1.35rem;
  }
}

/* Chart Canvas Container */
.chart-container {
  position: relative;
  height: 260px;
  width: 100%;
}
