/* ========================================
   CALCULATORS PAGE STYLES - REDESIGNED
   ======================================== */

:root {
  --primary-color: #191b70;
  --primary-dark: #0d1b4d;
  --primary-light: #f5f7fa;
  --secondary-color: #ffc107;
  --neutral-color: #666666;
}

/* ================= HERO SECTION ================= */
.calc-hero-section {
  min-height: 65vh;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  position: relative;
  display: flex;
  align-items: center;
  padding-top: 80px;
  overflow: hidden;
}

.calc-hero-section::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 193, 7, 0.2) 0%, transparent 70%);
  border-radius: 50%;
}

.calc-hero-content {
  position: relative;
  z-index: 2;
  color: white;
}

.calc-hero-title {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: 1.2rem;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.calc-hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: rgba(255, 255, 255, 0.95);
  max-width: 700px;
  line-height: 1.7;
  margin: 0 auto;
}

/* ================= FLOATING MATH ICONS ================= */
.floating-math-icons {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.floating-math-icons .icon {
  position: absolute;
  color: rgba(255, 255, 255, 0.1);
  animation: floatMath 20s infinite ease-in-out alternate;
}

.math-icon-1 { top: 15%; left: 10%; font-size: 4.5rem; animation-duration: 18s; }
.math-icon-2 { top: 65%; left: 8%; font-size: 3.5rem; animation-duration: 22s; animation-delay: -5s; }
.math-icon-3 { top: 20%; left: 85%; font-size: 5rem; animation-duration: 25s; animation-delay: -10s; }
.math-icon-4 { top: 75%; left: 85%; font-size: 4rem; animation-duration: 20s; animation-delay: -2s; }
.math-icon-5 { top: 40%; left: 75%; font-size: 6.5rem; animation-duration: 30s;}
.math-icon-6 { top: 80%; left: 45%; font-size: 3.5rem; animation-duration: 15s; animation-delay: -8s; }
.math-icon-7 { top: 15%; left: 60%; font-size: 5.5rem; animation-duration: 28s; animation-delay: -15s;}
.math-icon-8 { top: 50%; left: 20%; font-size: 5rem; animation-duration: 24s; animation-delay: -12s; }

@keyframes floatMath {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  50% { transform: translate(20px, -30px) rotate(180deg) scale(1.1); }
  100% { transform: translate(-20px, 20px) rotate(360deg) scale(0.9); }
}

/* ================= CALCULATOR TABS ================= */
.calc-tabs {
  display: flex;
  gap: 15px;
  margin-bottom: 50px;
  flex-wrap: wrap;
  justify-content: center;
}

.calc-tab {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  padding: 15px 30px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.calc-tab i {
  font-size: 1.2rem;
}

.calc-tab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: var(--secondary-color);
}

.calc-tab.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 8px 25px rgba(25, 25, 112, 0.2);
}

.calc-tab.active i {
  color: var(--secondary-color);
}

/* ================= CALCULATOR CATEGORIES ================= */
.calc-category {
  display: none;
  animation: fadeIn 0.4s ease;
}

.calc-category.active {
  display: block;
}

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

/* ================= CALCULATOR CARDS GRID ================= */
.calc-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 25px;
  margin-bottom: 50px;
  animation: fadeIn 0.4s ease;
}

.calc-card-select {
  background: white;
  border-radius: 12px;
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
}

.calc-card-select::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}

.calc-card-select:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(25, 25, 112, 0.15);
  border-color: var(--secondary-color);
}

.calc-card-select:hover::before {
  opacity: 0.08;
}

.calc-card-select > * {
  position: relative;
  z-index: 1;
}

.calc-card-select .calc-icon {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 15px;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(25, 25, 112, 0.2);
}

.calc-card-select .calc-icon i {
  font-size: 28px;
  color: var(--secondary-color);
}

.calc-card-select:hover .calc-icon {
  transform: scale(1.15);
  box-shadow: 0 10px 30px rgba(25, 25, 112, 0.3);
}

.calc-card-select h4 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 10px 0 5px;
  line-height: 1.3;
}

.calc-card-select p {
  font-size: 0.9rem;
  color: var(--neutral-color);
  margin: 0;
  line-height: 1.4;
}

/* ================= DETAIL PANEL ================= */
.calc-detail-panel {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(25, 25, 112, 0.08);
  animation: slideInUp 0.4s ease;
  margin-bottom: 50px;
  scroll-margin-top: 100px;
}

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

.detail-panel-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.detail-panel-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  min-width: 200px;
  color: white !important;
}

.btn-close-detail {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.4);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
}

.btn-close-detail:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: white;
  transform: translateY(-2px);
}

.detail-panel-body {
  padding: 40px;
}

.detail-content {
  animation: fadeIn 0.4s ease;
}

/* ================= ACCORDION IN DETAIL PANEL ================= */
.accordion {
  border: 2px solid rgba(25, 25, 112, 0.1);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(25, 25, 112, 0.03);
}

.accordion-btn {
  width: 100%;
  background: linear-gradient(135deg, rgba(25, 25, 112, 0.05), rgba(25, 25, 112, 0.03));
  border: none;
  padding: 16px 20px;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.3s ease;
  font-size: 1.05rem;
}

.accordion-btn:hover {
  background: linear-gradient(135deg, rgba(25, 25, 112, 0.1), rgba(25, 25, 112, 0.05));
}

.accordion-btn i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.accordion-btn.active i {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  padding: 20px;
  background: rgba(255, 255, 255, 0.5);
  border-top: 1px solid rgba(25, 25, 112, 0.1);
  animation: slideDown 0.3s ease;
}

.accordion-content.show {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 500px;
  }
}

/* ================= TIPS COLLAPSIBLE SECTION ================= */
.tips-accordion {
  border: 1px solid rgba(25, 25, 112, 0.15);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.tips-toggle {
  width: 100%;
  background: linear-gradient(135deg, rgba(25, 25, 112, 0.06), rgba(25, 25, 112, 0.02));
  border: none;
  padding: 13px 18px;
  text-align: left;
  cursor: pointer;
  font-weight: 600;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: background 0.25s ease;
  font-size: 0.97rem;
  letter-spacing: 0.01em;
}

.tips-toggle:hover {
  background: linear-gradient(135deg, rgba(25, 25, 112, 0.11), rgba(25, 25, 112, 0.05));
}

.tips-toggle .tips-toggle-left {
  display: flex;
  align-items: center;
  gap: 9px;
}

.tips-toggle .tips-toggle-left i.icon-info {
  color: var(--secondary-color);
  font-size: 1rem;
}

.tips-toggle .tips-chevron {
  font-size: 0.85rem;
  transition: transform 0.3s ease;
  opacity: 0.7;
}

.tips-toggle.active .tips-chevron {
  transform: rotate(180deg);
}

.tips-content {
  display: none;
  padding: 20px;
  background: #fafbff;
  border-top: 1px solid rgba(25, 25, 112, 0.08);
  animation: slideDown 0.3s ease;
}

.tips-content.show {
  display: block;
}

/* ================= FORM ELEMENTS ================= */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.form-control:focus {
  outline: none;
  border-color: var(--secondary-color);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1);
}

.form-control::placeholder {
  color: #aaa;
}

/* style dropdowns like inputs */
.form-select {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #f8f9fa;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.form-select:focus {
  outline: none;
  border-color: var(--secondary-color);
  background: white;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.1);
}

/* ================= BUTTONS ================= */
.btn-calculate {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 14px 30px;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 6px 20px rgba(25, 25, 112, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(25, 25, 112, 0.3);
}

.btn-calculate i {
  font-size: 1.1rem;
}

.btn-calculate.btn-lg {
  padding: 16px 30px;
  font-size: 1.1rem;
  margin-top: 30px;
}

/* ================= RESULT DISPLAY (CLEAN UI) ================= */
.calc-result {
  background: white;
  border-radius: 12px;
  padding: 25px;
  margin-top: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); /* Very subtle shadow */
  animation: slideIn 0.4s ease;
  color: var(--primary-color);
}

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

/* Top Summary Cards (Light Purple/Blue Tint) */
.sip-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 30px;
}

.summary-card {
  background: #f8f8fc; /* Very light purple-blue tint */
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.summary-label {
  font-size: 0.95rem;
  color: #5c5c8a;
  margin-bottom: 8px;
  font-weight: 500;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #2c2c54;
  margin: 0;
}

/* Charts Section Layout */
.sip-charts-row {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
}

.sip-chart-box {
  flex: 1;
  background: #fafafc;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sip-chart-title {
  font-size: 0.95rem;
  color: #2c2c54;
  font-weight: 600;
  margin-bottom: 15px;
  align-self: flex-start;
}

.chart-container {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Linear List Breakdown */
.sip-breakdown-list {
  background: #f8f8fc;
  border-radius: 12px;
  padding: 25px;
  text-align: left;
}

.breakdown-list-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #5c5c8a;
  margin-bottom: 15px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.breakdown-row:last-child {
  border-bottom: none;
}

.breakdown-row-label {
  color: #667eea;
  font-weight: 500;
  font-size: 0.95rem;
}

.breakdown-row-value {
  color: #1a1a1a;
  font-weight: 600;
  font-size: 0.95rem;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
  .sip-summary-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  
  .sip-charts-row {
    flex-direction: column;
  }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 992px) {
  .calc-hero-section {
    min-height: 40vh;
    padding-top: 100px;
  }

  .calc-tabs {
    gap: 10px;
  }

  .calc-tab {
    padding: 12px 20px;
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .calc-hero-section {
    min-height: auto;
    padding: 110px 0 50px;
  }

  .calc-hero-title {
    font-size: 1.85rem;
  }

  .calc-hero-subtitle {
    font-size: 0.98rem;
  }

  /* Responsive Floating Math Icons */
  .math-icon-1 { font-size: 2rem !important; }
  .math-icon-2 { font-size: 1.5rem !important; }
  .math-icon-4 { font-size: 1.8rem !important; }
  .math-icon-7 { font-size: 2.5rem !important; }
  .math-icon-3, .math-icon-5, .math-icon-6, .math-icon-8 {
    display: none !important; /* Hide some icons to reduce clutter */
  }

  .calc-tabs {
    flex-direction: column;
    gap: 10px;
  }

  .calc-tab {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  .calc-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
  }

  .calc-card-select {
    padding: 15px 10px;
  }

  .calc-card-select h4 {
    font-size: 1rem;
  }

  .calc-card-select p {
    font-size: 0.85rem;
  }

  .detail-panel-header {
    padding: 15px 20px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .detail-panel-header h2 {
    font-size: 1.3rem;
  }

  .btn-close-detail {
    width: auto;
    padding: 8px 12px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.15);
  }
  
  .btn-close-detail i {
    margin-right: 4px;
  }

  .detail-panel-body {
    padding: 25px 20px;
  }

  .form-group {
    margin-bottom: 18px;
  }

  .form-control {
    padding: 11px 14px;
    font-size: 0.95rem;
  }

  .btn-calculate {
    padding: 13px 25px;
    font-size: 1rem;
  }

  .result-value {
    font-size: 2rem;
  }

  .result-breakdown {
    padding: 12px;
  }

  .result-breakdown-item {
    font-size: 0.9rem;
  }
}

@media (max-width: 576px) {
  .calc-hero-section {
    padding: 100px 0 45px;
  }

  .calc-hero-title {
    font-size: 1.65rem;
  }

  .calc-hero-subtitle {
    font-size: 0.92rem;
  }

  .calc-tab {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .calc-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
  }

  .calc-card-select {
    padding: 18px 12px;
  }
  
  .calc-card-select:last-child:nth-child(odd) {
    grid-column: span 2;
    justify-self: center;
    max-width: 200px;
  }

  .calc-card-select .calc-icon {
    width: 50px;
    height: 50px;
  }

  .calc-card-select .calc-icon i {
    font-size: 24px;
  }

  .calc-card-select h4 {
    font-size: 0.95rem;
    margin: 8px 0 4px;
  }

  .detail-panel-header h2 {
    font-size: 1.3rem;
  }

  .detail-panel-body {
    padding: 20px 16px;
  }

  .form-group {
    margin-bottom: 16px;
  }

  .result-value {
    font-size: 1.8rem;
  }
}

/* ================= XIRR ADVANCED TABLE & CONTROLS ================= */
.xirr-toggle-group {
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
  border-radius: 30px;
  overflow: hidden;
  background-color: #f1f1f5;
  padding: 4px;
}

.xirr-toggle-group .btn {
  padding: 10px 24px;
  font-weight: 600;
  border: none;
  border-radius: 26px !important;
  color: #6c757d;
  background-color: transparent;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.xirr-toggle-group .btn:hover {
  background-color: rgba(0,0,0,0.03);
  color: var(--primary-color);
}

.xirr-toggle-group .btn-check:checked + .btn {
  background-color: #ffffff;
  color: var(--primary-color);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

#xirr-cashflow-table th {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-color);
}

#xirr-cashflow-table input {
  font-size: 0.95rem;
  border: 1px solid rgba(25, 25, 112, 0.1);
  border-radius: 6px;
  background-color: #fafafc;
  transition: all 0.3s ease;
  padding: 8px 12px;
}

#xirr-cashflow-table input:focus {
  background-color: #fff;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.15);
  outline: none;
}

#xirr-cashflow-table td {
  padding: 12px 10px;
}


@media (max-width: 576px) {
  #xirr-cashflow-table .cashflow-amount {
    min-width: 100px;
  }
}
