:root {
  /* Core Colors */
  --primary-green: #2ecc71;
  --dark-green: #27ae60;
  --primary-blue: #3498db;
  --dark-blue: #2980b9;

  /* Theme Variables (Light Mode Default) */
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #7f8c8d;
  --border-color: #eee;
  --input-bg: #ffffff;
  --input-border: #a8e6cf;
  --shadow-color: rgba(0, 0, 0, 0.05);
  --header-bg: transparent;

  /* Input/Result Specifics */
  --input-section-bg: #ebf9f1;
  --input-section-border: #2ecc71;
}

body.dark-mode {
  /* Dark Mode Overrides */
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --text-primary: #e0e0e0;
  --text-secondary: #b0b0b0;
  --border-color: #333333;
  --input-bg: #2d2d2d;
  --input-border: #444;
  --shadow-color: rgba(0, 0, 0, 0.3);

  /* Dark Mode Specifics */
  --input-section-bg: #1e1e1e;
  --input-section-border: #2ecc71;
  --tab-active-bg: #2ecc71; /* Use Green for active tab in dark mode */
  --tab-active-text: #ffffff;
}

/* Light Mode Defaults for Tabs */
:root {
  --tab-active-bg: #2c3e50;
  --tab-active-text: #ffffff;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  background: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  padding: 40px 20px;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px var(--shadow-color);
  transition: all 0.3s ease;
  color: var(--text-primary);
  font-size: 1.2rem;
}

.theme-toggle:hover {
  transform: rotate(15deg) scale(1.1);
}

.main-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  color: var(--text-primary);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  transition: color 0.3s;
}

header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 500;
}

/* Tabs */
.tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.tab-btn {
  padding: 12px 35px;
  border: none;
  background: #dfe4ea;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  color: #7f8c8d;
  transition: all 0.3s;
}

.tab-btn.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Split Layout */
.calculator-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-bottom: 30px;
}

@media (max-width: 768px) {
  .calculator-container {
    grid-template-columns: 1fr;
  }
}

/* Green Box (Input) - STRICT GREEN THEME */
.input-section {
  background: var(--input-section-bg);
  padding: 2.5rem;
  border-radius: 20px;
  border: 2px solid var(--input-section-border);
  box-shadow: 0 10px 25px var(--shadow-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s;
}

.input-section:hover {
  transform: translateY(-5px); /* Professional Movement */
  box-shadow: 0 15px 35px var(--shadow-color);
}

.input-section h2 {
  color: var(--dark-green);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 2px solid #a8e6cf;
  padding-bottom: 10px;
}

.input-group {
  margin-bottom: 1.5rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.8rem;
  font-weight: 600;
  color: var(--dark-green);
}

.input-group input {
  width: 100%;
  padding: 14px;
  border: 2px solid #a8e6cf;
  border-radius: 10px;
  font-size: 1.1rem;
  background: white;
  transition: 0.3s;
}

.input-group input:focus {
  border-color: var(--dark-green);
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.2);
  outline: none;
}

.calculate-btn {
  display: none;
  width: 100%;
  padding: 16px;
  background: var(--primary-green);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 4px 6px rgba(46, 204, 113, 0.3);
}

.calculate-btn:hover {
  background: var(--dark-green);
  transform: translateY(-2px);
}

/* Result Box - REMOVED RED BOX STYLING as requested ("Remove projection box") */
.result-section {
  /* Removed background, border, shadow */
  padding: 1rem; /* Minimal padding */
  display: flex;
  flex-direction: column;
}

.result-section h2 {
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

.placeholder-text {
  text-align: center;
  color: #999;
  opacity: 0.7;
  margin-top: auto;
  margin-bottom: auto;
  font-size: 1.1rem;
}

.summary-card {
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 15px var(--shadow-color);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s;
}

.summary-card:hover {
  transform: translateY(-3px); /* Subtle Lift */
  box-shadow: 0 8px 20px var(--shadow-color);
}

.summary-card p {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.8rem;
  color: var(--text-secondary);
  font-size: 1rem;
}

.summary-card .total {
  font-weight: 800;
  color: var(--primary-green);
  font-size: 1.4rem;
  margin-top: 1rem;
  border-top: 2px dashed var(--border-color);
  padding-top: 1rem;
  text-align: center;
}

/* Specific Value Colors for Result Text */

#sip-invested,
#swp-withdrawn,
#lumpsum-invested,
#swp-balance,
#swp-invested {
  font-weight: 600;
  color: var(--primary-blue);
}

/* SWP Withdrawn - Green as requested */
#swp-withdrawn {
  color: var(--primary-green) !important;
}

#sip-returns,
#lumpsum-returns {
  font-weight: 600;
  color: var(--primary-green);
}

.chart-container {
  position: relative;
  height: auto;
  min-height: 300px;
  width: 100%;
  max-width: 400px; /* Limit width for cleaner look */
  margin: 0 auto 1.5rem auto; /* Center and add bottom space */
}

/* Table Section */
.details-section {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: 20px;
  box-shadow: 0 5px 20px var(--shadow-color);
  transition: transform 0.3s ease, background 0.3s;
}

.details-section:hover {
  transform: translateY(-5px);
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 1rem;
}

.details-header h2 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.download-btn {
  padding: 10px 20px;
  background: var(--text-primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  transition: 0.3s;
}

body.dark-mode .download-btn {
  background: var(--primary-green);
  color: #fff;
}

body.dark-mode .download-btn:hover {
  background: var(--dark-green);
  box-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
}

.download-btn:hover {
  background: black;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 15px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

table th {
  background: #f8f9fa;
  color: var(--text-primary);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.85rem;
}

table tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02); /* Works for dark/light */
}

/* Input Styling Updates */
.input-group input {
  background: var(--input-bg) !important;
  color: var(--text-primary) !important;
  border: 2px solid var(--input-border);
}

/* Table Dark Mode Fixes */
body.dark-mode table th {
  background: #333;
  color: #fff;
}

body.dark-mode table td {
  color: #e0e0e0;
  border-bottom: 1px solid #444;
}

body.dark-mode table tr:nth-child(even) {
  background: #252525;
}

body.dark-mode table tr:hover {
  background: #333;
}

.quote-box {
  background: linear-gradient(
    135deg,
    var(--primary-green),
    var(--primary-blue)
  );
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  display: inline-block;
  margin-top: 15px;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
  animation: fadeIn 1s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
