/* ===== FinanceHub - Financial Tools Website ===== */
:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
.site-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1a56db 50%, #3b82f6 100%);
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: white;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-text span { color: #93c5fd; }

/* Navigation */
.nav { display: flex; gap: 4px; flex-wrap: wrap; }

.nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}

.nav a:hover { background: rgba(255,255,255,0.15); color: white; }

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 60px 24px;
  text-align: center;
  border-bottom: 1px solid var(--gray-200);
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 16px;
  letter-spacing: -0.5px;
}

.hero h1 span { color: var(--primary); }

.hero p {
  font-size: 18px;
  color: var(--gray-600);
  max-width: 600px;
  margin: 0 auto 24px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat .num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.hero-stat .label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* ===== Main Content ===== */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ===== Calculator Grid ===== */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.calc-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.calc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.calc-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 12px;
}

.calc-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.calc-icon.blue { background: var(--primary-light); }
.calc-icon.green { background: var(--success-light); }
.calc-icon.yellow { background: var(--warning-light); }
.calc-icon.red { background: #fee2e2; }
.calc-icon.purple { background: #ede9fe; }
.calc-icon.teal { background: #ccfbf1; }

.calc-card-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
}

.calc-card-header p {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 2px;
}

.calc-card-body { padding: 20px 24px; }

/* ===== Form Styles ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 15px;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

.input-group {
  position: relative;
}

.input-group input {
  padding-right: 40px;
}

.input-suffix {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover { background: #047857; }

/* ===== Results ===== */
.result-panel {
  margin-top: 20px;
  padding: 20px;
  background: var(--gray-50);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  display: none;
}

.result-panel.show { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-main {
  text-align: center;
  padding: 16px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.result-main .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -1px;
}

.result-main .label {
  font-size: 13px;
  color: var(--gray-500);
  margin-top: 4px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-item {
  padding: 12px;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--gray-100);
}

.result-item .label {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.result-item .value {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-800);
}

/* ===== Schedule Table ===== */
.schedule-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 13px;
}

.schedule-table th,
.schedule-table td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--gray-200);
}

.schedule-table th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--gray-600);
  text-align: right;
}

.schedule-table td:first-child,
.schedule-table th:first-child {
  text-align: left;
}

.schedule-table .interest-col { color: var(--danger); }
.schedule-table .principal-col { color: var(--success); }

/* ===== Charts (simple bar) ===== */
.chart-bar-container {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 200px;
  padding: 0 4px;
  margin-top: 16px;
  border-bottom: 1px solid var(--gray-300);
  border-left: 1px solid var(--gray-300);
  position: relative;
}

.chart-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  position: relative;
  transition: height 0.5s ease;
  min-width: 4px;
  cursor: pointer;
}

.chart-bar:hover { opacity: 0.8; }

.chart-bar.principal { background: var(--primary); }
.chart-bar.interest { background: #f59e0b; }

.chart-bar .tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
}

.chart-bar:hover .tooltip { display: block; }

.chart-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--gray-500);
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 13px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--gray-800);
  color: var(--gray-400);
  padding: 40px 24px 24px;
  margin-top: 48px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.footer-brand p {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.7;
}

.footer-section h4 {
  color: white;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
}

.footer-section ul {
  list-style: none;
}

.footer-section li { margin-bottom: 8px; }

.footer-section a {
  color: var(--gray-400);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.footer-section a:hover { color: white; }

.footer-bottom {
  max-width: 1200px;
  margin: 32px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--gray-700);
  text-align: center;
  font-size: 13px;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .nav { width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .hero { padding: 40px 20px; }
  .hero h1 { font-size: 26px; }
  .hero-stats { gap: 24px; }
  .calc-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .result-grid { grid-template-columns: 1fr; }
}

/* ===== Utilities ===== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray-500); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.fw-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.hidden { display: none !important; }
