/* Google Material Design light-theme styling for Galaxy Finance System */
:root {
  --bg-color: #f8f9fa; /* Google Workspace Light Background */
  --card-bg: #ffffff;
  --border-color: #dadce0; /* Thin Google grey border */
  --text-main: #202124; /* Google Dark Charcoal */
  --text-muted: #5f6368; /* Google Muted Grey */
  
  --primary: #1a73e8; /* Google Blue */
  --primary-hover: #1557b0;
  --primary-glow: rgba(26, 115, 232, 0.15);
  
  --income: #1e8e3e; /* Google Green */
  --income-hover: #137333;
  --income-glow: rgba(30, 142, 62, 0.15);
  
  --expense: #d93025; /* Google Red */
  --expense-hover: #a51d24;
  --expense-glow: rgba(217, 48, 37, 0.15);
  
  --font-title: 'Roboto', 'Inter', system-ui, sans-serif;
  --font-body: 'Roboto', 'Inter', system-ui, sans-serif;
  
  --shadow-sm: 0 1px 2px 0 rgba(60,64,67,0.3), 0 1px 3px 1px rgba(60,64,67,0.15);
  --shadow-md: 0 1px 3px 0 rgba(60,64,67,0.3), 0 4px 8px 3px rgba(60,64,67,0.15);
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
}

.app-container {
  width: 100%;
  max-width: 1300px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header Styles (Google Workspace Navbar look) */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  animation: slideDown 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.logo-text h1 {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.logo-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Google-style Pill Tab switcher */
.account-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.2rem;
  background: #f1f3f4;
  border-radius: 20px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.45rem 1rem;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.04);
}

.tab-btn.active {
  color: var(--primary);
  background: #e8f0fe;
}

.tab-btn svg {
  width: 16px;
  height: 16px;
}

/* Stats Cards (Thin colored top borders like Google Forms) */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  transition: border-color 0.2s ease;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 8px 8px 0 0;
}

.stat-card:hover {
  border-color: #b0b3b8;
}

.balance-card::after { background: var(--primary); }
.income-card::after { background: var(--income); }
.expense-card::after { background: var(--expense); }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.3px;
}

.stat-value {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-main);
}

.stat-indicator {
  font-size: 0.75rem;
  color: var(--income);
  font-weight: 600;
}

.trend-up {
  font-size: 0.75rem;
  color: var(--income);
  font-weight: 600;
}

.trend-down {
  font-size: 0.75rem;
  color: var(--expense);
  font-weight: 600;
}

/* View Sections Toggle */
.view-section {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.view-section.active {
  display: block;
}

/* Detail Page Header Section */
.detail-page-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem 0;
}

.detail-view-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Google Sheets/Drive unified list panel */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Form Fields Styling (Standard Material/Bootstrap Light styling) */
form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
}

.input-glow {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.6rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
}

.input-glow:focus {
  border-color: var(--primary);
  background: var(--card-bg);
}

textarea.input-glow {
  resize: vertical;
}

/* File Upload input button */
.file-upload-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.file-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.file-name-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  word-break: break-all;
}

/* Buttons */
.btn {
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

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

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

.btn-secondary:hover {
  background: #f1f3f4;
  color: var(--text-main);
}

.btn-block {
  width: 100%;
}

.submit-btn {
  margin-top: 0.5rem;
  height: 44px;
  font-weight: 700;
  border-radius: 4px;
}

/* Google-style Pill Registration Buttons */
.btn-income-btn {
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  background: var(--income);
  color: #fff;
  font-weight: 700;
  border: 1px solid transparent;
  transition: background-color 0.2s ease;
}

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

.btn-expense-btn {
  font-size: 0.85rem;
  padding: 0.5rem 1.25rem;
  border-radius: 20px;
  background: var(--expense);
  color: #fff;
  font-weight: 700;
  border: 1px solid transparent;
  transition: background-color 0.2s ease;
}

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

/* Transaction History Card (Full Width Sheets style) */
.history-card {
  display: flex;
  flex-direction: column;
  height: 620px;
  width: 100%;
  padding: 1.25rem 1.5rem;
}

.full-width-card {
  width: 100%;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.search-box input {
  background: #f1f3f4;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  color: var(--text-main);
  outline: none;
  font-size: 0.85rem;
  width: 200px;
  transition: all 0.2s ease;
}

.search-box input:focus {
  background: #fff;
  border-color: var(--primary);
  width: 260px;
}

/* Google-style filter row */
.filters-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  background: #f8f9fa;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.filter-group label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
}

.filter-group select, .filter-group input {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem 0.55rem;
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.btn-icon-reset {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.4rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 31px;
  transition: all 0.2s ease;
}

.btn-icon-reset:hover {
  background: #f1f3f4;
  color: var(--text-main);
}

/* Table Style stacked records wrapper */
.records-list-wrapper {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
}

/* Custom Scrollbar */
.records-list-wrapper::-webkit-scrollbar {
  width: 6px;
}
.records-list-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.02);
}
.records-list-wrapper::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}
.records-list-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.25);
}

.records-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  gap: 0.5rem;
  padding: 2rem;
}

.empty-icon {
  font-size: 2rem;
  opacity: 0.5;
}

.records-list {
  display: flex;
  flex-direction: column;
}

/* Flat table rows with thin divider lines (Google Sheet style) */
.record-item {
  background: var(--card-bg);
  border-bottom: 1px solid #f1f3f4;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: background-color 0.15s ease;
  font-size: 0.9rem;
}

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

.record-item:hover {
  background-color: #f8f9fa;
}

.record-date-col {
  width: 90px;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.record-badges-col {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.record-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.badge-income {
  background: #e6f4ea; /* Google Green Tint */
  color: var(--income);
}

.badge-expense {
  background: #fce8e6; /* Google Red Tint */
  color: var(--expense);
}

.record-desc-col {
  flex: 1;
  color: var(--text-main);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0.5rem;
}

.record-attachment-col {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  max-width: 140px;
}

.record-attachment-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.75rem;
}

.record-attachment-link:hover {
  text-decoration: underline;
}

.record-amount-col {
  width: 120px;
  text-align: right;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.amount-income {
  color: var(--income);
}

.amount-expense {
  color: var(--expense);
}

.record-action-col {
  width: 32px;
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.btn-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.btn-delete:hover {
  background-color: #fce8e6;
  color: var(--expense);
}

/* Modal Overlay & Modal Dialog Card (Google Style Flat dialog look) */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(32, 33, 36, 0.5); /* Semi-transparent dark charcoal */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal-card {
  width: 90%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-md);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-card {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #f1f3f4;
  padding-bottom: 0.75rem;
}

.modal-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.close-modal-btn:hover {
  color: var(--text-main);
  background: #f1f3f4;
}

/* Animations */
@keyframes slideDown {
  from {
    transform: translateY(-10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tab-bal {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-left: 0.25rem;
  font-weight: 500;
  font-family: var(--font-body);
}
