/* ============================================= */
/* RATES PAGE - SEPARATE STYLES                  */
/* ============================================= */

/* ===== PAGE HEADER ===== */
.rates-page-header {
  background: linear-gradient(
    135deg,
    var(--primary-blue) 0%,
    var(--primary-dark) 100%
  );
  padding: 50px 0 45px;
  text-align: center;
  border-bottom: 4px solid var(--secondary-orange);
  position: relative;
}

.rates-page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("../images/pattern.png") repeat;
  opacity: 0.05;
}

.rates-header-content {
  position: relative;
  z-index: 1;
}

.rates-header-content h1 {
  font-size: 2.8rem;
  color: var(--white);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.rates-header-content h1::after {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background: var(--secondary-orange);
  margin: 12px auto 0;
  border-radius: 2px;
}

.rates-header-content p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 15px auto 0;
}

/* ===== RATES BODY ===== */
.rates-page-body {
  padding: 40px 0 60px;
  background: var(--bg-light);
}

.rates-section {
  background: var(--white);
  border-radius: 12px;
  padding: 45px 50px;
  margin-bottom: 35px;
  box-shadow: var(--shadow-light);
}

.rates-section:last-child {
  margin-bottom: 0;
}

/* ===== SECTION DIVIDER ===== */
.section-divider {
  width: 50px;
  height: 4px;
  background: var(--secondary-orange);
  border-radius: 2px;
  margin: 10px auto 18px;
}

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--secondary-orange);
  background: rgba(249, 115, 22, 0.1);
  padding: 4px 16px;
  border-radius: 50px;
  margin-bottom: 8px;
}

.section-header-center {
  text-align: center;
  margin-bottom: 35px;
}

.section-header-center h2 {
  font-size: 2.2rem;
  color: var(--primary-blue);
  font-weight: 700;
}

.section-header-center p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== SECTION 1: CURRENT RATE ===== */
.current-rate-card {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 35px 40px;
  border-top: 5px solid var(--secondary-orange);
  transition: var(--transition);
  width: 100%;
  box-sizing: border-box;
}

.current-rate-card:hover {
  box-shadow: var(--shadow-hover);
}

.rate-period {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

.period-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.period-date {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-blue);
}

/* ===== RATE DETAILS - FLEXBOX ALTERNATIVE ===== */
.rate-details {
  display: flex;
  gap: 20px;
  margin-bottom: 25px;
  width: 100%;
}

.rate-item {
  background: var(--white);
  padding: 20px 15px;
  border-radius: 10px;
  text-align: center;
  transition: var(--transition);
  border: 1px solid rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 130px;
  flex: 1;
  width: 33.333%;
  box-sizing: border-box;
}

.rate-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-light);
}

.rate-label {
  display: block;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 8px;
  line-height: 1.3;
  text-align: center;
}

.rate-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary-orange);
}

.rate-unit {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Responsive for Flexbox */
@media (max-width: 768px) {
  .rate-details {
    flex-wrap: wrap;
  }
  
  .rate-item {
    width: calc(50% - 10px);
    flex: none;
  }
}

@media (max-width: 480px) {
  .rate-details {
    flex-direction: column;
  }
  
  .rate-item {
    width: 100%;
  }
}

/* ===== RATE NOTE ===== */
.rate-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: rgba(249, 115, 22, 0.06);
  padding: 15px 20px;
  border-radius: 8px;
  border-left: 3px solid var(--secondary-orange);
}

.rate-note i {
  color: var(--secondary-orange);
  font-size: 1.1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.rate-note p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.8;
}

.rate-note p br {
  display: block;
  content: "";
  margin-top: 8px;
}

.rate-note p .spacer {
  display: block;
  height: 8px;
}

/* ===== SECTION 2: RATE COMPONENTS ===== */
.components-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 25px;
}

.component-card {
  background: var(--bg-light);
  padding: 30px 25px;
  border-radius: 12px;
  text-align: center;
  transition: var(--transition);
  border-bottom: 3px solid transparent;
  position: relative;
}

.component-card:hover {
  transform: translateY(-6px);
  border-bottom-color: var(--secondary-orange);
  box-shadow: var(--shadow-hover);
}

.component-icon {
  font-size: 2.5rem;
  color: var(--secondary-orange);
  margin-bottom: 12px;
  display: inline-block;
  padding: 14px;
  background: rgba(249, 115, 22, 0.08);
  border-radius: 50%;
  width: 68px;
  height: 68px;
  text-align: center;
  line-height: 1;
}

.component-card h4 {
  font-size: 1.05rem;
  color: var(--primary-blue);
  font-weight: 700;
  margin-bottom: 8px;
}

.component-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 10px;
}

.component-percent {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary-orange);
  background: rgba(249, 115, 22, 0.1);
  padding: 2px 14px;
  border-radius: 50px;
}

/* ===== SECTION 3: HISTORICAL RATES ===== */
.year-filter {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding: 15px 20px;
  background: var(--bg-light);
  border-radius: 10px;
  flex-wrap: wrap;
}

.year-filter label {
  font-weight: 600;
  color: var(--primary-blue);
  font-size: 0.95rem;
}

.year-select {
  padding: 8px 18px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 0.95rem;
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
  color: var(--primary-blue);
}

.year-select:focus {
  outline: none;
  border-color: var(--secondary-orange);
}

.historical-table-wrapper {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.historical-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.historical-table thead {
  background: var(--primary-blue);
}

.historical-table thead th {
  color: var(--white);
  padding: 14px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.historical-table tbody tr {
  transition: var(--transition);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.historical-table tbody tr:hover {
  background: rgba(249, 115, 22, 0.04);
}

.historical-table tbody td {
  padding: 12px 20px;
  color: var(--text-body);
}

.historical-table tbody td:first-child {
  font-weight: 600;
  color: var(--primary-blue);
}

.historical-table tbody tr:last-child {
  border-bottom: none;
}

.historical-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 20px;
  padding: 15px 20px;
  background: rgba(59, 130, 246, 0.06);
  border-radius: 8px;
  border-left: 3px solid #3b82f6;
}

.historical-note i {
  color: #3b82f6;
  font-size: 1.1rem;
  margin-top: 2px;
}

.historical-note p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.6;
}

/* ===== SECTION 4: CHART ===== */
.chart-container {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 30px 35px;
}

.chart-placeholder {
  height: 300px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 20px 0 10px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 30px;
  height: 100%;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

.chart-bar {
  flex: 1;
  background: linear-gradient(
    to top,
    var(--secondary-orange),
    var(--secondary-orange-light)
  );
  border-radius: 6px 6px 0 0;
  min-height: 20px;
  transition: var(--transition);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 5px;
}

.chart-bar:hover {
  transform: scaleY(1.02);
  background: linear-gradient(
    to top,
    var(--primary-blue),
    var(--secondary-orange)
  );
}

.chart-bar .bar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 8px;
}

.chart-bar .bar-value {
  font-size: 0.7rem;
  color: var(--white);
  background: rgba(0, 0, 0, 0.5);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
  opacity: 0;
  transition: var(--transition);
}

.chart-bar:hover .bar-value {
  opacity: 1;
}

.chart-caption {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
}

/* ============================================= */
/* EXPLANATION BUTTON                           */
/* ============================================= */

.btn-explain {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--secondary-orange);
  color: var(--white);
  border: none;
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-explain:hover {
  background: var(--primary-blue);
  transform: translateY(-1px);
}

.btn-explain i {
  font-size: 0.7rem;
}

/* ============================================= */
/* EXPLANATION MODAL                            */
/* ============================================= */

.explanation-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 30px;
}

.explanation-modal-content {
  background: var(--white);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.explanation-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--primary-blue);
  color: var(--white);
  border-bottom: 3px solid var(--secondary-orange);
}

.explanation-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.explanation-modal-header h3 i {
  color: var(--secondary-orange);
}

.explanation-modal-close {
  background: none;
  border: none;
  color: var(--white);
  font-size: 2rem;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  padding: 0 4px;
}

.explanation-modal-close:hover {
  color: var(--secondary-orange);
  transform: rotate(90deg);
}

.explanation-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.explanation-month {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary-blue);
  text-align: center;
  margin-bottom: 8px;
}

.explanation-change {
  text-align: center;
  margin-bottom: 16px;
}

.change-badge {
  display: inline-block;
  padding: 4px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.85rem;
}

.change-badge.increase {
  background: #fee2e2;
  color: #dc2626;
}

.change-badge.decrease {
  background: #d1fae5;
  color: #059669;
}

.explanation-text {
  background: var(--bg-light);
  padding: 16px 20px;
  border-radius: 10px;
  margin-bottom: 18px;
  border-left: 4px solid var(--secondary-orange);
}

.explanation-text p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

.explanation-reason {
  background: var(--bg-light);
  padding: 16px 18px;
  border-radius: 10px;
}

.explanation-reason h4 {
  font-size: 0.85rem;
  color: var(--primary-blue);
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.explanation-reason h4 i {
  color: var(--secondary-orange);
}

.explanation-reason p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.explanation-modal-footer {
  padding: 14px 24px 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.04);
  text-align: center;
}

.btn-close-explain {
  background: var(--secondary-orange);
  color: var(--white);
  border: none;
  padding: 10px 40px;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-close-explain:hover {
  background: var(--primary-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(10, 38, 71, 0.25);
}

/* ============================================= */
/* RESPONSIVE                                   */
/* ============================================= */

@media (max-width: 1024px) {
  .rate-details {
    grid-template-columns: repeat(2, 1fr);
  }

  .components-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .rates-section {
    padding: 35px 30px;
  }

  .chart-bars {
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .rates-section {
    padding: 25px 20px;
    border-radius: 8px;
  }

  .rates-header-content h1 {
    font-size: 2rem;
  }

  .rates-header-content p {
    font-size: 0.95rem;
  }

  .section-header-center h2 {
    font-size: 1.8rem;
  }

  .current-rate-card {
    padding: 25px 20px;
  }

  .rate-period {
    flex-direction: column;
    text-align: center;
    gap: 5px;
  }

  .rate-period .period-date {
    font-size: 1.1rem;
  }

  .rate-details {
    grid-template-columns: 1fr 1fr;
    gap: 15px;
  }

  .rate-item {
    padding: 15px;
  }

  .rate-value {
    font-size: 1.6rem;
  }

  .components-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .component-card {
    padding: 20px 16px;
  }

  .historical-table thead th,
  .historical-table tbody td {
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .chart-placeholder {
    height: 220px;
  }

  .chart-bars {
    gap: 15px;
  }

  .chart-bar .bar-label {
    font-size: 0.65rem;
  }

  .rates-section {
    padding: 20px 16px;
  }

  .rate-note {
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  .historical-note {
    padding: 12px 16px;
    font-size: 0.85rem;
  }

  .explanation-modal-content {
    max-width: 95%;
    margin: 10px;
    border-radius: 12px;
  }

  .explanation-modal-body {
    padding: 18px;
    max-height: calc(90vh - 120px);
  }

  .explanation-month {
    font-size: 1.1rem;
  }

  .explanation-text p {
    font-size: 0.9rem;
  }

  .explanation-reason p {
    font-size: 0.85rem;
  }

  .explanation-modal-header h3 {
    font-size: 0.95rem;
  }

  .btn-close-explain {
    padding: 8px 28px;
    font-size: 0.85rem;
  }

  .btn-explain {
    font-size: 0.7rem;
    padding: 3px 10px;
  }
}

@media (max-width: 480px) {
  .rates-header-content h1 {
    font-size: 1.6rem;
  }

  .section-header-center h2 {
    font-size: 1.4rem;
  }

  .section-header-center p {
    font-size: 0.9rem;
  }

  .rate-details {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .rate-item {
    padding: 12px 10px;
  }

  .rate-value {
    font-size: 1.3rem;
  }

  .rate-label {
    font-size: 0.75rem;
  }

  .rate-unit {
    font-size: 0.65rem;
  }

  .components-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .component-card {
    padding: 18px 16px;
  }

  .historical-table-wrapper {
    border-radius: 6px;
  }

  .historical-table thead th,
  .historical-table tbody td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .year-filter {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 16px;
  }

  .year-select {
    width: 100%;
  }

  .chart-placeholder {
    height: 180px;
    padding: 10px 0;
  }

  .chart-bars {
    gap: 10px;
  }

  .chart-bar .bar-value {
    font-size: 0.6rem;
    padding: 1px 6px;
  }

  .chart-bar .bar-label {
    font-size: 0.6rem;
  }

  .chart-container {
    padding: 20px 16px;
  }

  .rate-note {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 14px;
  }

  .historical-note {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 14px;
  }

  .current-rate-card {
    padding: 20px 16px;
  }

  .rate-period .period-date {
    font-size: 1rem;
  }

  .explanation-modal {
    padding: 15px;
  }

  .explanation-modal-body {
    padding: 14px;
  }

  .explanation-month {
    font-size: 1rem;
  }

  .change-badge {
    font-size: 0.75rem;
    padding: 3px 14px;
  }

  .explanation-text {
    padding: 12px 14px;
  }

  .explanation-text p {
    font-size: 0.85rem;
  }

  .explanation-reason {
    padding: 12px 14px;
  }

  .explanation-reason h4 {
    font-size: 0.8rem;
  }

  .explanation-reason p {
    font-size: 0.8rem;
  }

  .btn-explain {
    font-size: 0.65rem;
    padding: 2px 8px;
  }
}