/* ========================================= */
/* === VARIABLES & BASIC SETUP =========== */
/* ========================================= */
:root {
  --primary-color: #4caf50; /* Green */
  --primary-dark: #388e3c;
  --secondary-color: #ff9800; /* Orange */
  --accent-color: #03a9f4; /* Light Blue */
  --text-color: #333;
  --text-light: #555;
  --text-lighter: #777;
  --bg-color: #f8f9fa;
  --card-bg: #ffffff;
  --border-color: #e0e0e0;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --font-primary: "Poppins", sans-serif;
  --font-secondary: "Nunito", sans-serif;
  --red: #f44336;
  --blue: #2196f3;
  --gray: #9e9e9e;
}

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

body {
  font-family: var(--font-secondary);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-primary);
  font-weight: 600;
  margin-bottom: 0.8em;
  color: var(--text-color);
}

h1 {
  font-size: 2.2rem;
}
h2 {
  font-size: 1.8rem;
  color: var(--primary-dark);
}
h3 {
  font-size: 1.4rem;
  color: var(--text-light);
}

p {
  margin-bottom: 1em;
  color: var(--text-light);
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}
/* ========================================= */
/* === HEADER / TOP NAVIGATION =========== */
/* ========================================= */
.top-nav {
  background-color: var(--card-bg);
  box-shadow: 0 2px 4px var(--shadow-color);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.top-nav .nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.top-nav .logo a {
  font-family: var(--font-primary);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}
.top-nav .logo a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}

.dashboard-nav ul {
  display: flex;
  align-items: center;
}

.dashboard-nav li {
  margin-left: 25px;
}

.dashboard-nav a {
  font-family: var(--font-primary);
  font-weight: 500;
  color: var(--text-light);
  padding: 8px 12px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.dashboard-nav a:hover {
  background-color: var(--bg-color);
  color: var(--primary-color);
  text-decoration: none;
}

.dashboard-nav a.active {
  color: var(--card-bg);
  background-color: var(--primary-color);
  font-weight: 600;
}
.dashboard-nav a.active:hover {
  background-color: var(--primary-dark);
}

.user-info {
  display: flex;
  align-items: center;
}

.user-info .group-name {
  margin-right: 15px;
  font-weight: 500;
  color: var(--text-light);
}

.user-info .user-icon {
  font-size: 1.8rem;
  color: var(--primary-color);
  cursor: pointer;
}

.mobile-menu-toggle {
  display: none; /* Hidden by default on larger screens */
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--primary-color);
  cursor: pointer;
  margin-left: 15px;
}

/* ========================================= */
/* === MAIN CONTENT AREA ================= */
/* ========================================= */
.dashboard-main,
.savings-main {
  flex-grow: 1; /* Ensures main content takes available space */
  padding-top: 20px;
  padding-bottom: 40px;
}

/* ========================================= */
/* === CARDS ============================== */
/* ========================================= */
.card {
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 2px 5px var(--shadow-color);
  padding: 25px;
  margin-bottom: 25px;
  border: 1px solid var(--border-color);
}

.card h2,
.card h3 {
  margin-top: 0;
}

/* ========================================= */
/* === BUTTONS ============================ */
/* ========================================= */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 500;
  text-align: center;
  transition: background-color 0.2s ease, box-shadow 0.2s ease,
    transform 0.1s ease;
  font-size: 0.95rem;
}
.btn:hover {
  text-decoration: none;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.btn:active {
  transform: translateY(1px);
}

.btn i {
  margin-right: 8px;
}

.btn-primary {
  background-color: var(--primary-color);
  color: var(--card-bg);
}
.btn-primary:hover {
  background-color: var(--primary-dark);
  color: var(--card-bg);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: var(--card-bg);
}
.btn-secondary:hover {
  background-color: #e68a00; /* Darker orange */
  color: var(--card-bg);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

/* ========================================= */
/* === PROGRESS BAR ======================= */
/* ========================================= */
.progress-bar-container {
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  height: 20px;
  margin-top: 10px;
  width: 100%;
}

.progress-bar {
  background-color: var(--primary-color);
  height: 100%;
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
  line-height: 20px;
  white-space: nowrap;
  transition: width 0.5s ease-in-out;
}

/* ========================================= */
/* === DASHBOARD SPECIFIC STYLES ======== */
/* ========================================= */

/* Welcome Banner */
.welcome-banner {
  background: linear-gradient(
    to right,
    var(--primary-color),
    var(--primary-dark)
  );
  color: white;
  padding: 30px 25px;
  border-radius: 8px;
  margin-bottom: 30px;
}
.welcome-banner h1 {
  color: white;
  margin-bottom: 0.2em;
}
.welcome-banner p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  margin-bottom: 0;
}
.welcome-banner .dynamic-group-name {
  font-weight: 700;
}

/* Overview Grid */
.overview-section .overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
}

.savings-card .goal,
.savings-card .saved {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 0.5em;
}
.savings-card .saved {
  font-weight: bold;
  color: var(--text-color);
}

.meeting-card i {
  margin-right: 8px;
  color: var(--secondary-color);
  width: 15px; /* Align icons */
  text-align: center;
}
.meeting-card p {
  margin-bottom: 0.8em;
}
.meeting-card .btn {
  margin-top: 10px;
}

.tasks-card .task-list {
  margin-top: 15px;
  margin-bottom: 15px;
}
.tasks-card .task-list li {
  margin-bottom: 8px;
  color: var(--text-light);
  padding-left: 5px;
  border-left: 3px solid var(--accent-color);
}
.tasks-card .due-date {
  font-size: 0.85rem;
  color: var(--text-lighter);
  margin-left: 5px;
}
.tasks-card .btn {
  margin-top: 10px;
}

/* Main Content Row (Activity/Quick Actions) */
.main-content-row {
  display: grid;
  grid-template-columns: 2fr 1fr; /* Adjust ratio as needed */
  gap: 25px;
  margin-top: 30px;
}

/* Activity Feed */
.activity-feed h2 i {
  margin-right: 10px;
  color: var(--gray);
}

.feed-list {
  margin-top: 20px;
}

.feed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}
.feed-item:last-child {
  border-bottom: none;
}

.activity-desc {
  display: flex;
  align-items: center;
  color: var(--text-light);
}

.feed-icon {
  font-size: 1.1rem;
  margin-right: 12px;
  width: 20px;
  text-align: center;
}
.feed-icon.green {
  color: var(--primary-color);
}
.feed-icon.blue {
  color: var(--accent-color);
}
.feed-icon.gray {
  color: var(--gray);
}

.timestamp {
  font-size: 0.85rem;
  color: var(--text-lighter);
  white-space: nowrap;
  margin-left: 15px;
}

.view-all-activity {
  display: inline-block;
  margin-top: 15px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* Quick Actions */
.quick-actions h2 i {
  margin-right: 10px;
  color: var(--secondary-color);
}

.quick-actions .action-buttons {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.quick-actions .action-buttons .btn {
  width: 100%;
}

/* ========================================= */
/* === SAVINGS PAGE SPECIFIC STYLES ====== */
/* ========================================= */

.page-header {
  margin-bottom: 30px;
  text-align: center;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}
.page-header h1 {
  color: var(--primary-dark);
}
.page-header p {
  font-size: 1.1rem;
  color: var(--text-light);
}

/* Savings Summary */
.savings-summary h2 {
  margin-bottom: 20px;
  text-align: center;
  color: var(--primary-dark);
}

.savings-summary .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  text-align: center;
  margin-bottom: 25px;
}

.summary-item .label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-lighter);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-item .value {
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text-color);
}
.summary-item .goal-value {
  color: var(--secondary-color);
}
.summary-item .saved-value {
  color: var(--primary-color);
}
.summary-item .remaining-value {
  color: var(--red);
}

.progress-bar-section {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
}
.progress-bar-section .label {
  font-weight: 500;
  color: var(--text-light);
  white-space: nowrap;
}

/* Contribution Form */
.contribution-form h2 i {
  margin-right: 10px;
  color: var(--primary-color);
}

.contribution-form form {
  margin-top: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-light);
  font-size: 0.9rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  font-family: var(--font-secondary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.form-group textarea {
  resize: vertical;
  min-height: 60px;
}

.form-group-full {
  grid-column: 1 / -1; /* Make notes span full width if needed */
}

.contribution-form .btn {
  margin-top: 10px;
  min-width: 180px; /* Give button some width */
}

/* Contribution History */
.contribution-history h2 i {
  margin-right: 10px;
  color: var(--gray);
}

.table-responsive {
  width: 100%;
  overflow-x: auto; /* Enable horizontal scrolling on small screens */
  margin-top: 20px;
}

#history-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px; /* Prevent table from becoming too narrow */
}

#history-table th,
#history-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

#history-table th {
  background-color: var(--bg-color);
  font-weight: 600;
  font-family: var(--font-primary);
  color: var(--text-light);
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
}

#history-table tbody tr:hover {
  background-color: #f1f1f1;
}

#history-table td.amount {
  font-weight: 500;
  text-align: right;
  font-family: var(
    --font-secondary
  ); /* Use Nunito for numbers for consistency */
  min-width: 100px;
}
#history-table td em {
  /* Style for empty notes */
  color: var(--text-lighter);
  font-style: italic;
}

/* ========================================= */
/* === RESPONSIVENESS ====================== */
/* ========================================= */

/* Medium Screens (Tablets) */
@media (max-width: 992px) {
  .container {
    width: 95%;
  }
  .main-content-row {
    grid-template-columns: 1fr; /* Stack activity and quick actions */
  }
  .quick-actions .action-buttons {
    flex-direction: row; /* Put quick actions side-by-side */
    flex-wrap: wrap;
  }
  .quick-actions .action-buttons .btn {
    width: auto; /* Allow buttons to size naturally */
    flex-grow: 1; /* Make buttons fill space */
  }
}

/* Small Screens (Mobiles) */
@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.2rem;
  }

  /* Mobile Navigation */
  .mobile-menu-toggle {
    display: block; /* Show hamburger icon */
  }
  .dashboard-nav {
    display: none; /* Hide nav by default */
    position: absolute;
    top: 100%; /* Position below header */
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    box-shadow: 0 4px 6px var(--shadow-color);
    padding: 15px 0;
  }
  .dashboard-nav.active {
    display: block; /* Show nav when active */
  }
  .dashboard-nav ul {
    flex-direction: column;
    align-items: stretch; /* Stretch items */
  }
  .dashboard-nav li {
    margin-left: 0;
    width: 100%;
  }
  .dashboard-nav a {
    display: block; /* Make links take full width */
    padding: 12px 20px; /* Adjust padding */
    text-align: center;
    border-bottom: 1px solid var(--border-color);
  }
  .dashboard-nav li:last-child a {
    border-bottom: none;
  }
  .dashboard-nav a:hover {
    background-color: var(--bg-color); /* Consistent hover */
  }
  .dashboard-nav a.active {
    border-radius: 0; /* Remove radius in mobile */
  }

  .top-nav .nav-container {
    width: 95%;
  }

  .overview-section .overview-grid {
    grid-template-columns: 1fr; /* Stack overview cards */
  }

  .savings-summary .summary-grid {
    grid-template-columns: 1fr; /* Stack summary items */
    gap: 15px;
  }
  .summary-item .value {
    font-size: 1.4rem;
  }

  .form-grid {
    grid-template-columns: 1fr; /* Stack form fields */
  }

  .feed-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  .timestamp {
    margin-left: 0;
    margin-top: 5px;
    width: 100%;
    text-align: right;
  }
}
