/* ==========================================
   CSS Reset & Base Styles
   ========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --accent-color: #f59e0b;

    /* Neutral Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;

    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-dark: #111827;

    /* Border & Shadow */
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Typography */
    --font-primary: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;
    --line-height-base: 1.6;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Transitions */
    --transition-base: all 0.3s ease;
}

html {
    font-size: var(--font-size-base);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    line-height: var(--line-height-base);
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================
   Typography
   ========================================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: var(--spacing-sm);
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-dark);
}

ul, ol {
    margin-left: var(--spacing-lg);
    margin-bottom: var(--spacing-sm);
}

li {
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
}

/* ==========================================
   Layout Components
   ========================================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* ==========================================
   Header & Navigation
   ========================================== */

header {
    background-color: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    padding: var(--spacing-sm) 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo h1 {
    margin: 0;
    font-size: 1.5rem;
}

.logo a {
    color: var(--primary-color);
    font-weight: 700;
}

.logo a:hover {
    color: var(--primary-dark);
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    gap: var(--spacing-lg);
}

.nav-menu a {
    color: var(--text-primary);
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
}

.nav-menu a:hover,
.nav-menu a.active {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

/* ==========================================
   Hero Section
   ========================================== */

.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: var(--spacing-xl) 0;
    text-align: center;
}

.hero h1 {
    color: white;
    font-size: 2.75rem;
    margin-bottom: var(--spacing-md);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
    margin: 0 auto;
}

/* ==========================================
   Page Header
   ========================================== */

.page-header {
    background-color: var(--bg-secondary);
    padding: var(--spacing-xl) 0;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.page-header h1 {
    margin-bottom: var(--spacing-sm);
}

.page-header p {
    font-size: 1.125rem;
    max-width: 700px;
    margin: 0 auto;
}

/* ==========================================
   Sections
   ========================================== */

section {
    padding: var(--spacing-xl) 0;
}

section:nth-child(even) {
    background-color: var(--bg-secondary);
}

/* ==========================================
   Calculator Section
   ========================================== */

.calculator-section {
    background-color: var(--bg-primary);
}

.calculator-section h2 {
    text-align: center;
    margin-bottom: var(--spacing-sm);
}

.calculator-section > .container > p {
    text-align: center;
    font-size: 1.125rem;
    margin-bottom: var(--spacing-lg);
}

.calculator-card {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-lg);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    max-width: 1000px;
    margin: 0 auto;
}

.input-group {
    margin-bottom: var(--spacing-md);
}

.input-group label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: var(--transition-base);
}

/* Enhanced Select Dropdown Styling for Calculator */
.input-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right var(--spacing-sm) center;
    background-size: 1.25rem;
}

.input-group select:hover {
    border-color: var(--primary-light);
    background-color: var(--bg-secondary);
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-group select option {
    font-weight: 500;
    padding: var(--spacing-sm);
}

.calculator-results {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
}

.calculator-results h3 {
    margin-bottom: var(--spacing-md);
    color: var(--primary-color);
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.result-value {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.result-value.highlight {
    color: var(--secondary-color);
    font-size: 1.5rem;
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    display: inline-block;
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#calculate-btn {
    width: 100%;
    margin-top: var(--spacing-sm);
}

/* ==========================================
   Tables
   ========================================== */

.rates-table-wrapper {
    overflow-x: auto;
    margin: var(--spacing-lg) 0;
}

.rates-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.rates-table thead {
    background-color: var(--primary-color);
    color: white;
}

.rates-table th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
}

.rates-table td {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.rates-table tbody tr:hover {
    background-color: var(--bg-secondary);
}

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

/* ==========================================
   Cards & Grids
   ========================================== */

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.info-card {
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition-base);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

/* ==========================================
   Guide Links
   ========================================== */

.guide-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.guide-link-card {
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    transition: var(--transition-base);
    display: block;
}

.guide-link-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.guide-link-card h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.guide-link-card p {
    margin: 0;
}

/* ==========================================
   CTA Sections
   ========================================== */

.cta-section {
    text-align: center;
    padding: var(--spacing-xl);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-top: var(--spacing-xl);
}

.cta-center {
    text-align: center;
    margin-top: var(--spacing-lg);
}

.cta-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

/* ==========================================
   Filter Controls
   ========================================== */

.filter-controls {
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.filter-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Dropdown Styling */
.filter-group select {
    width: 100%;
    padding: var(--spacing-sm) 2.5rem var(--spacing-sm) var(--spacing-sm);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right var(--spacing-sm) center;
    background-size: 1.25rem;
}

.filter-group select:hover {
    border-color: var(--primary-light);
    background-color: var(--bg-secondary);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background-color: var(--bg-primary);
}

.filter-group select:active {
    background-color: var(--bg-secondary);
}

/* Dropdown options styling */
.filter-group select option {
    padding: var(--spacing-sm);
    font-weight: 500;
}

/* Disabled state */
.filter-group select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-tertiary);
}

#apply-filters {
    align-self: end;
}

.results-count {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* ==========================================
   Comparison Tips
   ========================================== */

.comparison-tips {
    margin-top: var(--spacing-xl);
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.tip-card {
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.tip-card h3 {
    margin-bottom: var(--spacing-sm);
}

/* ==========================================
   Guide Content
   ========================================== */

.guide-toc {
    background-color: var(--bg-primary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-xl);
}

.guide-toc h2 {
    margin-bottom: var(--spacing-md);
}

.guide-toc ul {
    list-style: none;
    margin-left: 0;
}

.guide-toc li {
    margin-bottom: var(--spacing-sm);
}

.guide-toc a {
    display: block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    transition: var(--transition-base);
}

.guide-toc a:hover {
    background-color: var(--bg-secondary);
}

.guide-section {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--border-color);
}

.guide-section:last-child {
    border-bottom: none;
}

.guide-section h2 {
    color: var(--primary-color);
    margin-top: var(--spacing-xl);
}

.guide-section h3 {
    margin-top: var(--spacing-lg);
    color: var(--text-primary);
}

.example-box {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--secondary-color);
    margin: var(--spacing-lg) 0;
}

.example-box h4 {
    color: var(--secondary-color);
    margin-bottom: var(--spacing-sm);
}

.pros-cons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.pros-box {
    background-color: #ecfdf5;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 2px solid var(--secondary-color);
}

.pros-box h3 {
    color: var(--secondary-color);
}

.cons-box {
    background-color: #fef2f2;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    border: 2px solid #ef4444;
}

.cons-box h3 {
    color: #ef4444;
}

.faq-item {
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.faq-item h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

/* ==========================================
   About Page
   ========================================== */

.about-section {
    margin-bottom: var(--spacing-xl);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.feature-card {
    background-color: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
}

.feature-card h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.info-item {
    background-color: var(--bg-secondary);
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
}

.info-item h4 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

/* ==========================================
   Footer
   ========================================== */

footer {
    background-color: var(--bg-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: var(--spacing-xl) 0 var(--spacing-md);
    margin-top: var(--spacing-xl);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.footer-section h4 {
    color: white;
    margin-bottom: var(--spacing-md);
}

.footer-section ul {
    list-style: none;
    margin-left: 0;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: var(--spacing-md);
    text-align: center;
}

.footer-bottom p {
    margin-bottom: var(--spacing-xs);
    color: rgba(255, 255, 255, 0.6);
}

.disclaimer {
    font-size: 0.875rem;
    font-style: italic;
}

/* ==========================================
   Responsive Design
   ========================================== */

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .nav-menu {
        gap: var(--spacing-sm);
    }

    .calculator-card {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
    }

    .cards-grid,
    .tips-grid,
    .features-grid {
        grid-template-columns: 1fr;
    }

    .pros-cons-grid {
        grid-template-columns: 1fr;
    }

    .cta-buttons {
        flex-direction: column;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    #apply-filters {
        align-self: stretch;
    }

    .rates-table {
        font-size: 0.875rem;
    }

    .rates-table th,
    .rates-table td {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-base: 14px;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    section {
        padding: var(--spacing-lg) 0;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
    header,
    footer,
    .cta-section,
    .filter-controls {
        display: none;
    }

    body {
        font-size: 12pt;
    }

    .container {
        max-width: 100%;
    }
}
