/* Kaasi - Expense Tracker - style.css */

/* ------------------------- */
/* --- ROOT VARIABLES --- */
/* ------------------------- */
:root {
  /* Base Dark Theme Palette - Black/Grey Focus (Default) */
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-tertiary: #2c2c2c;
  --bg-quaternary: #3a3a3a;

  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --text-placeholder: #757575;
  --text-on-accent: #ffffff; /* Text color for on top of accent buttons */

  /* Accent Colors (Remains consistent across themes) */
  --accent-primary: #e67e26;
  --accent-primary-rgb: 230, 126, 38;
  --accent-hover: #d35400;

  /* Semantic Colors (Dark Theme) */
  --income-color: #27ae60;
  --expense-color: #c0392b;
  --income-color-rgb: 39, 174, 96;
  --expense-color-rgb: 192, 57, 43;

  --success-indicator-color: var(--income-color);
  --danger-indicator-color: var(--expense-color);

  --info-color: var(--accent-primary);
  --warning-color: #f39c12;
  --warning-color-rgb: 243, 156, 18;

  /* Button Specifics (Dark Theme) */
  --button-primary-bg: var(--accent-primary);
  --button-primary-hover-bg: var(--accent-hover);
  --button-secondary-bg: var(--bg-quaternary);
  --button-secondary-hover-bg: #4a4a4a;
  --button-secondary-text: var(--text-primary);
  --button-secondary-border: var(--border-light);
  --button-secondary-hover-border: #5e5e5e;

  --button-success-bg: var(--income-color);
  --button-danger-bg: var(--expense-color);
  --danger-hover: #a93226;

  /* Borders & Shadows (Dark Theme) */
  --border-color: #3a3a3a;
  --border-light: #4e4e4e;
  --border-focus: var(--accent-primary);
  --shadow-color: rgba(0, 0, 0, 0.3);
  --shadow-color-light: rgba(0, 0, 0, 0.15);

  /* Progress Ring (Dark Theme) */
  --ring-progress-color: var(--accent-primary);
  --ring-bg-color: var(--bg-quaternary);
  --ring-text-color: var(--text-primary);

  /* Chart Colors (Dark Theme) */
  --chart-grid-color: rgba(255, 255, 255, 0.1);
  --chart-tick-color: #aaa;
  --chart-legend-color: #e0e0e0;
  --chart-tooltip-bg: rgba(0, 0, 0, 0.8);
  --chart-tooltip-text: #fff;

  /* Font */
  --font-family-sans: "Satoshi", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ------------------------- */
/* --- GLOBAL STYLES --- */
/* ------------------------- */
html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* ------------------------- */
/* --- PRELOADER --- */
/* ------------------------- */
#preloader {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary); /* Uses theme variable */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

#preloader.hidden {
  opacity: 0;
  pointer-events: none;
}

.pulsing-icon-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

#preloader-logo-icon {
  width: 72px;
  height: 72px;
  filter: drop-shadow(0 0 10px rgba(var(--accent-primary-rgb), 0.4));
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 8px rgba(var(--accent-primary-rgb), 0.35));
  }
  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 18px rgba(var(--accent-primary-rgb), 0.55))
      drop-shadow(0 0 5px rgba(var(--accent-hover), 0.3));
  }
}

#app-content {
  opacity: 0;
  transition: opacity 0.75s cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: 0.1s;
}

#app-content.visible {
  opacity: 1;
}

/* ------------------------- */
/* --- UTILITY CLASSES --- */
/* ------------------------- */
.accent-bg {
  background-color: var(--accent-primary);
}
.accent-text {
  color: var(--accent-primary);
}
.accent-border {
  border-color: var(--accent-primary);
}
.text-income {
  color: var(--income-color);
}
.text-expense {
  color: var(--expense-color);
}
.text-indicator-good {
  color: var(--success-indicator-color);
}
.text-indicator-bad {
  color: var(--danger-indicator-color);
}
.text-success {
  color: var(--success-indicator-color);
}
.text-danger {
  color: var(--expense-color);
}
.text-info {
  color: var(--info-color);
}
.text-warning {
  color: var(--warning-color);
}
.force-word-wrap {
  overflow-wrap: break-word; /* The standard property */
  word-wrap: break-word; /* Older property for broader browser support */
  word-break: break-word; /* Another option to help break long words */
  white-space: normal; /* Ensure text wraps normally */
}
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ------------------------- */
/* --- FORM ELEMENTS --- */
/* ------------------------- */
input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"], /* Ensure type="search" is included here */
textarea,
select {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem; /* 6px */
  font-size: 0.875rem; /* 14px */
  line-height: 1.25rem; /* 20px */
  padding-top: 0.7rem; /* 11.2px */
  padding-bottom: 0.7rem; /* 11.2px */
  padding-left: 0.95rem; /* 15.2px */
  padding-right: 0.95rem; /* Default padding for all sides */
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out,
    background-color 0.2s ease-in-out, color 0.2s ease-in-out;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  height: calc(
    1.25rem + (0.7rem * 2) + 2px
  ); /* Approx 2.775rem or 44.4px if 1rem = 16px */
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23a0a0a0' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-position: right 0.75rem center;
  background-repeat: no-repeat;
  background-size: 1.25em 1.25em;
  padding-right: 3rem;
  text-indent: 0.25rem;
}

#monthlyViewModal #yearSelector {
  background-color: var(--bg-tertiary); /* Match card background */
  color: var(--text-primary);
  border: 1px solid var(--border-color); /* Match card/input border */
  border-radius: 0.375rem; /* Consistent rounding */
  padding-top: 0.5rem; /* Adjusted padding for a select element */
  padding-bottom: 0.5rem;
  padding-left: 0.75rem;
  padding-right: 2.5rem; /* Keep space for the dropdown arrow */
  font-size: 0.875rem; /* text-sm */
  line-height: 1.25rem;
  min-width: 120px; /* Keep a minimum width */
  width: auto; /* Allow it to size based on content or min-width */
  height: auto; /* Override fixed height from general select rule if needed for padding */
  /* Ensure Tailwind's bg-gray-700 and border-gray-600 are overridden */
  /* The specificity of #monthlyViewModal #yearSelector should be enough */
}

/* Ensure focus style is consistent */
#monthlyViewModal #yearSelector:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(
    --bg-secondary
  ); /* Slightly change bg on focus, consistent with other inputs */
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.4);
}

textarea {
  line-height: 1.5;
  min-height: 80px;
  height: auto;
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.4);
}

::placeholder {
  color: var(--text-placeholder);
  opacity: 1;
}

.disclaimer-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background-color: rgba(var(--warning-color-rgb), 0.1);
  padding: 0.875rem 1rem;
  border-radius: 0.375rem;
  margin-top: 0.75rem;
  border: 1px solid rgba(var(--warning-color-rgb), 0.3);
  line-height: 1.5;
}
.disclaimer-text i.fas {
  color: var(--warning-color);
  margin-right: 0.5rem;
}
.disclaimer-text strong {
  color: var(--text-primary);
  font-weight: 500;
}

/* ------------------------- */
/* --- BUTTONS --- */
/* ------------------------- */
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px var(--shadow-color-light);
  user-select: none;
}
.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

.btn-primary {
  background-color: var(--button-primary-bg);
  color: var(--text-on-accent);
  border-color: var(--button-primary-bg);
}
.btn-primary:hover {
  background-color: var(--button-primary-hover-bg);
  border-color: var(--button-primary-hover-bg);
  box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.3);
}

.btn-secondary {
  background-color: var(--button-secondary-bg);
  color: var(--button-secondary-text);
  border-color: var(--button-secondary-border);
}
.btn-secondary:hover {
  background-color: var(--button-secondary-hover-bg);
  border-color: var(--button-secondary-hover-border);
}

.btn-danger {
  background-color: var(--button-danger-bg);
  color: white;
  border-color: var(--button-danger-bg);
}
.btn-danger:hover {
  background-color: var(--danger-hover);
  border-color: var(--danger-hover);
  box-shadow: 0 2px 8px rgba(var(--expense-color-rgb), 0.3);
}

.btn-outline {
  background-color: transparent;
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  box-shadow: none;
}
.btn-outline:hover {
  background-color: rgba(var(--accent-primary-rgb), 0.1);
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-outline-expense {
  background-color: transparent;
  color: var(--expense-color);
  border: 1px solid var(--expense-color);
  box-shadow: none;
}
.btn-outline-expense:hover {
  background-color: rgba(var(--expense-color-rgb), 0.1);
  color: #a93226;
  border-color: #a93226;
}

.btn-outline-income {
  background-color: transparent;
  color: var(--income-color);
  border: 1px solid var(--income-color);
  box-shadow: none;
}
.btn-outline-income:hover {
  background-color: rgba(var(--income-color-rgb), 0.1);
  color: #1e8449;
  border-color: #1e8449;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 50%;
  line-height: 1;
  box-shadow: none;
}
.btn-icon:hover {
  color: var(--text-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.15);
}

/* ------------------------- */
/* --- ACCOUNT HIDE/SHOW --- */
/* ------------------------- */
.btn-icon-hide {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, transform 0.2s;
}

.btn-icon-hide:hover {
  color: var(--text-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.1);
}

.btn-icon-hide .fa-eye-slash {
  color: var(--expense-color); /* Red for hidden state */
}

.btn-icon-hide:hover .fa-eye-slash {
  color: var(--danger-hover);
}

.account-row-hidden {
  opacity: 0.5;
  transition: opacity 0.3s ease-in-out;
}

.account-row-hidden input {
  text-decoration: line-through;
  color: var(--text-secondary) !important;
}

/* ------------------------- */
/* --- CARDS --- */
/* ------------------------- */
.card {
  background-color: var(--bg-secondary);
  border-radius: 0.75rem;
  padding: 1.75rem;
  box-shadow: 0 8px 16px var(--shadow-color),
    0 3px 6px var(--shadow-color-light);
  border: 1px solid var(--border-color);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out,
    background-color 0.3s, border-color 0.3s;
}

/* ------------------------- */
/* --- CHARTS --- */
/* ------------------------- */
.chart-container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.chart-container canvas {
  max-width: 100%;
  max-height: 100%;
}

/* ------------------------- */
/* --- MODALS --- */
/* ------------------------- */
.modal {
  display: none;
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  background-color: rgba(18, 18, 18, 0.85);
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
}

#monthlyViewModal,
#settingsModal,
#debtsViewModal,
#receivablesViewModal {
  z-index: 50;
}
#ccHistoryModal {
  z-index: 52;
}
#formModal {
  /* Also for backup reminder if it uses formModal */
  z-index: 55;
}
#confirmationModal {
  /* Higher z-index for confirmations */
  z-index: 70;
}
#initialSetupModal {
  z-index: 60; /* Needs to be high for initial setup */
}

.modal-content {
  background-color: var(--bg-secondary);
  margin: 5vh auto;
  padding: 2rem 2.5rem;
  border: 1px solid var(--border-color);
  width: 90%;
  max-width: 600px;
  border-radius: 0.75rem;
  position: relative;
  animation: slideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 10px 25px var(--shadow-color),
    0 5px 10px var(--shadow-color-light);
  transition: background-color 0.3s, border-color 0.3s;
}
.modal-content.max-w-sm {
  /* For confirmation modal */
  max-width: 384px; /* Tailwind's sm is 24rem = 384px */
}
.modal-content.max-w-md {
  max-width: 448px;
}
.modal-content.max-w-xl {
  max-width: 672px;
}
.modal-content.max-w-2xl {
  max-width: 768px;
}
.modal-content.max-w-4xl {
  max-width: 1024px;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  color: var(--text-secondary);
  font-size: 1.75rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: 50%;
  transition: color 0.2s, background-color 0.2s;
}
.modal-close:hover {
  color: var(--text-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.15);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideIn {
  from {
    transform: translateY(-25px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* ------------------------- */
/* --- TABS --- */
/* ------------------------- */
.tab-button {
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease-in-out;
  color: var(--text-secondary);
  font-weight: 500;
  border-radius: 0.375rem 0.375rem 0 0;
}
.tab-button.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.05);
}
.tab-button:hover:not(.active) {
  color: var(--text-primary);
  background-color: rgba(var(--accent-primary-rgb), 0.03);
}

.settings-tab-button {
  padding: 0.75rem 1.25rem;
  border-bottom-width: 2px;
  border-color: transparent;
  color: var(--text-secondary);
  transition: color 0.2s ease-in-out, border-color 0.2s ease-in-out,
    background-color 0.2s ease-in-out;
  cursor: pointer;
  background-color: transparent;
  outline: none;
  font-weight: 500;
  border-radius: 0.375rem 0.375rem 0 0;
}
.settings-tab-button:hover:not(.active) {
  color: var(--text-primary);
  background-color: var(--bg-tertiary);
}
.settings-tab-button.active {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
  font-weight: 600;
  background-color: var(--bg-secondary);
}
#settingsTabsContainer li {
  margin-right: 0.125rem;
}
#settingsTabsContainer li:last-child {
  margin-right: 0;
}

/* ------------------------- */
/* --- SCROLLBARS --- */
/* ------------------------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--bg-quaternary);
  border-radius: 10px;
  border: 2px solid var(--bg-tertiary);
}
::-webkit-scrollbar-thumb:hover {
  background: #5e5e5e;
}

/* ------------------------- */
/* --- SLIDE TO CONFIRM (DELETE) --- */
/* ------------------------- */
.slide-to-confirm-container {
  width: 100%;
  height: 50px;
  background-color: var(--bg-quaternary);
  border-radius: 25px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--border-light);
}
.slide-to-confirm-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--text-secondary);
  font-weight: 500;
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.2s ease-out;
}
.slide-to-confirm-handle {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 46px;
  height: 46px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  cursor: grab;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  transition: background-color 0.2s, transform 0.1s ease-out;
}
.slide-to-confirm-handle:active {
  cursor: grabbing;
  background-color: var(--accent-hover);
}
.slide-to-confirm-track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  background-color: var(--button-success-bg);
  border-radius: 25px;
  opacity: 0.7;
  z-index: 0;
  transition: width 0.1s ease-out, background-color 0.2s ease-out;
}
.slide-to-confirm-container.confirmed .slide-to-confirm-text {
  opacity: 0;
}

/* ------------------------- */
/* --- TOOLTIPS --- */
/* ------------------------- */
[data-tooltip] {
  position: relative;
  cursor: pointer;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-out, visibility 0.2s ease-out,
    transform 0.2s ease-out;
  z-index: 1000;
  box-shadow: 0 2px 5px var(--shadow-color);
}
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-2px);
}

/* ------------------------- */
/* --- LINKS & LINK-STYLE BUTTONS --- */
/* ------------------------- */
a,
.link-style {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s, text-decoration-color 0.2s;
}
a:hover,
.link-style:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-decoration-color: rgba(var(--accent-primary-rgb), 0.5);
}
button.link-style {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

/* ------------------------- */
/* --- MONTHLY VIEW SPECIFIC STYLES --- */
/* ------------------------- */
.monthly-view-summary-card {
  background-color: var(--bg-tertiary);
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  text-align: center;
  box-shadow: 0 2px 4px var(--shadow-color-light);
}
.monthly-view-day-group {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}
.monthly-view-day-header {
  background-color: var(--bg-tertiary);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
}
.monthly-view-transaction-item {
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}
.monthly-view-transaction-item:last-child {
  border-bottom: none;
}
.monthly-view-transaction-item:hover {
  background-color: rgba(var(--accent-primary-rgb), 0.05);
}

.monthly-view-category-list li {
  padding: 0.4rem 0;
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed var(--border-color);
}
.monthly-view-category-list li:last-child {
  border-bottom: none;
}

.edit-btn-container {
  display: inline-flex;
  align-items: center;
}
.edit-btn-container button {
  margin-left: 0.75rem;
  padding: 0.25rem;
}
.edit-btn-container button i {
  font-size: 0.8rem;
}

.spending-indicator {
  font-size: 0.8rem;
  margin-left: 0.3rem;
}

/* --------------------------------- */
/* --- CC HISTORY MODAL REFACTOR --- */
/* --------------------------------- */

/* Style for the year selector dropdown to match the monthly view's */
#ccHistoryModal #ccYearSelector {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.5rem 2.5rem 0.5rem 0.75rem; /* top/bottom, right, left */
  font-size: 0.875rem;
  line-height: 1.25rem;
  min-width: 120px;
  width: auto;
  height: auto;
}

#ccHistoryModal #ccYearSelector:focus {
  outline: none;
  border-color: var(--border-focus);
  background-color: var(--bg-secondary);
  box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.4);
}

/* Styles for the month group accordion */
.cc-history-month-group {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  overflow: hidden;
}

.cc-history-month-header {
  background-color: var(--bg-tertiary);
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
}

.cc-history-month-header:hover {
  background-color: var(--bg-quaternary);
}

.cc-history-transactions-container {
  overflow: hidden;
  transition: max-height 0.35s ease-in-out;
  max-height: 0; /* Collapsed by default */
}

.cc-history-transaction-item {
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s;
}
.cc-history-transaction-item:last-child {
  border-bottom: none;
}

.cc-history-transaction-item:hover {
  background-color: rgba(var(--accent-primary-rgb), 0.05);
}

/* NEW: Active state for CC history filter buttons */
#ccHistoryFilterControls .btn.active {
  background-color: var(--accent-primary);
  color: var(--text-on-accent);
  border-color: var(--accent-primary);
  box-shadow: 0 2px 8px rgba(var(--accent-primary-rgb), 0.2);
}

/* ------------------------- */
/* --- INSTALLMENT PROGRESS RING --- */
/* ------------------------- */
.installment-progress-ring-container svg {
  transform: rotate(-90deg);
}
.progress-ring-bg {
  stroke: var(--ring-bg-color);
  transition: stroke 0.3s ease;
}
.progress-ring-circle {
  stroke: var(--ring-progress-color);
  transition: stroke-dasharray 0.5s ease-out, stroke 0.3s ease;
}
.progress-ring-text {
  font-family: var(--font-family-sans);
  font-weight: 700;
  font-size: 11px;
  fill: var(--ring-text-color);
  dominant-baseline: middle;
  text-anchor: middle;
  transform: rotate(90deg) translate(0, -36px) translate(0, 36px);
  transform-origin: center;
}
.installment-progress-ring-container:hover .progress-ring-bg {
  stroke: #5e5e5e;
}
.installment-progress-ring-container:hover .progress-ring-circle {
  stroke: var(--accent-hover);
}

/* ------------------------- */
/* --- LOGOS --- */
/* ------------------------- */
#header-logo-container img {
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}
#personal-logo {
  height: 40px;
  width: auto;
  margin-top: 0.75rem;
  opacity: 0.8;
}

/* ------------------------- */
/* --- CUSTOM TOGGLE SWITCH (Tailwind Peer) --- */
/* ------------------------- */
input[type="checkbox"].peer + div {
  background-color: var(--bg-quaternary);
  transition-property: background-color, border-color, text-decoration-color,
    fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}
input[type="checkbox"].peer:checked + div {
  background-color: var(--accent-primary);
}
input[type="checkbox"].peer:focus-visible + div {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ------------------------- */
/* --- RESPONSIVE ADJUSTMENTS --- */
/* ------------------------- */
@media (max-width: 768px) {
  /* md breakpoint */
  .modal-content {
    margin: 5vh auto;
    width: 95%;
    padding: 1.5rem 1.75rem;
  }
  .main-content-grid {
    grid-template-columns: 1fr;
  }
  .tab-button {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }
  #header-logo-container img {
    height: 2.5rem;
  }
  h2 {
    font-size: 1.2rem;
  }
  h3 {
    font-size: 1.05rem;
  }
  .card {
    padding: 1.25rem;
  }
  .btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.9rem;
  }
  .monthly-view-content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  /* sm breakpoint or smaller */
  .modal-content {
    padding: 1.25rem;
    margin: 2.5vh auto;
  }
  .tab-button {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  #header-logo-container img {
    height: 2.25rem;
  }
  h2 {
    font-size: 1.1rem;
  }
  h3 {
    font-size: 1rem;
  }
  .card {
    padding: 1rem;
  }
  .btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
  }
  .hide-on-small {
    display: none !important;
  }
  .monthly-view-summary-grid {
    grid-template-columns: 1fr;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  textarea,
  select {
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
    padding-left: 0.95rem;
    padding-right: 0.95rem;
    height: calc(1.25rem + (0.7rem * 2) + 2px);
  }
  select {
    background-position: right 0.75rem center;
    padding-right: 3rem;
  }
  textarea {
    height: auto;
    min-height: 80px;
  }
}

.day-transactions-container {
  overflow: hidden;
  transition: max-height 0.35s ease-in-out;
  max-height: 0;
}

/* ------------------------------------ */
/* --- CONFIRMATION MODAL SPECIFICS --- */
/* ------------------------------------ */

#confirmationModalTitle {
  /* Tailwind text-xl font-semibold mb-4 applied in HTML */
  /* Color will be inherited or you can set it, e.g.: */
  /* color: var(--accent-primary); */
  color: var(
    --text-primary
  ); /* Ensure it uses the theme's primary text color */
}

#confirmationMessage {
  /* Tailwind text-gray-300 mb-6 applied in HTML */
  /* Overriding Tailwind's text-gray-300 to use theme variable for message color */
  color: var(
    --text-secondary
  ); /* Makes it slightly less prominent than title */
  line-height: 1.6; /* Ensures good readability */
  white-space: pre-line; /* Allows \n in JS to create line breaks in the modal message */
  font-size: 0.95rem; /* Slightly larger for readability */
}

/* The button container already has flex, justify-center, gap-4 from HTML */
/* #confirmationModal .flex { */
/* margin-top: 1.5rem; /* mb-6 on #confirmationMessage should provide enough space */
/* } */

/* Specific styling for confirm button if needed beyond .btn-danger */
/* #confirmModalConfirmBtn { */
/* e.g., min-width: 100px; */
/* } */

/* Specific styling for cancel button if needed beyond .btn-secondary */
/* #confirmModalCancelBtn { */
/* e.g., min-width: 100px; */
/* } */

/* ------------------------------------ */
/* --- MONTHLY VIEW SEARCH INPUT --- */
/* ------------------------------------ */
/* The parent div with "my-4 flex items-center gap-x-2" handles spacing */
/* #monthlySearchInput itself will use the general input styles */

#monthlySearchInput::placeholder {
  color: var(--text-placeholder);
  font-style: italic;
  font-size: 0.85rem;
}

/* Styling for the custom clear button (now external) */
.btn-icon-clear-search {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-quaternary);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  /* Remove specific padding that might conflict with fixed height and icon centering */
  /* padding: 0.5rem; */
  border-radius: 0.375rem;
  line-height: 1; /* Important for icon vertical alignment */
  transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out,
    border-color 0.2s ease-in-out;
  cursor: pointer;
  /* Explicitly set height and width to match the input field's calculated height */
  height: calc(1.25rem + (0.7rem * 2) + 2px);
  width: calc(
    1.25rem + (0.7rem * 2) + 2px
  ); /* Make it square, same as height */
  flex-shrink: 0; /* Ensure it doesn't shrink (already in HTML via Tailwind) */
}

.btn-icon-clear-search:not(.hidden) {
  display: inline-flex !important;
}

.btn-icon-clear-search:hover,
.btn-icon-clear-search:focus {
  background-color: var(--button-secondary-hover-bg);
  color: var(--accent-primary);
  border-color: var(--button-secondary-hover-border);
  outline: none;
}

.btn-icon-clear-search i.fas {
  font-size: 0.9rem; /* Icon size */
  /* line-height: 1; /* Already on button, should be fine */
}

/* Style for disabled clear button */
.btn-icon-clear-search:disabled {
  background-color: var(--bg-tertiary); /* More subdued background */
  color: var(--text-placeholder); /* Dimmer icon color */
  border-color: var(--border-color);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Hide browser's default clear button for search inputs */
#monthlySearchInput::-webkit-search-decoration,
#monthlySearchInput::-webkit-search-cancel-button,
#monthlySearchInput::-webkit-search-results-button,
#monthlySearchInput::-webkit-search-results-decoration {
  -webkit-appearance: none;
  display: none;
}
input[type="search"]::-moz-search-clear-button {
  display: none;
}

/* --- NEW: Search Scope Dropdown Style --- */
#searchScopeSelect {
  /* Overrides the default 100% width for this specific select element */
  width: auto;
  /* Adjust padding to be slightly less horizontal for a more compact look */
  padding-left: 0.75rem;
  padding-right: 2.5rem; /* Keep space for the dropdown arrow */
}

/* --- FOOTER LINKS --- */
/* This targets the 'Donate' button and 'Main Website' link */
footer #footerDonateBtn,
footer a[href^="https://kaasi.com.lk"]
{
  font-weight: 700; /* bold */
  color: var(--text-secondary);
  transition: color 0.2s ease-in-out;
  text-decoration: none; /* remove underline from link */
  background: none; /* ensure no background */
  border: none; /* ensure no border */
  padding: 0; /* remove default button padding */
  cursor: pointer;
}

footer #footerDonateBtn:hover,
footer a[href^="https://kaasi.com.lk"]:hover
{
  color: var(--accent-primary); /* orange on hover */
  text-decoration: none; /* ensure no underline on hover */
}

/* --- DONATE MODAL SPECIFICS --- */
#donateModal .modal-content {
  background-color: #18181b; /* A slightly different dark shade from landing page */
  border-radius: 1rem; /* 16px */
  padding: 2rem;
  max-width: 600px;
  border: 1px solid var(--border-color);
}

.donate-bank-details-vertical {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}
.donate-bank-block {
  margin-bottom: 0.3rem;
}
.bank-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}
.bank-pair {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.1rem;
}
.bank-label {
  color: var(--text-secondary);
  min-width: 56px;
  font-size: 0.97rem;
}
.bank-value {
  color: var(--text-primary);
  font-weight: 500;
  letter-spacing: 0.01em;
  font-size: 1rem;
}
.copy-button {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: none;
  border-radius: 0.375rem;
  padding: 0.25rem 0.6rem;
  margin-left: auto; /* Pushes button to the right */
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.copy-button:hover {
  background-color: var(--bg-quaternary);
  color: var(--text-primary);
}

/* --- NEW: SUPABASE & DATA MANAGEMENT STYLES --- */

/* Style for the Google login button */
#googleLoginBtn {
  background-color: #4285F4; /* Google Blue */
  border-color: #4285F4;
  color: white;
}
#googleLoginBtn:hover {
  background-color: #357ae8;
  border-color: #357ae8;
  box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
}

/* Style for the shortcut radio buttons when disabled */
/* This styles the label text (e.g., "Cloud Backup") */
#shortcutTargetGroup label:has(input[type="radio"]:disabled) {
  color: var(--text-placeholder);
  cursor: not-allowed;
  opacity: 0.6;
}

/* This styles the radio button itself */
#shortcutTargetGroup input[type="radio"]:disabled {
  cursor: not-allowed;
  background-color: var(--bg-tertiary);
  border-color: var(--border-color);
}

/* --- NEW: Header Button Mobile Consistency --- */
@media (max-width: 767px) { /* Tailwind 'md' breakpoint */
  #monthlyViewBtn,
  #headerBackupBtn,
  #headerRestoreBtn {
    padding-left: 0;
    padding-right: 0;
    width: 2.75rem; /* 44px */
    height: 2.75rem; /* 44px */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  /* Ensure icon-only buttons in the header have their icons sized appropriately */
  #monthlyViewBtn i,
  #headerBackupBtn i,
  #headerRestoreBtn i {
    font-size: 1rem; /* 16px */
    line-height: 1;
  }
}

