
:root {
  --background: #101827;
  --card: #1c293b;
  --card-light: #25344a;
  --text: #f4f7fb;
  --muted: #9baabd;
  --green: #28c98b;
  --red: #ff6475;
  --border: #34445a;
}

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

body {
  background: var(--background);
  color: var(--text);
  font-family: Arial, sans-serif;
  min-height: 100vh;
}

button,
input,
select {
  font-family: inherit;
}

button {
  cursor: pointer;
}

.app-container {
  width: 100%;
  max-width: 600px;
  margin: auto;
  padding: 22px 16px;
}

/* HEADER */

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

.header h1 {
  font-size: 23px;
  margin-top: 5px;
}

.small-text {
  color: var(--green);
  font-size: 11px;
  letter-spacing: 2px;
}

.muted,
.balance-note {
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
}

/* BALANCE */

.balance-card {
  background: linear-gradient(135deg, #176e56, #163c4d);
  padding: 25px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.balance-card p {
  color: #d0f4e7;
  font-size: 14px;
}

.balance-card h2 {
  font-size: 34px;
  margin: 15px 0;
  overflow-wrap: anywhere;
}

/* SUMMARY */

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card,
.section-card,
.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 18px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-card h3 {
  margin-top: 12px;
  font-size: 19px;
  overflow-wrap: anywhere;
}

.income-card h3 {
  color: var(--green);
}

.expense-card h3 {
  color: var(--red);
}

/* SECTIONS */

.section-card {
  margin-bottom: 18px;
}

.section-card h2,
.auth-card h2 {
  font-size: 18px;
  margin-bottom: 17px;
}

/* INPUTS */

input,
select {
  display: block;
  width: 100%;
  padding: 14px;
  margin: 8px 0 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-light);
  color: white;
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--green);
}

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

label {
  font-size: 13px;
  color: var(--muted);
}

/* BUTTONS */

.primary-btn {
  display: block;
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 11px;
  background: var(--green);
  color: #08251d;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.2s;
}

.primary-btn:hover {
  opacity: 0.9;
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.text-btn {
  background: none;
  border: none;
  color: var(--green);
  cursor: pointer;
  margin-top: 18px;
  font-size: 13px;
}

.logout-btn {
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: white;
  background: var(--card);
  cursor: pointer;
}

/* TRANSACTION TYPE SELECTOR */

.type-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.type-selector label {
  cursor: pointer;
  min-width: 0;
}

.type-selector input {
  display: none;
}

.type-selector span {
  display: block;
  padding: 13px 5px;
  text-align: center;
  background: var(--card-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  transition: 0.2s;
}

.type-selector input:checked + span {
  background: var(--green);
  border-color: var(--green);
  color: #08251d;
  font-weight: bold;
}

/* ACCOUNTS AND TRANSACTIONS */

.account-item,
.transaction-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.account-name,
.transaction-info {
  flex: 1;
  min-width: 0;
}

.account-name p,
.transaction-info p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.transaction-amount {
  font-weight: bold;
  white-space: nowrap;
}

.income-text {
  color: var(--green);
}

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

/* TRANSACTION ACTION BUTTONS */

.transaction-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 8px;
  flex-shrink: 0;
}

.transaction-actions button {
  width: auto;
  padding: 7px 10px;
  white-space: nowrap;
  border-radius: 7px;
}

/* SECTION HEADING */

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 25px 5px;
  font-size: 13px;
}

/* AUTHENTICATION */

.auth-card {
  margin-top: 35px;
}

.auth-card form {
  margin-top: 22px;
}

/* MESSAGES */

.message {
  font-size: 13px;
  margin-top: 12px;
  color: var(--green);
  overflow-wrap: anywhere;
}

/* HIDDEN */

.hidden {
  display: none !important;
}

/* FOOTER */

footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  padding: 25px 0;
  line-height: 2;
}

/* CUSTOM CONFIRMATION MODAL */

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.confirm-overlay.hidden {
  display: none !important;
}

.confirm-box {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  animation: modalAppear 0.2s ease-out;
}

.confirm-box h3 {
  margin: 0 0 12px;
  font-size: 20px;
}

.confirm-box p {
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 22px;
  font-size: 14px;
}

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

.confirm-actions button {
  width: auto;
  min-width: 90px;
  margin: 0;
  padding: 11px 15px;
}

.confirm-actions .text-btn {
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
}

#confirmProceed {
  background: var(--red);
  color: white;
  border: none;
}

#confirmProceed:hover {
  background: #e5485a;
}

/* EDIT TRANSACTION MODAL */

#editTransactionModal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  padding: 24px 16px;
  overflow-y: auto;
  background: var(--background);
  border-radius: 0;
  border: none;
}

#editTransactionModal.hidden {
  display: none !important;
}

#editTransactionModal form {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

#editTransactionModal h2 {
  width: 100%;
  max-width: 500px;
  margin: 0 auto 20px;
}

/* ANIMATION */

@keyframes modalAppear {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }

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

/* RESPONSIVE */

@media (min-width: 600px) {
  .app-container {
    padding-top: 35px;
  }
}

@media (max-width: 480px) {
  .transaction-actions {
    gap: 7px;
    margin-left: 5px;
  }

  .transaction-actions button {
    padding: 7px 6px;
    font-size: 12px;
  }

  .transaction-item {
    gap: 7px;
  }

  .summary-card {
    padding: 14px;
  }

  .summary-card h3 {
    font-size: 17px;
  }

  .balance-card h2 {
    font-size: 30px;
  }
}

/* EXPENSE CATEGORY BREAKDOWN */

.section-description {
  color: var(--muted);
  font-size: 13px;
  margin: -8px 0 18px;
}

.category-total-card {
  background: var(--card-light);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 18px 0;
}

.category-total-card span {
  color: var(--muted);
  font-size: 13px;
}

.category-total-card h3 {
  color: var(--red);
  font-size: 25px;
  margin-top: 7px;
}

.expense-category-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.category-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.category-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.category-item-name {
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}

.category-item-amount {
  color: var(--red);
  font-weight: 600;
  font-size: 14px;
}

.category-progress-track {
  height: 8px;
  background: var(--card-light);
  border-radius: 20px;
  overflow: hidden;
}

.category-progress-fill {
  height: 100%;
  background: var(--red);
  border-radius: 20px;
  transition: width 0.3s ease;
}

.category-item-footer {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

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

/* CHARTS & ANALYTICS */

.chart-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0;
}

.chart-controls label {
  color: var(--muted);
  font-size: 13px;
}

.chart-controls select {
  width: 100%;
  padding: 12px;
  background: var(--card-light);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 18px;
  min-width: 0;
}

.chart-card h3 {
  color: var(--text);
  font-size: 15px;
  margin-bottom: 18px;
}

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

@media (min-width: 600px) {
  .chart-controls {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: center;
  }
}
