:root {
  /* New Color Schema: Indigo/Teal */
  --primary-color: #5b4f8d; /* Indigo - Main UI/Active */
  --secondary-color: #20c997; /* Teal - Success/Add Button */
  --tertiary-color: #6c757d; /* Grey - Secondary Buttons */
  --money-color: #ffc107; /* Yellow/Gold - Money/Warning */
  --background-color: #f7f9fb; /* Light background */
  --card-background: #ffffff;
  --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-deep: 0 4px 12px rgba(0, 0, 0, 0.1);
  
  /* Font Sizing References */
  --font-size-base: 16px;
  --font-size-mobile: 14px;
 }
 
 /* --- 1. Base & Layout (Sticky Footer) --- */
 html { height: 100%; }
 body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  margin: 0;
 
  display: flex;
  flex-direction: column;
  min-height: 100vh;
 }

 .container {
  max-width: 600px;
  margin: 0 auto;
 
  padding: 20px;
  flex-grow: 1; 
 }
 h1 {
  color: #333;
  text-align: center;
  margin-bottom: 30px;
 }
 .card {
  background-color: var(--card-background);
  padding: 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-deep);
  margin-bottom: 20px;
 }
 .config-card {
  background-color: #e6f7ff; 
  border: 1px solid var(--primary-color);
  padding: 15px;
 }
 
 /* --- 2. Floating Navigation Bar --- */
 #floating-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  padding: 10px 20px;
  border-radius: 30px;
  box-shadow: var(--shadow-deep);
  z-index: 1000;
  display: flex;
  gap: 20px;
 }
 .nav-item {
  color: white;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 20px;
  transition: background-color 0.3s ease;
  display: flex;
  align-items: center;
  font-size: 14px;
 }
 .nav-item i { margin-right: 5px; }
 .nav-item:hover,
 .nav-item[data-view].active {
  background-color: var(--primary-color);
 }
 
 /* --- 3. Form and Input Styles --- */
 #initial-category-name,
 #task-addition-area input:not([type="checkbox"]):not([type="date"]) {
  width: calc(100% - 22px);
  padding: 10px;
  margin-bottom: 15px;
  border: 1px solid #ddd;
  border-radius: 5px;
  box-sizing: border-box;
 }
 #initial-category-name { flex-grow: 1; margin-bottom: 0 !important; }
 .input-pair { display: flex; gap: 10px; margin-bottom: 15px; }
 .input-pair input { flex-grow: 1; width: auto !important; }
 .rupee-symbol {
  display: flex; align-items: center; font-size: 18px; font-weight: bold; color: #555;
 }
 .active-category-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px; padding: 10px 0; border-bottom: 2px solid var(--primary-color);
 }
 .active-category-header h3 {
  margin: 0; font-size: 18px; color: var(--primary-color);
 }
 
 /* --- 4. Buttons & Toggle Switch --- */
 .add-button {
  width: 100%; padding: 12px 15px !important;
  background-color: var(--secondary-color) !important;
  color: white; border: none !important; border-radius: 5px; cursor: pointer;
  font-size: 16px; transition: background-color 0.3s ease;
 }
 .add-button i { margin-right: 5px; }
 .add-button:hover { background-color: #1a9e77 !important; }
 .secondary-button {
  padding: 10px 15px !important;
  background-color: var(--tertiary-color) !important;
  color: white; border: none !important; border-radius: 5px; cursor: pointer;
  font-size: 14px; transition: background-color 0.3s ease;
 }
 .secondary-button.small-button { padding: 5px 10px !important; }
 .secondary-button:disabled { background-color: #ccc !important; cursor: not-allowed; }
 
 .toggle-group {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px; padding: 5px 0; border-bottom: 1px solid #eee;
 }
 .switch { position: relative; display: inline-block; width: 45px; height: 26px; }
 .switch input { opacity: 0; width: 0; height: 0; }
 .slider {
  position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc; transition: 0.4s; border-radius: 26px;
 }
 .slider:before {
  position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px;
  background-color: white; transition: 0.4s; border-radius: 50%;
 }
 input:checked + .slider { background-color: var(--primary-color); }
 input:focus + .slider { box-shadow: 0 0 1px var(--primary-color); }
 input:checked + .slider:before { transform: translateX(19px); }
 
 
 /* --- 5. Task List --- */
 #task-list { list-style: none; padding: 0; }
 .task-category-item { margin-bottom: 15px; padding: 10px 0; }
 .category-header {
  display: flex; justify-content: space-between; align-items: center;
  background-color: var(--primary-color); color: white; padding: 10px 15px;
  border-radius: 5px 5px 0 0; font-weight: bold;
 }
 .category-tasks {
  list-style: none; padding: 0; background-color: var(--card-background);
  border-radius: 0 0 5px 5px; padding-top: 5px;
 }
 .task-list-item {
  padding: 10px 15px; margin-bottom: 5px; border-left: 3px solid var(--secondary-color);
  display: flex; justify-content: space-between; align-items: center; font-size: 14px;
 }
 .task-list-item.completed {
  opacity: 0.6; text-decoration: line-through; border-left-color: #ccc;
 }
 .task-list-item button {
  background-color: #dc3545; color: white; border: none; padding: 4px 8px;
  border-radius: 4px; cursor: pointer; font-size: 12px;
 }
 
 /* --- 6. Money Report & Charts --- */
 /* Money Report Grid FIX: Name (L) | Amount (C) | Percent (R) */
 .money-report {
   padding: 15px; background-color: var(--card-background);
   border-radius: 10px; box-shadow: var(--shadow-deep); margin-bottom: 30px;
 }
 .money-report-total { font-size: 16px; color: var(--primary-color); margin-bottom: 10px; }
 .money-report-list { list-style: none; padding: 0; margin: 0; }
 .money-report-list li {
  padding: 6px 10px; background-color: #f9f9f9; margin-bottom: 6px;
  border-radius: 5px; border-left: 4px solid var(--money-color); color: #333; font-weight: 500;
 }
 .money-report-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* Name | Amount | Percent */
  align-items: center;
 }
 .money-report-name { text-align: left; }
 .money-report-amount { text-align: center; font-weight: bold; }
 .money-report-pct { text-align: right; color: var(--tertiary-color); }
 .money-report-bar {
  width: 100%; height: 8px; background: #ddd; border-radius: 4px; margin-top: 4px; overflow: hidden;
  grid-column: 1 / span 3; 
 }
 .money-report-bar-fill {
  height: 100%; border-radius: 4px; transition: width 0.3s ease; background-color: var(--money-color);
 }
 
 /* Money Report Dropdown Styles (Filter/Sort) */
 #money-graph-view label { 
  font-weight: bold; 
  color: #555; 
  margin-right: 5px; 
  font-size: 0.95em; 
 }
 #money-time-filter, #money-sort-option {
  padding: 10px 15px; 
  border: 1px solid #ccc; 
  border-radius: 8px; 
  background-color: white; 
  appearance: none; 
  -webkit-appearance: none; 
  -moz-appearance: none;
  font-size: 1em; 
  cursor: pointer; 
  min-width: 120px; 
  transition: border-color 0.2s, box-shadow 0.2s;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23666%22%20d%3D%22M287%20113.7l-133%20133c-5%205-13%205-18%200l-133-133c-5-5-5-13%200-18l18-18c5-5%2013-5%2018%200l105%20105%20105-105c5-5%2013-5%2018%200l18%2018c5%205%205%2013%200%2018z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat; 
  background-position: right 10px center; 
  background-size: 10px;
  padding-right: 30px; 
 }
 #money-time-filter:hover, #money-sort-option:hover { 
  border-color: var(--primary-color); 
 }
 #money-time-filter:focus, #money-sort-option:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(91, 79, 141, 0.2);
  outline: none;
 }
 /* Chart Area */
 #chart-area { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-top: 20px; }
 #chart-area > div {
  background: var(--card-background); padding: 20px; border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); width: 100%; box-sizing: border-box;
 }
 #chart-area h3 { margin: 0 0 12px 0; font-size: 18px; font-weight: 600; color: #333; }
 #chart-area canvas { width: 100% !important;  height: auto !important;  max-height: none; }
 
 
 /* --- 7. Calendar View Styles --- */
 #calendar-view {
  padding: 20px; background-color: #f8f8f8; border-radius: 10px;
  box-shadow: var(--shadow-deep);
 }
 #calendar-controls {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 15px; font-size: 1.2em; font-weight: bold;
 }
 #current-month-year { color: #333; min-width: 150px; text-align: center; }
 #calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
 .day-name {
  text-align: center; font-weight: bold; color: #555; padding: 8px 0;
  background-color: #eee; border-radius: 5px 5px 0 0;
 }
 .calendar-day {
  min-height: 100px; padding: 5px; border: 1px solid #ddd; border-radius: 5px;
  background-color: white; box-shadow: var(--shadow-light); display: flex;
  flex-direction: column; cursor: pointer; transition: background-color 0.2s;
 }
 .calendar-day:hover { background-color: #f0f0ff; }
 .calendar-day.inactive { background-color: #fafafa; color: #ccc; pointer-events: none; }
 .calendar-day .date-number { font-weight: bold; font-size: 1.1em; margin-bottom: 5px; color: #333; }
 .calendar-day.today {
  border: 2px solid var(--primary-color);
  box-shadow: 0 0 8px rgba(91, 79, 141, 0.4);
 }
 .category-tag {
  background-color: var(--secondary-color); color: white; font-size: 0.7em;
  padding: 2px 5px; margin-top: 3px; border-radius: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; display: block;
 }
 .category-tag:nth-child(1) { background-color: var(--primary-color); }
 .category-tag:nth-child(2) { background-color: var(--money-color); color: #333; }
 .category-tag:nth-child(3) { background-color: #dc3545; }
 .calendar-day.no-tasks {
  background-color: #e9ecef; color: #6c757d; border: 1px dashed #ced4da;
  opacity: 0.7; box-shadow: none; cursor: default;
 }
 
 /* --- 8. Footer Styles --- */
 .main-footer {
  width: 100%; margin-top: 50px; padding-top: 20px;
  background-color: var(--background-color); border-top: 1px solid #eee;
  color: #666; font-size: 0.9em; flex-shrink: 0;
 }
 .footer-content-wrap {
  max-width: 1200px; margin: 0 auto; padding: 0 20px 30px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 30px;
 }
 /* 2:1 Column Split */
 .footer-links-col { flex-basis: 65%; min-width: 350px; flex-grow: 1; }
 .footer-meta-col { flex-basis: 30%; min-width: 200px; flex-grow: 0; }
 .main-footer h3 {
  color: #333; font-size: 1.1em; margin: 0 0 15px 0; border-bottom: 1px solid #ddd;
  padding-bottom: 5px; text-align: left;
 }
 .link-list { list-style: none; padding: 0; margin: 0; }
 .link-list-multi-column { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
 .link-list-multi-column li { margin-bottom: 0; } 
 
 /* Rounded Box Styling for links */
 .link-list li {
  background-color: var(--card-background); border: 1px solid #e0e0e0;
  border-radius: 6px; box-shadow: var(--shadow-light);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
 }
 .link-list li:hover {
  background-color: #f0f8ff; border-color: #cce0ff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
 }
 .main-footer a {
  display: block; padding: 10px 15px; color: #333; text-decoration: none;
  font-weight: normal;
 }
 .main-footer a:hover { text-decoration: none; color: var(--primary-color); }
 /* Copyright Section */
 .footer-copyright {
  text-align: center; padding: 15px 20px; border-top: 1px solid #ddd;
  background-color: #f0f0f0; color: #555; font-size: 0.8em;
 }
 .footer-copyright p {
  width: 100%;           /* full width */
  margin: 0;             /* remove auto centering */
  padding: 10px 15px;    
  line-height: 1.5;
  background-color: var(--card-background); 
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-sizing: border-box; /* ensures padding is included in width */
}

 
 /* --- 9. Responsive Desktop (>= 992px) --- */
 @media (min-width: 992px) {
  .container { 
        max-width: 1200px; 
        /* STICKY FOOTER FIX: Added 80px bottom padding */
        padding: 30px; 
    }
  #task-list { display: flex; gap: 20px; list-style: none; padding: 0; }
  .task-column-container {
   flex: 1 1 33.333%; display: flex; flex-direction: column; gap: 20px;
  }
  .task-category-item {
   width: 100%; margin-bottom: 0; border: 1px solid #ddd;
   border-radius: 5px; overflow: hidden; flex-grow: 0;
  }
  .category-tasks { padding-top: 0; }
  .category-header { border-radius: 5px 5px 0 0; }
  .task-list-item {
   border-radius: 0; margin-bottom: 0; border-bottom: 1px solid #eee;
   border-left: none;
  }
  .task-list-item:last-child { border-bottom: none; }
  #chart-area { grid-template-columns: 1fr 1fr; }
 }
 
 /* ---------------------------------------------------- */
 /* --- 10. MOBILE VIEW ADJUSTMENTS (<= 600px for phones) --- */
 /* ---------------------------------------------------- */
 @media (max-width: 600px) {
  
  /* Global Font Reduction for consistency */
  body { font-size: var(--font-size-mobile); }
  h1 { font-size: 1.8em; } 
  .active-category-header h3, 
  #chart-area h3 { font-size: 16px; }
  .main-footer h3 { font-size: 1em; } 
 
  /* Input & Button Font Reduction */
  #initial-category-name,
  #task-addition-area input:not([type="checkbox"]):not([type="date"]),
  .add-button,
  .secondary-button { font-size: 14px !important; }
 
  /* List Item Font Reduction */
  .task-list-item,
  .money-report-list li,
  .main-footer a { font-size: 13px; }
  .task-list-item button { font-size: 10px; }
  .footer-copyright p { font-size: 12px; max-width: 90%; }
  
  /* --- LAYOUT FIXES: Stack elements that are too narrow on mobile --- */
  
  /* Fix 1: Stack two-column inputs (like quantity/money) */
  .input-pair {
    flex-direction: column;
    gap: 0;
  }
  .input-pair input {
    margin-bottom: 10px;
  }
  .rupee-symbol {
    padding-right: 0; 
    margin-bottom: 5px;
  }
  
  /* Fix 2: Stack Guidance Card icon and text */
  .guidance-card {
    flex-direction: column;
    text-align: center;
  }
  .guidance-icon {
    font-size: 2em; 
    margin-bottom: 10px;
  }
  .guidance-text h4 {
    font-size: 1em;
  }
  
  /* Fix 3: Stack filters and make them full-width */
  #money-graph-view {
    display: flex; 
    flex-direction: column;
    gap: 15px;
  }
  #money-time-filter, #money-sort-option {
    min-width: 100%; 
    box-sizing: border-box;
  }
  
  /* Floating Nav (Condensed) */
  #floating-nav {
   bottom: 10px; padding: 8px 10px; gap: 15px; border-radius: 40px;
  }
  .nav-item {
   padding: 8px 10px; font-size: 0; flex-direction: column;
   min-width: 40px; justify-content: center; align-items: center;
  }
  .nav-item i { margin: 0; font-size: 18px; }
 
  /* Calendar */
  #calendar-controls { font-size: 1em; gap: 5px; }
  #calendar-controls button { padding: 5px 10px !important; }
  .calendar-day { min-height: 50px; padding: 2px; }
  .calendar-day .date-number { font-size: 0.9em; margin-bottom: 3px; }
  .day-name { padding: 5px 0; font-size: 0.8em; }
  .category-tag { font-size: 0.5em; padding: 1px 3px; margin-top: 1px; line-height: 1; max-height: 1.2em; }
  #chart-area { grid-template-columns: 1fr; }
  
  /* Footer responsiveness */
  .footer-content-wrap { flex-direction: column; padding: 0 15px 20px; }
  .footer-links-col, .footer-meta-col { flex-basis: 100%; min-width: unset; margin-bottom: 15px; }
  .link-list-multi-column { grid-template-columns: 1fr; }
 }
 
 /* --- Mobile View Adjustments (<= 768px for tablets/larger phones) --- */
 @media (max-width: 768px) {
   /* Footer layout change (columns collapse) */
   .footer-content-wrap { flex-direction: column; padding: 0 15px 20px; }
   .footer-links-col, .footer-meta-col { flex-basis: 100%; min-width: unset; margin-bottom: 15px; }
 }

 /* --- 11. Guidance Card Style (New) --- */
.guidance-card {
 display: flex;
 align-items: center;
 gap: 15px;
 background-color: var(--primary-color); /* Use primary color for background */
 color: white;
 padding: 15px 20px;
 border-radius: 8px;
 margin-bottom: 25px; /* Add space before the form */
 box-shadow: var(--shadow-deep);
}

.guidance-icon {
 font-size: 2.2em;
 color: var(--secondary-color); /* Use secondary color for the icon */
 min-width: 40px;
 text-align: center;
}

.guidance-text h4 {
 margin: 0 0 5px 0;
 font-size: 1.1em;
}

.guidance-text p {
 margin: 0;
 font-size: 0.9em;
 line-height: 1.4;
}
/* --- FOOTER SOCIAL LINKS STYLES --- */

/* Ensures the social row is displayed cleanly */
.footer-social-row {
 display: flex;
 flex-direction: column;
 align-items: center;
 text-align: center;
 padding: 10px 0 20px 0; /* Add space above/below */
 /* Changed border color for better theme consistency */
 border-bottom: 1px solid #ddd; 
 margin-bottom: 15px;
}

.socials-title {
 font-weight: bold;
 color: #555; /* Changed to darker color for readability on light background */
 margin-bottom: 10px;
 font-size: 1.1em;
}

.social-links {
 display: flex;
 gap: 15px; /* Spacing between icons */
}

.social-links a {
 color: #999; /* Default icon color */
 font-size: 1.8em;
 transition: color 0.3s ease, transform 0.2s ease; /* Smooth hover transition */
}
.social-links a:hover {
 transform: translateY(-2px); /* Slight lift on hover */
}

/* --- HOVER EFFECTS (Brand Colors) --- */

/* Twitter/X - Blue */
.social-links a:hover .fa-twitter {
 color: #1DA1F2;
}

/* YouTube - Red */
.social-links a:hover .fa-youtube {
 color: #FF0000;
}

/* Pinterest - Red */
.social-links a:hover .fa-pinterest {
 color: #BD081C;
}


/* Unsplash - Dark Gray (usually monochrome) */
.social-links a:hover .unsplash-icon {
 color: #555555;
}

#floating-buttons {
  position: fixed;
  bottom: 90px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}
#back-to-top-btn {
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;

}



.float-btn {
background: var(--primary-color); /* uses your indigo main UI color */
color: white;
border: none;
padding: 12px 16px;
font-size: 15px;
border-radius: 8px;
cursor: pointer;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
transition: 0.25s ease, background 0.25s ease;
display: flex;
align-items: center;
gap: 8px;
}

/* Optional: hover effect */
.float-btn:hover {
background: #4a4172; /* slightly darker indigo for hover */
  transform: translateY(-3px);
}

/* Mobile View → Hide Text, Show Only Icon */
@media (max-width: 600px) {
  .float-btn {
      width: 45px;
      height: 45px;
      padding: 0;
      border-radius: 50%;
      justify-content: center;
      font-size: 0; /* hides text */
  }
  .float-btn span {
      display: none;
  }
  .float-btn i {
      font-size: 20px;
  }
}
/* --- EXTRA SMALL MOBILE SAFETY (<= 420px) --- */
/* Prevent any horizontal scroll on very small devices */
@media (max-width: 420px) {
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Ensure all major containers never exceed viewport */
.container,
.card,
#chart-area > div,
.calendar-day,
.money-report,
.footer-content-wrap {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Fixed / floating elements clamp */
#floating-nav {
  max-width: calc(100% - 20px);
}

#floating-buttons {
  right: 10px;
}

/* Long text & links safety */
h1, h2, h3, p, li, a {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
}
/* Perfect square chart container */
.chart-square {
position: relative;
width: 100%;
max-width: 420px;          /* looks great on desktop */
margin: 0 auto 20px;
aspect-ratio: 1 / 1;      /* ✅ magic */
}

/* Canvas must fill the square */
.chart-square canvas {
width: 100% !important;
height: 100% !important;
}
.chart-box {
width: 100%;
max-width: 520px;     /* control chart size */
margin: 0 auto 30px; /* center + spacing */
}

/* --- Calendar Category Popup --- */
.calendar-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.calendar-modal.hidden {
  display: none;
}
.calendar-modal-content {
  background: white;
  padding: 20px;
  border-radius: 14px;
  max-width: 90%;
  width: 340px;
  box-shadow: var(--shadow-deep);
  text-align: center;
  position: relative; /* <-- important for side buttons positioning */
}
#calendar-category-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 15px 0;
  justify-content: center;
}
.calendar-category-btn {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: white; /* default white */
  color: black;      /* default text */
  font-size: 13px;
  transition: background 0.2s, color 0.2s;
}

.calendar-category-btn.active {
  background: purple; /* active category */
  color: white;
}


.calendar-category-btn:hover {
  opacity: 0.9;
}
.modal-side-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: none;
  background: white;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  cursor: pointer;
  font-size: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-left { left: -21px; }
.modal-right { right: -21px; }

.modal-side-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
#close-calendar-modal {
  position: relative;  /* ensures it’s on top */
  z-index: 10;         /* above side nav buttons */
  cursor: pointer;
  pointer-events: auto;
}

