:root {
  --primary: #667eea;
  --primary-dark: #764ba2;
  --income: #00D9A3;
  --expense: #FF6B6B;
  --bg: #f5f7fa;
  --card-bg: rgba(255, 255, 255, 0.7);
  --text: #2d3748;
  --text-light: #718096;
  --border: rgba(255, 255, 255, 0.3);
  --shadow: rgba(0, 0, 0, 0.1);
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a202c;
    --card-bg: rgba(45, 55, 72, 0.7);
    --text: #f7fafc;
    --text-light: #a0aec0;
    --shadow: rgba(0, 0, 0, 0.3);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  background-attachment: fixed;
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  padding-bottom: 80px;
}

#content {
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: 0 8px 32px var(--shadow);
  margin-bottom: 1rem;
}

/* Dashboard */
.balance-header {
  text-align: center;
  padding: 2rem 0;
  color: white;
}

.balance-label {
  font-size: 0.875rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

.balance-value {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.month-label {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.stat-card {
  background: linear-gradient(135deg, var(--income), #00B894);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: white;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  gap: 1rem;
  align-items: center;
}

.stat-card.expense {
  background: linear-gradient(135deg, var(--expense), #EE5A6F);
}

.stat-icon {
  font-size: 2rem;
  opacity: 0.9;
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
}

/* Charts */
.chart-section {
  margin-bottom: 1rem;
}

.chart-section h3 {
  margin-bottom: 1rem;
  font-size: 1.125rem;
}

canvas {
  max-height: 220px;
}

/* Accounts */
.list-container {
  padding-top: 1rem;
}

.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  color: white;
}

.list-header h2 {
  font-size: 1.5rem;
}

.btn-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s;
}

.btn-fab:active {
  transform: scale(0.95);
}

.account-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem !important;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.account-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px var(--shadow);
}

.account-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.account-info h4 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.account-bank {
  font-size: 0.875rem;
  color: var(--text-light);
}

.account-balance {
  text-align: right;
}

.account-balance .balance-label {
  font-size: 0.75rem;
  color: var(--text-light);
}

.account-balance .balance-value {
  font-size: 1.25rem;
  font-weight: 700;
  background: none;
  -webkit-text-fill-color: unset;
}

.positive {
  color: var(--income);
}

.negative {
  color: var(--expense);
}

/* Credit Cards */
.cards-grid {
  display: grid;
  gap: 1.5rem;
}

.credit-card {
  border-radius: 20px;
  padding: 1.5rem;
  color: white;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.card-header {
  display: flex;
  justify-content: space-between;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.card-name {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.card-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-label {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
}

.card-value {
  font-size: 1rem;
  font-weight: 600;
}

.card-progress {
  margin-top: auto;
}

.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 3px;
  transition: width 0.3s;
}

.btn-delete-card {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: none;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  font-size: 1rem;
}

/* Transactions */
.month-selector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  margin-bottom: 1rem;
}

.month-selector button {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 44px;
  height: 44px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: transform 0.2s;
}

.month-selector button:active {
  transform: scale(0.95);
}

.month-info {
  text-align: center;
  color: var(--text);
}

.month-info h3,
.month-info h2 {
  margin-bottom: 0.25rem;
}

.btn-today {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.875rem;
  text-decoration: underline;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.summary-card p {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.summary-card h4 {
  font-size: 1.125rem;
  font-weight: 700;
}

.summary-card.income h4 {
  color: var(--income);
}

.summary-card.expense h4 {
  color: var(--expense);
}

/* Transaction Rows */
.transactions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.transaction-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
}

.tx-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tx-info {
  flex: 1;
  min-width: 0;
}

.tx-description {
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.tx-meta {
  font-size: 0.75rem;
  color: var(--text-light);
}

.tx-amount {
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
}

.tx-amount.income {
  color: var(--income);
}

.tx-amount.expense {
  color: var(--expense);
}

.btn-icon,
.btn-icon-small {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.25rem;
}

.btn-icon-small {
  font-size: 1rem;
}

/* Category Summary */
.category-summary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-icon {
  font-size: 1.5rem;
}

.category-name {
  font-weight: 500;
}

.category-details {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.category-amount {
  font-weight: 700;
}

.category-count {
  font-size: 0.75rem;
  color: var(--text-light);
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: white;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  margin-bottom: 0.5rem;
}

.empty-state p {
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.empty-message {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

.btn-primary {
  background: white;
  color: var(--primary);
  border: none;
  padding: 0.875rem 1.75rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-content {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: var(--radius);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text);
}

.modal-content form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-content input,
.modal-content select {
  width: 100%;
  padding: 0.875rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--card-bg);
  color: var(--text);
}

.color-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.color-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.2s;
}

.color-option.selected {
  border-color: var(--text);
  transform: scale(1.1);
}

.type-toggle,
.payment-toggle {
  display: flex;
  gap: 0.5rem;
}

.type-btn,
.payment-btn {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
  color: var(--text);
}

.type-btn.active,
.payment-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.modal-actions button {
  flex: 1;
  padding: 0.875rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.modal-actions .btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Tab Bar */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  z-index: 100;
}

.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
  color: var(--primary);
}

.tab-icon {
  font-size: 1.5rem;
}

.tab-label {
  font-size: 0.625rem;
  font-weight: 500;
}

/* Responsive */
@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .summary-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

/* ===== SPLASH SCREEN ===== */
.splash-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeOut 0.3s ease 0.8s forwards;
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

.splash-content {
  text-align: center;
  color: white;
}

.logo-container {
  animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.logo-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

.logo-text {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tagline {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 3rem;
}

.splash-loader {
  display: flex;
  justify-content: center;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== LOGIN SCREEN ===== */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  padding: 1rem;
  animation: fadeIn 0.5s ease;
}

.login-content {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px;
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.login-header h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.login-header p {
  color: var(--text-light);
  font-size: 0.9375rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 600;
  color: var(--text);
  font-size: 0.875rem;
}

.form-group input {
  padding: 1rem;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.5);
  color: var(--text);
  transition: all 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.login-error {
  background: linear-gradient(135deg, var(--expense), #EE5A6F);
  color: white;
  padding: 0.875rem;
  border-radius: 12px;
  font-size: 0.875rem;
  text-align: center;
  animation: shake 0.5s ease;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  75% {
    transform: translateX(10px);
  }
}

.btn-login {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  border: none;
  padding: 1.125rem;
  border-radius: 12px;
  font-size: 1.0625rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
  transition: all 0.3s;
  margin-top: 0.5rem;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.btn-login:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
}

.btn-login:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Login divider */
.login-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--text-light);
  font-size: 0.875rem;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Google login button */
.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  background: white;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.btn-google:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-google svg {
  flex-shrink: 0;
}

/* Login footer */
.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity 0.2s;
}

.login-footer a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Login info */
.login-info {
  margin-top: 2rem;
  text-align: center;
  padding: 1rem;
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  border: 1px solid rgba(102, 126, 234, 0.2);
}

.login-info p {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0;
  line-height: 1.5;
}

/* Logout button in header */
.header-logout {
  position: fixed;
  top: 1rem;
  right: 1rem;
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.625rem 1.125rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 4px 16px var(--shadow);
  z-index: 99;
  transition: all 0.2s;
}

.header-logout:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow);
}

.header-logout:active {
  transform: translateY(0);
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .login-content {
    padding: 2rem 1.5rem;
  }

  .logo-text {
    font-size: 2.5rem;
  }

  .login-header h1 {
    font-size: 1.75rem;
  }
}