/* ============================================
   Family Budget Tracker - Modern Dashboard CSS
   ============================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* ---------- Theme Variables ---------- */
:root {
  /* Light theme */
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --bg-sidebar: #1e1e2d;
  --bg-sidebar-active: rgba(67, 97, 238, 0.15);
  --bg-input: #f7f8fa;
  --text: #1a1a2e;
  --text-secondary: #6b7280;
  --text-sidebar: #a2a5b9;
  --text-sidebar-active: #ffffff;
  --border: #e5e7eb;
  --accent: #4361ee;
  --accent-hover: #3651d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --gold: #eab308;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg: #0f0f1a;
  --bg-card: #1a1a2e;
  --bg-sidebar: #0d0d1a;
  --bg-input: #1e1e32;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --border: #2d2d44;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ---------- Body & Typography ---------- */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  color: var(--text);
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(107, 114, 128, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 114, 128, 0.5);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(107, 114, 128, 0.3) transparent;
}

/* ---------- App Layout ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: var(--bg-sidebar);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-header .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-header .logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.3px;
}

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-sidebar);
  border-radius: 8px;
  margin: 2px 12px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  font-size: 14px;
  font-weight: 400;
  text-decoration: none;
  user-select: none;
}

.nav-link i,
.nav-link .nav-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  text-decoration: none;
}

.nav-link.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--text-sidebar);
}

/* ---------- Main Content ---------- */
.main {
  flex: 1;
  margin-left: 260px;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 50;
  gap: 16px;
}

#btn-menu {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 22px;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  align-items: center;
  justify-content: center;
}

#btn-menu:hover {
  background: var(--bg);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ---------- Month Selector ---------- */
.month-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}

.month-selector button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
}

.month-selector button:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--accent);
}

.month-selector select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

.month-selector select:focus {
  border-color: var(--accent);
}

/* ---------- Theme Toggle ---------- */
#btn-theme {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
}

#btn-theme:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--accent);
}

/* ---------- Content Area ---------- */
.content {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* ---------- Pages ---------- */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ---------- Section Header ---------- */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-header h2 i {
  color: var(--accent);
}

/* ---------- Card ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  transition: box-shadow var(--transition);
}

/* ---------- Summary Grid ---------- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.summary-card {
  display: flex;
  gap: 16px;
  align-items: center;
}

.summary-card .summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.summary-card .summary-info {
  flex: 1;
  min-width: 0;
}

.summary-card .summary-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.summary-card .value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

/* Summary card color variants */
.summary-card[data-type="income"] .icon {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.summary-card[data-type="expense"] .icon {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.summary-card[data-type="savings"] .icon {
  background: rgba(67, 97, 238, 0.1);
  color: var(--accent);
}

.summary-card[data-type="rate"] .icon {
  background: rgba(234, 179, 8, 0.1);
  color: var(--gold);
}

/* ---------- Charts Row ---------- */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-card {
  min-height: 300px;
}

.chart-card canvas {
  width: 100% !important;
  max-height: 280px;
}

.chart-card .card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Form Card ---------- */
.form-card {
  /* extends .card via class */
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

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

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.form-group select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.btn {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Table Card ---------- */
.table-card {
  overflow: hidden;
  padding: 0;
}

.table-card .card-header {
  padding: 24px 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.table-card .card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
}

.table tr:hover td {
  background: rgba(67, 97, 238, 0.03);
}

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

.table-actions {
  display: flex;
  gap: 8px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 12px 24px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
  font-weight: 500;
  font-size: 14px;
  font-family: inherit;
  transition: color var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: var(--accent);
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px 1px 0 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ---------- Category Grid ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.category-card {
  padding: 20px;
  transition: box-shadow var(--transition), opacity var(--transition);
}

.category-card:hover {
  box-shadow: var(--shadow-lg);
}

.category-card.inactive {
  opacity: 0.5;
}

.cat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.cat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cat-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.cat-name {
  font-weight: 600;
  font-size: 15px;
}

.cat-amount {
  font-size: 20px;
  font-weight: 700;
  margin: 8px 0;
}

.cat-meta {
  font-size: 13px;
  color: var(--text-secondary);
}

.cat-edit {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.cat-edit.editing {
  display: block;
}

/* ---------- Toggle Switch ---------- */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

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

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

.toggle input:checked + .slider {
  background: var(--accent);
}

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

.cat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Savings Types ---------- */
.savings-types {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.savings-type-card {
  text-align: center;
  padding: 16px;
}

.savings-type-card .type-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.savings-type-card .type-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.savings-type-card .type-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

/* ---------- Goal Grid ---------- */
.goal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.goal-card {
  padding: 24px;
  transition: box-shadow var(--transition);
}

.goal-card:hover {
  box-shadow: var(--shadow-lg);
}

.goal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 8px;
}

.goal-header .goal-name {
  font-size: 16px;
  font-weight: 600;
}

.progress-bar {
  height: 10px;
  background: var(--border);
  border-radius: 5px;
  overflow: hidden;
  margin: 12px 0;
}

.progress-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.5s ease;
}

.progress-fill.high {
  background: var(--success);
}

.progress-fill.medium {
  background: var(--warning);
}

.progress-fill.low {
  background: var(--danger);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.goal-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
}

.goal-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.goal-meta .meta-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.goal-meta .meta-value {
  font-weight: 600;
  color: var(--text);
}

.goal-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ---------- Badges ---------- */
.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
  white-space: nowrap;
}

.badge-low {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge-medium {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.badge-high {
  background: rgba(249, 115, 22, 0.12);
  color: #ea580c;
}

.badge-critical {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Status badges */
.status-active {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.status-paused {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.status-completed {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

/* ---------- Forecast Grid ---------- */
.forecast-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.forecast-item {
  text-align: center;
  padding: 20px;
}

.forecast-period {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.forecast-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.forecast-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 14px;
  font-weight: 500;
  animation: slideInRight 0.3s ease;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  max-width: 380px;
}

.toast-success {
  background: var(--success);
}

.toast-error {
  background: var(--danger);
}

.toast-info {
  background: var(--info);
}

.toast-warning {
  background: var(--warning);
}

.toast-close {
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  font-size: 16px;
  margin-left: auto;
  opacity: 0.8;
  padding: 0 0 0 8px;
}

.toast-close:hover {
  opacity: 1;
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.empty-state i {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.4;
}

.empty-state p {
  margin-top: 8px;
}

/* ---------- Modal Overlay ---------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: fadeIn 0.2s ease;
}

.modal h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ---------- File Input Hidden ---------- */
.file-input-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Sidebar Overlay (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}

/* ---------- Utility Classes ---------- */
.text-success {
  color: var(--success);
}

.text-danger {
  color: var(--danger);
}

.text-warning {
  color: var(--warning);
}

.text-info {
  color: var(--info);
}

.text-accent {
  color: var(--accent);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.font-bold {
  font-weight: 700;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-20 {
  margin-top: 20px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-20 {
  margin-bottom: 20px;
}

.hidden {
  display: none !important;
}

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* ---------- Responsive: Tablet (768px - 1024px) ---------- */
@media (max-width: 1024px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  #btn-menu {
    display: flex;
  }

  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .savings-types {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Responsive: Mobile (<768px) ---------- */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  #btn-menu {
    display: flex;
  }

  .topbar {
    padding: 10px 16px;
  }

  .content {
    padding: 16px;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .charts-row {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .forecast-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .savings-types {
    grid-template-columns: repeat(2, 1fr);
  }

  .goal-grid {
    grid-template-columns: 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .section-header h2 {
    font-size: 18px;
  }

  .summary-card .value {
    font-size: 22px;
  }

  .table-card {
    border-radius: 0;
    margin-left: -16px;
    margin-right: -16px;
    border-left: none;
    border-right: none;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  .modal {
    width: 95%;
    padding: 20px;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    max-width: 100%;
  }

  .month-selector {
    gap: 4px;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

/* ---------- Responsive: Very small (<480px) ---------- */
@media (max-width: 480px) {
  .savings-types {
    grid-template-columns: 1fr;
  }

  .forecast-grid {
    grid-template-columns: 1fr;
  }

  .topbar-right {
    gap: 8px;
  }
}

/* ---------- Print Styles ---------- */
@media print {
  .sidebar,
  .topbar,
  .sidebar-overlay,
  .btn,
  .form-actions,
  .table-actions,
  .goal-actions,
  .toast-container,
  #btn-menu,
  #btn-theme,
  .month-selector {
    display: none !important;
  }

  .main {
    margin-left: 0;
  }

  .content {
    max-width: 100%;
    padding: 0;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  .page {
    display: block !important;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 12px;
  }

  .summary-cards {
    grid-template-columns: repeat(4, 1fr);
  }
}
