/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: #f5f7fa;
  color: #1a1a2e;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ===== NAVBAR ===== */
header {
  background: #1a1a2e;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.navbar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f0c040;
  letter-spacing: -0.5px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: #ccc;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: #f0c040;
}

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: white;
  text-align: center;
  padding: 4rem 1.5rem;
}

.hero h1 {
  font-size: 2.4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero p {
  font-size: 1.1rem;
  color: #aac4e8;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== PAGE HERO ===== */
.page-hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: white;
  text-align: center;
  padding: 3rem 1.5rem;
}

.page-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.page-hero p {
  font-size: 1rem;
  color: #aac4e8;
  max-width: 600px;
  margin: 0 auto;
}

/* ===== AD CONTAINERS ===== */
.ad-container {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

.ad-placeholder {
  background: #e8ecf0;
  border: 2px dashed #b0bec5;
  border-radius: 8px;
  padding: 1.2rem;
  text-align: center;
  color: #78909c;
  font-size: 0.85rem;
}

/* ===== TOOLS SECTION ===== */
.tools-section {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.tools-section h2 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.tool-card {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
  transition: transform 0.2s, box-shadow 0.2s;
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid #e8ecf0;
}

.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.tool-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.tool-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #1a1a2e;
}

.tool-card p {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 1rem;
}

.tool-btn {
  color: #0f3460;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ===== WHY SECTION ===== */
.why-section {
  background: white;
  padding: 3rem 1.5rem;
  margin: 2rem 0;
}

.why-section h2 {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.why-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
}

.why-card {
  background: #f5f7fa;
  border-radius: 12px;
  padding: 1.5rem;
  font-size: 1.3rem;
}

.why-card strong { display: block; font-size: 1rem; margin: 0.5rem 0 0.3rem; color: #1a1a2e; }
.why-card p { font-size: 0.85rem; color: #666; }

/* ===== SEO CONTENT SECTION ===== */
.seo-section {
  max-width: 900px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem;
}

.seo-content {
  background: white;
  border-radius: 12px;
  padding: 1.8rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.seo-content h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: #1a1a2e;
}

.seo-content p {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.seo-content a {
  color: #0f3460;
  text-decoration: underline;
}

/* ===== TOOL CONTAINER ===== */
.tool-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* ===== DROP ZONE ===== */
.drop-zone {
  background: white;
  border: 3px dashed #b0bec5;
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: #0f3460;
  background: #e8f0fb;
}

.drop-icon { font-size: 3rem; margin-bottom: 1rem; }
.drop-zone p { color: #666; margin: 0.3rem 0; }

.upload-btn {
  display: inline-block;
  background: #0f3460;
  color: white;
  padding: 0.7rem 1.8rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  margin: 0.8rem 0;
  transition: background 0.2s;
}

.upload-btn:hover { background: #1a5276; }
.supported { font-size: 0.8rem; color: #999; margin-top: 0.5rem; }

/* ===== SETTINGS PANEL ===== */
.settings-panel {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.settings-row label { font-weight: 500; min-width: 160px; }
.settings-row input[type="range"] { flex: 1; min-width: 150px; accent-color: #0f3460; }
.num-input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  width: 180px;
}

select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* ===== BUTTONS ===== */
.compress-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #0f3460, #1a5276);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: opacity 0.2s;
}

.compress-btn:hover { opacity: 0.9; }

.download-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #27ae60, #1e8449);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1.5rem;
  transition: opacity 0.2s;
}

.download-btn:hover { opacity: 0.9; }

.reset-btn {
  display: block;
  width: 100%;
  background: #f5f7fa;
  color: #1a1a2e;
  border: 1px solid #ddd;
  padding: 0.8rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.8rem;
  transition: background 0.2s;
}

.reset-btn:hover { background: #e8ecf0; }

/* ===== RESULT PANEL ===== */
.result-panel {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  margin-top: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}

.preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.preview-box { text-align: center; }
.preview-box h4 { font-size: 0.95rem; margin-bottom: 0.5rem; color: #666; }

.preview-box img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid #eee;
  object-fit: contain;
}

.size-label {
  font-size: 0.85rem;
  margin-top: 0.5rem;
  color: #555;
  font-weight: 600;
}

.savings-badge {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: #27ae60;
  margin: 0.5rem 0;
}

/* ===== INFO SECTION ===== */
.info-section {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.info-section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-align: center;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.step-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.step-num {
  display: inline-block;
  width: 36px;
  height: 36px;
  background: #0f3460;
  color: white;
  border-radius: 50%;
  line-height: 36px;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.step-card p { font-size: 0.9rem; color: #555; margin-top: 0.5rem; }

/* ===== FAQ ===== */
.faq { margin-top: 2rem; }
.faq h3 { font-size: 1.2rem; margin-bottom: 1rem; }
.faq-item {
  background: white;
  border-radius: 10px;
  padding: 1.2rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.faq-item strong { display: block; margin-bottom: 0.3rem; }
.faq-item p { font-size: 0.9rem; color: #666; }

/* ===== INVOICE FORM ===== */
.invoice-form {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}

.form-row { margin-bottom: 1.5rem; }
.form-row.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
}

.form-group { display: flex; flex-direction: column; gap: 0.5rem; }
.form-group h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.3rem; color: #0f3460; }
.form-group label { font-size: 0.85rem; font-weight: 600; color: #555; }
.form-group input, .form-group select, .form-group textarea {
  padding: 0.6rem 0.9rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
  transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: #0f3460;
}
.form-group textarea { height: 90px; resize: vertical; }

/* ===== ITEMS TABLE ===== */
.items-table { margin-bottom: 1.5rem; }
.items-table h3 { margin-bottom: 0.75rem; font-size: 1rem; }
.items-header {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr 40px;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #888;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.line-item {
  display: grid;
  grid-template-columns: 3fr 1fr 1fr 1fr 40px;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.line-item input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
  width: 100%;
}

.line-item input:focus { outline: none; border-color: #0f3460; }

.remove-item-btn {
  background: #fee;
  border: none;
  border-radius: 6px;
  padding: 0.4rem;
  cursor: pointer;
  color: #e74c3c;
  font-size: 1rem;
  transition: background 0.2s;
}
.remove-item-btn:hover { background: #fcc; }

.add-item-btn {
  background: none;
  border: 2px dashed #b0bec5;
  border-radius: 8px;
  padding: 0.7rem;
  width: 100%;
  cursor: pointer;
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  transition: border-color 0.2s, color 0.2s;
}
.add-item-btn:hover { border-color: #0f3460; color: #0f3460; }

/* ===== TOTALS ===== */
.totals-section {
  border-top: 2px solid #eee;
  padding-top: 1rem;
  margin-bottom: 1.5rem;
  max-width: 350px;
  margin-left: auto;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.95rem;
  color: #555;
}

.totals-row input[type="number"] {
  padding: 0.2rem 0.4rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
}

.total-final {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1a1a2e;
  border-top: 2px solid #1a1a2e;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

/* ===== LOAN FORM ===== */
.loan-form {
  background: white;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.07);
}

.loan-results { margin-top: 2rem; }

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.result-card {
  background: linear-gradient(135deg, #1a1a2e, #0f3460);
  color: white;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.result-label { display: block; font-size: 0.8rem; color: #aac4e8; margin-bottom: 0.5rem; }
.result-value { display: block; font-size: 1.6rem; font-weight: 800; color: #f0c040; }

/* ===== BREAKDOWN BAR ===== */
.breakdown-section { margin-bottom: 2rem; }
.breakdown-section h3 { margin-bottom: 1rem; }

.breakdown-bar {
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  margin-bottom: 0.5rem;
}

.bar-principal { background: #0f3460; transition: width 0.5s; }
.bar-interest { background: #e74c3c; flex: 1; }

.bar-legend { display: flex; gap: 1.5rem; font-size: 0.85rem; }
.legend-principal { color: #0f3460; font-weight: 600; }
.legend-interest { color: #e74c3c; font-weight: 600; }

/* ===== AMORTIZATION TABLE ===== */
.amortization-section h3 { margin-bottom: 0.5rem; }
.amort-table-wrapper { overflow-x: auto; }

.amort-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.amort-table th {
  background: #1a1a2e;
  color: white;
  padding: 0.7rem 0.8rem;
  text-align: right;
  font-weight: 600;
}
.amort-table th:first-child { text-align: center; }

.amort-table td {
  padding: 0.6rem 0.8rem;
  text-align: right;
  border-bottom: 1px solid #f0f0f0;
}
.amort-table td:first-child { text-align: center; font-weight: 600; color: #666; }
.amort-table tr:nth-child(even) { background: #f9f9f9; }
.amort-table tr:hover { background: #e8f0fb; }

/* ===== FOOTER ===== */
footer {
  background: #1a1a2e;
  color: #aaa;
  text-align: center;
  padding: 2rem 1.5rem;
  margin-top: 3rem;
  font-size: 0.9rem;
}

footer a { color: #f0c040; }
footer a:hover { text-decoration: underline; }

/* ===== RESPONSIVE — MOBILE FIRST ===== */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.8rem; }
  .page-hero h1 { font-size: 1.5rem; }
  .navbar { flex-direction: column; align-items: flex-start; }
  .nav-links { gap: 0.75rem; font-size: 0.85rem; }
  .tools-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr 1fr; }
  .results-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.4rem; }
  .page-hero h1 { font-size: 1.3rem; }
  .preview-grid { grid-template-columns: 1fr; }
  .items-header { display: none; }
  .line-item { grid-template-columns: 1fr 1fr; }
  .why-grid { grid-template-columns: 1fr; }
  .results-grid { grid-template-columns: 1fr; }
  .form-row.two-col { grid-template-columns: 1fr; }
  .steps-grid { grid-template-columns: 1fr; }
  .result-value { font-size: 1.3rem; }
  .compress-btn, .download-btn { font-size: 1rem; }
}
