/* ==========================================================================
   AussieLoanCalculator.online - Global Styles
   ========================================================================== */

:root {
  /* Color Palette */
  --primary: #00843D; /* Australian green */
  --primary-hover: #006b32;
  --secondary: #FFCD00; /* Australian gold */
  --secondary-hover: #e6b800;
  --accent: #003087; /* Trust blue */
  --bg-color: #F8F9FA;
  --card-bg: #FFFFFF;
  --text-dark: #1A1A2E;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --error: #ef4444;
  --success: #22c55e;
  
  /* Typography */
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --line-height: 1.7;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  
  /* Border Radius */
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

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

html {
  font-family: var(--font-family);
  line-height: var(--line-height);
  color: var(--text-dark);
  background-color: var(--bg-color);
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-dark);
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; font-weight: 700; }
h2 { font-size: 1.75rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; }
p { margin-bottom: 1rem; }
a { color: var(--primary); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--primary-hover); }

/* ==========================================================================
   Layout
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  flex: 1;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.site-header {
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-dark);
}

.logo svg {
  width: 32px;
  height: 32px;
}

.main-nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-dark);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
}

.nav-item-dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--card-bg);
  min-width: 250px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-md);
  padding: 0.5rem 0;
  border: 1px solid var(--border-color);
}

.nav-item-dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-link {
  display: block;
  padding: 0.75rem 1.5rem;
  color: var(--text-dark);
  font-size: 0.9rem;
}

.dropdown-link:hover {
  background-color: var(--bg-color);
  color: var(--primary);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-dark);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-align: center;
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: white;
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--text-dark);
}
.btn-secondary:hover {
  background-color: var(--secondary-hover);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}
.btn-outline:hover {
  background-color: var(--bg-color);
  border-color: var(--primary);
  color: var(--primary);
}

/* ==========================================================================
   Calculator UI Components
   ========================================================================== */
.calculator-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 992px) {
  .calculator-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.calculator-card {
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  border: 1px solid var(--border-color);
}

.results-panel {
  background-color: var(--accent);
  color: white;
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.results-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.results-panel h2, .results-panel h3 {
  color: white;
}

.result-highlight {
  font-size: 3rem;
  font-weight: 700;
  margin: 1rem 0;
  color: var(--secondary);
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.result-row:last-child {
  border-bottom: none;
}

/* Form Inputs */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-prefix, .input-suffix {
  position: absolute;
  color: var(--text-muted);
  font-weight: 500;
}
.input-prefix { left: 1rem; }
.input-suffix { right: 1rem; }

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: var(--font-family);
  transition: border-color 0.2s, box-shadow 0.2s;
  background-color: #fff;
  color: var(--text-dark);
}

.form-input.has-prefix { padding-left: 2rem; }
.form-input.has-suffix { padding-right: 2.5rem; }

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 132, 61, 0.1);
}

.input-help {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Tooltips */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background-color: var(--bg-color);
  color: var(--text-muted);
  font-size: 12px;
  margin-left: 0.5rem;
  cursor: help;
  position: relative;
  border: 1px solid var(--border-color);
}

.tooltip-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--text-dark);
  color: white;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  width: max-content;
  max-width: 250px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  z-index: 10;
  text-align: left;
  font-weight: normal;
  line-height: 1.4;
}

.tooltip-icon:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Segmented Control / Radio Buttons */
.radio-group {
  display: flex;
  background-color: var(--bg-color);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  border: 1px solid var(--border-color);
}

.radio-group label {
  flex: 1;
  text-align: center;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: calc(var(--radius-md) - 2px);
  font-weight: 500;
  transition: all 0.2s ease;
}

.radio-group input[type="radio"] {
  display: none;
}

.radio-group input[type="radio"]:checked + label {
  background-color: var(--card-bg);
  box-shadow: var(--shadow-sm);
  color: var(--primary);
}

/* Range Slider */
.range-slider {
  width: 100%;
  margin-top: 1rem;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform 0.1s;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ==========================================================================
   Amortisation Table
   ========================================================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin-top: 2rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background: var(--card-bg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th, .data-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--bg-color);
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: #fcfcfc;
}

/* ==========================================================================
   Cards Grid
   ========================================================================== */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.category-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.category-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  display: inline-block;
}

/* ==========================================================================
   FAQ Section
   ========================================================================== */
.faq-section {
  margin: 4rem 0;
}

.faq-item {
  border-bottom: 1px solid var(--border-color);
  padding: 1.5rem 0;
}

.faq-question {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.faq-answer {
  color: var(--text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--text-dark);
  color: #fff;
  padding: 4rem 0 2rem;
  margin-top: 4rem;
}

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

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: 2fr repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr repeat(4, 1fr);
  }
}

.footer-logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
}

.footer-text {
  color: #a1a1aa;
  margin-bottom: 1.5rem;
}

.footer-heading {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: #a1a1aa;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--secondary);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
  color: #a1a1aa;
  font-size: 0.9rem;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

.disclaimer {
  background-color: rgba(255,255,255,0.05);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 2rem;
  font-size: 0.85rem;
  color: #d4d4d8;
  line-height: 1.5;
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-4 { margin-top: 4rem; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-4 { margin-bottom: 4rem; }
.pt-4 { padding-top: 4rem; }
.pb-4 { padding-bottom: 4rem; }

.section-title {
  text-align: center;
  margin-bottom: 3rem;
}

/* Mobile sticky action bar */
.mobile-action-bar {
  display: none;
}

/* ==========================================================================
   Mobile Responsiveness
   ========================================================================== */
@media (max-width: 767px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  
  .main-nav {
    display: none;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    flex-direction: column;
    padding: 1rem;
    box-shadow: var(--shadow-md);
    gap: 0;
  }
  
  .main-nav.active {
    display: flex;
  }
  
  .nav-link {
    display: block;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
  }
  
  .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background-color: var(--bg-color);
    padding-left: 1rem;
    display: none;
  }
  
  .nav-item-dropdown.active .dropdown-menu {
    display: block;
  }

  .mobile-menu-btn {
    display: block;
  }
  
  .mobile-action-bar {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-bg);
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
  }
  
  .calculator-card, .results-panel {
    padding: 1.5rem;
  }
}
