/* ============ VARIABLES ============ */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);

  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;

  --accent-primary: #6366f1;
  --accent-primary-hover: #818cf8;
  --accent-green: #22c55e;
  --accent-green-dim: rgba(34, 197, 94, 0.15);
  --accent-red: #ef4444;
  --accent-red-dim: rgba(239, 68, 68, 0.15);
  --accent-yellow: #eab308;
  --accent-yellow-dim: rgba(234, 179, 8, 0.15);
  --accent-blue: #3b82f6;
  --accent-blue-dim: rgba(59, 130, 246, 0.15);
  --accent-purple: #a855f7;
  --accent-purple-dim: rgba(168, 85, 247, 0.15);

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

  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Icon Styles */
[data-lucide] {
  vertical-align: middle;
}

/* ============ RESET ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

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

/* ============ APP CONTAINER ============ */
.app {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.screen {
  animation: fadeIn 0.3s ease;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============ UTILITIES ============ */
.text-green {
  color: var(--accent-green);
}

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

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

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

.text-gray {
  color: var(--text-muted);
}

/* ============ LOGIN SCREEN ============ */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

.logo svg {
  width: 48px;
  height: 48px;
  color: var(--accent-primary);
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

.login-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ============ FORM ELEMENTS ============ */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.input-group input,
.input-group select {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  font-family: var(--font-family);
  transition: all 0.2s ease;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-group input::placeholder {
  color: var(--text-muted);
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
}

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

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

.btn-full {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 12px;
}

.btn-upi {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  text-decoration: none;
  margin-top: 16px;
}

.btn-upi:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.arrow {
  transition: transform 0.2s ease;
}

.btn:hover .arrow {
  transform: translateX(4px);
}

.error-text {
  color: var(--accent-red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* ============ HEADER ============ */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--glass-border);
}

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

.logo-small {
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-small svg {
  width: 24px;
  height: 24px;
  color: var(--accent-primary);
}

.header h1 {
  font-size: 20px;
  font-weight: 700;
}

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

.user-badge {
  padding: 6px 12px;
  background: var(--accent-primary-hover);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.user-badge.admin {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.user-badge.uncle {
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
}

/* ============ STATS CARDS ============ */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 24px;
  height: 24px;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-given .stat-value {
  color: var(--accent-blue);
}

.stat-paid .stat-value {
  color: var(--accent-green);
}

.stat-interest .stat-value {
  color: var(--accent-yellow);
}

.stat-balance .stat-value {
  color: var(--accent-red);
}

/* ============ SECTIONS ============ */
.section {
  margin-bottom: 32px;
}

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

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

/* ============ EMI SECTION ============ */
.emi-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.emi-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.emi-amount-display {
  display: flex;
  flex-direction: column;
}

.emi-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.emi-value {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.emi-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

.checkbox-group {
  margin: 16px 0;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.help-text {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  margin-left: 26px;
}

/* ============ EMI STATUS ============ */
.emi-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.emi-status-item {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.emi-status-item.paid {
  border-color: var(--accent-green);
  background: var(--accent-green-dim);
}

.emi-status-item.partial {
  border-color: var(--accent-yellow);
  background: var(--accent-yellow-dim);
}

.emi-status-item.missed {
  border-color: var(--accent-red);
  background: var(--accent-red-dim);
}

.emi-status-item.pending {
  border-color: var(--accent-blue);
  background: var(--accent-blue-dim);
}

.emi-status-item.upcoming {
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  opacity: 0.7;
}

.emi-month {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.emi-status-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.emi-status-text {
  font-size: 13px;
  font-weight: 600;
}

.emi-status-item.paid .emi-status-text {
  color: var(--accent-green);
}

.emi-status-item.partial .emi-status-text {
  color: var(--accent-yellow);
}

.emi-status-item.missed .emi-status-text {
  color: var(--accent-red);
}

.emi-status-item.pending .emi-status-text {
  color: var(--accent-blue);
}

.emi-status-item.upcoming .emi-status-text {
  color: var(--text-muted);
}

.empty-text {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

/* ============ QUICK PAY SECTION (For Uncle) ============ */
.quick-pay-section {
  margin-bottom: 32px;
}

.quick-pay-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.quick-pay-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.btn-quick-emi,
.btn-quick-extra {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  border-radius: var(--radius-lg);
  border: 2px solid;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 120px;
}

.btn-quick-emi {
  background: var(--accent-green-dim);
  border-color: var(--accent-green);
}

.btn-quick-emi:hover {
  background: var(--accent-green);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(34, 197, 94, 0.3);
}

.btn-quick-emi:hover .quick-label,
.btn-quick-emi:hover .quick-amount {
  color: white;
}

.btn-quick-extra {
  background: var(--accent-purple-dim);
  border-color: var(--accent-purple);
}

.btn-quick-extra:hover {
  background: var(--accent-purple);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(168, 85, 247, 0.3);
}

.btn-quick-extra:hover .quick-label,
.btn-quick-extra:hover .quick-amount {
  color: white;
}

.quick-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.quick-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.quick-amount {
  font-size: 14px;
  color: var(--text-secondary);
}

.btn-upi-quick {
  display: block;
  text-align: center;
  margin-top: 16px;
  padding: 14px 20px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-upi-quick:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.uncle-only {
  display: none;
}

.modal-small {
  max-width: 320px;
}

/* ============ ACTIONS BAR ============ */
.actions-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

/* ============ TRANSACTIONS ============ */
.transactions-list {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--glass-border);
  transition: background 0.2s ease;
}

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

.transaction-item:hover {
  background: var(--bg-card-hover);
}

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

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

.transaction-icon.disbursement {
  background: var(--accent-blue-dim);
}

.transaction-icon.payment {
  background: var(--accent-green-dim);
}

.transaction-icon.interest {
  background: var(--accent-yellow-dim);
}

.transaction-info {
  display: flex;
  flex-direction: column;
}

.transaction-type {
  font-size: 14px;
  font-weight: 600;
}

.transaction-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.transaction-notes {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.transaction-amount {
  font-size: 16px;
  font-weight: 700;
}

.transaction-amount.positive {
  color: var(--accent-green);
}

.transaction-amount.negative {
  color: var(--accent-red);
}

.transaction-amount.neutral {
  color: var(--accent-yellow);
}

.transaction-actions {
  display: flex;
  gap: 4px;
}

.transaction-actions button {
  padding: 8px 12px;
  font-size: 14px;
  background: var(--accent-red-dim);
  border: 1px solid var(--accent-red);
  border-radius: var(--radius-sm);
  color: var(--accent-red);
  cursor: pointer;
  transition: all 0.2s ease;
}

.transaction-actions button:hover {
  background: var(--accent-red);
  color: white;
  transform: scale(1.05);
}

/* ============ MODAL ============ */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%;
  max-width: 420px;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.modal-header h2 {
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
}

/* ============ ANALYTICS MODAL ============ */
.modal-large {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
}

.analytics-content {
  padding: 8px 0;
}

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.analytics-stat {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.analytics-stat-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.analytics-stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-primary);
}

.analytics-charts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.chart-container h3 {
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.chart-container canvas {
  max-height: 200px;
}

.analytics-section {
  margin-top: 24px;
}

.analytics-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.full-emi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
}

.full-emi-item {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 12px;
  border: 1px solid var(--glass-border);
}

.full-emi-item.paid {
  background: var(--accent-green-dim);
  border-color: var(--accent-green);
}

.full-emi-item.partial {
  background: var(--accent-yellow-dim);
  border-color: var(--accent-yellow);
}

.full-emi-item.missed {
  background: var(--accent-red-dim);
  border-color: var(--accent-red);
}

.full-emi-item.pending,
.full-emi-item.upcoming {
  background: var(--bg-secondary);
  border-color: var(--glass-border);
}

.full-emi-month {
  font-weight: 600;
  margin-bottom: 2px;
}

.full-emi-status {
  font-size: 10px;
  color: var(--text-secondary);
}

/* ============ FORECAST SECTION ============ */
.forecast-section {
  margin: 32px 0;
}

.forecast-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
}

.forecast-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.forecast-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
}

.forecast-card.highlight {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.15));
  border-color: var(--accent-primary);
}

.forecast-label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.forecast-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.forecast-card.highlight .forecast-value {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (max-width: 768px) {
  .forecast-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .analytics-summary {
    grid-template-columns: repeat(2, 1fr);
  }

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

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .app {
    padding: 12px;
  }

  .login-card {
    padding: 24px;
  }

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

  .stat-card {
    padding: 16px;
  }

  .stat-value {
    font-size: 20px;
  }

  .header h1 {
    font-size: 16px;
  }

  .emi-value {
    font-size: 28px;
  }

  .actions-bar {
    flex-direction: column;
  }

  .actions-bar .btn {
    width: 100%;
  }
}