/* style.css - Premium Glassmorphism Style Guide */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-gradient: radial-gradient(circle at 50% 50%, #1e1b4b 0%, #0f0c1b 100%);
  --glass-bg: rgba(255, 255, 255, 0.04);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-glow: 0 0 20px rgba(255, 255, 255, 0.02);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  /* Accent Colors */
  --income-color: #10b981;
  --income-bg: rgba(16, 185, 129, 0.15);
  --income-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
  
  --expense-color: #f43f5e;
  --expense-bg: rgba(244, 63, 94, 0.15);
  --expense-gradient: linear-gradient(135deg, #e11d48 0%, #f43f5e 100%);
  
  --balance-color: #3b82f6;
  --balance-bg: rgba(59, 130, 246, 0.15);
  --balance-gradient: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  
  --primary-accent: #6366f1;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --accent-glow: 0 0 15px rgba(99, 102, 241, 0.4);

  --font-main: 'Plus Jakarta Sans', 'Outfit', system-ui, -apple-system, sans-serif;
}

/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Glassmorphism Container Utility */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

.glass-hover:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--glass-shadow), 0 0 25px rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* App Header Navigation */
header.app-header {
  position: sticky;
  top: 16px;
  z-index: 100;
  margin: 16px auto;
  width: 90%;
  max-width: 1200px;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.app-logo {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #f43f5e 0%, #3b82f6 50%, #10b981 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-info {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.btn {
  font-family: var(--font-main);
  padding: 8px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-danger {
  background: var(--expense-gradient);
  color: white;
}

.btn-danger:hover {
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

/* Authentication Pages Layout */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  text-align: center;
}

.auth-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: white;
  font-family: var(--font-main);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

/* Fix option text visibility inside select boxes in dark mode */
select.form-control option {
  background-color: #1c1936;
  color: var(--text-primary);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: var(--accent-glow);
  background: rgba(255, 255, 255, 0.08);
}

.auth-footer {
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.auth-footer a {
  color: var(--primary-accent);
  font-weight: 600;
}

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.9rem;
  text-align: left;
}

.alert-danger {
  background: rgba(244, 63, 94, 0.15);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: #fda4af;
}

.alert-success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #a7f3d0;
}

/* Dashboard Layout */
.app-container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto 40px auto;
  flex: 1;
}

/* Summary Grid */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
}

.summary-card.income::before { background: var(--income-gradient); }
.summary-card.expense::before { background: var(--expense-gradient); }
.summary-card.balance::before { background: var(--balance-gradient); }

.card-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.income .card-icon { background: var(--income-bg); color: var(--income-color); }
.expense .card-icon { background: var(--expense-bg); color: var(--expense-color); }
.balance .card-icon { background: var(--balance-bg); color: var(--balance-color); }

.card-content {
  flex: 1;
}

.card-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 4px;
}

/* Main Workspace Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.panel-card {
  padding: 24px;
  margin-bottom: 30px;
}

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

.panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Chart Section */
.chart-container {
  position: relative;
  height: 320px;
  width: 100%;
}

/* Transactions Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
}

table.transaction-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

table.transaction-table th {
  padding: 14px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--glass-border);
}

table.transaction-table td {
  padding: 14px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

table.transaction-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-income { background: var(--income-bg); color: var(--income-color); }
.badge-expense { background: var(--expense-bg); color: var(--expense-color); }
.badge-both { background: rgba(139, 92, 246, 0.15); color: #c084fc; }

.amount-val {
  font-weight: 600;
}
.amount-val.income { color: #34d399; }
.amount-val.expense { color: #fb7185; }

/* Category Aggregates styling */
.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.category-name-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 8, 20, 0.85);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  padding: 32px;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

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

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  background: none;
  border: none;
}

/* Form Styles Inside Modal */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Dynamic Add Category Section */
.quick-add-category {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

/* Hamburger Toggle Button */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 101;
}

.menu-toggle span {
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-logo {
  white-space: nowrap;
}

@media (max-width: 768px) {
  header.app-header {
    flex-wrap: wrap;
    position: relative;
    top: 0;
    margin: 10px auto;
    width: 95%;
    padding: 14px 20px;
  }

  .menu-toggle {
    display: flex;
  }

  .menu-toggle.open span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .menu-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle.open span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .user-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    margin-top: 15px;
    gap: 12px;
    padding: 16px 0 8px 0;
    border-top: 1px solid var(--glass-border);
    align-items: stretch;
  }

  .user-nav.active {
    display: flex;
  }

  .user-nav .user-info {
    text-align: center;
    margin-bottom: 8px;
  }

  .user-nav .btn {
    justify-content: center;
    width: 100%;
    margin-right: 0 !important;
  }
}

/* Responsive Table Design for Mobile Phones */
@media (max-width: 600px) {
  table.transaction-table thead {
    display: none;
  }
  table.transaction-table tr {
    display: block;
    margin-bottom: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
  }
  table.transaction-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.9rem;
    border: none;
  }
  table.transaction-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
  }
}
