/* ===================================
   Global Definitions (RESTORED FIX)
   =================================== */
:root {
    /* Define your color palette */
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --text-color: #333; /* Dark text */
    --text-color-light: #666; /* Lighter body text */
    --background-color: #f8f9fa; /* Light grey background */
    --card-background: #ffffff; /* White card background */
    --success-color: #28a745; /* Green for success messages */
    --error-color: #dc3545; /* Red for error messages (used by JS) */
    --link-color: #007bff;
    --link-hover-color: #0056b3;
    --border-color: #ddd;
    --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Global Reset/Setup */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color); 
    color: var(--text-color);
    line-height: 1.6;
    scroll-behavior: smooth;
}

/* Container and Layout */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Typography */
h1, h2, h3 {
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-color);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-color-light);
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--link-hover-color);
}

/* Utility Classes */
.fade-in {
    animation: fadeIn 1s ease-out;
}
.fade-in-delay {
    animation: fadeIn 1s ease-out 0.5s forwards;
    opacity: 0;
}
.fade-in-delay-2 {
    animation: fadeIn 1s ease-out 1s forwards;
    opacity: 0;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Buttons and CTAs */
.cta-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 12px 25px;
    border-radius: 5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease;
    margin-top: 1rem;
}

.cta-button:hover {
    background-color: #0056b3;
}

/* Navigation Bar */
.navbar {
    background-color: var(--card-background);
    box-shadow: var(--shadow-light);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.logo i {
    margin-right: 8px;
    color: var(--primary-color);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
    padding: 5px 0;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary-color);
}

/* Mobile Menu Button - Should be hidden on large screens */
.mobile-menu-btn {
    display: none; /* Initially hidden on desktop */
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, #00bfff 100%);
    color: white;
    text-align: center;
    padding: 5rem 0;
    margin-bottom: 2rem;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
}

/* Calculator Section */
.calculator-section {
    padding: 2rem 0;
}

.calculator-card {
    background-color: var(--card-background);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
}

.calculator-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.calculator-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    color: var(--text-color);
}

.input-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.input-group input[type="number"],
.input-group select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    width: 100%;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.input-hint {
    font-size: 0.85rem;
    color: var(--text-color-light);
    margin-top: 0.5rem;
}

/* Results Section */
.results-section h3 {
    margin-bottom: 1rem;
}

.results-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card {
    background-color: var(--background-color);
    padding: 1.5rem;
    border-radius: 6px;
    text-align: center;
    box-shadow: var(--shadow-light);
}

.summary-label {
    font-weight: 500;
    color: var(--text-color-light);
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    word-break: break-all;
}

.summary-value.earnings {
    color: var(--success-color);
}

/* Results Table */
.results-table-wrapper {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.results-table th,
.results-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.results-table th {
    background-color: var(--background-color);
    color: var(--text-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.results-table td {
    font-weight: 500;
}

.results-table td i {
    margin-right: 8px;
    color: var(--primary-color);
}

.return-value {
    font-weight: 700;
}

.return-value.highlight {
    color: var(--success-color);
    font-size: 1.1rem;
}

/* Educational Section */
.educational-section {
    padding: 3rem 0;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
}

.content-main h2 {
    margin-top: 1.5rem;
}

.content-main ol,
.content-main ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color-light);
}

.content-main li {
    margin-bottom: 0.5rem;
}

.disclaimer-box {
    background-color: #fff3cd; /* Light warning yellow */
    border: 1px solid #ffeeba;
    color: #856404; /* Dark warning text */
    padding: 1rem;
    border-radius: 4px;
    margin-top: 2rem;
    display: flex;
    align-items: flex-start;
}

.disclaimer-box i {
    font-size: 1.5rem;
    margin-right: 15px;
    color: #ffc107;
}

.disclaimer-box p {
    margin: 0;
    color: #856404;
}

/* Sidebar Styles */
.sidebar-card {
    background-color: var(--card-background);
    padding: 1.5rem;
    border-radius: 6px;
    box-shadow: var(--shadow-light);
    margin-bottom: 2rem;
}

.sidebar-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    margin-bottom: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
}

.feature-list li i {
    color: var(--success-color);
    margin-right: 10px;
    font-size: 1.1rem;
}

.tip {
    border-left: 3px solid var(--primary-color);
    padding-left: 15px;
    margin-bottom: 1rem;
}

.tip i {
    color: var(--primary-color);
    margin-right: 10px;
}

.tip p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-color);
}

/* Footer */
.footer {
    background-color: var(--text-color); /* Dark background */
    color: white;
    padding: 3rem 0 1rem 0;
    margin-top: 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.footer-logo i {
    margin-right: 8px;
    color: var(--primary-color);
}

.footer-column p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.footer-column h4 {
    color: white;
    margin-bottom: 1rem;
    font-weight: 600;
}

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

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

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

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

.social-links {
    margin-top: 1.5rem;
    display: flex;
    gap: 15px;
}

.social-link {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: white;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
    
    /* FIX: Ensure minimum size for social links */
    min-width: 48px;
    min-height: 48px;
    padding: 0; 
}

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

.footer-bottom {
    text-align: center;
    padding-top: 1rem;
}

.footer-bottom p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin: 0;
}


/* ===================================
   Calculator Error Message (Validation)
   =================================== */
.error-message {
    color: #ff4d4d; /* Bright red */
    background-color: #ffe6e6; /* Light pink background */
    border: 1px solid #ff4d4d;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 5px;
    font-weight: 500;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 968px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
  .mobile-menu-btn {
    display: block; /* Show on mobile */
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    /* FIX: Increase touch target size */
    padding: 1rem; 
    line-height: 1; 
}
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .calculator-body {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .results-summary {
        grid-template-columns: 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    /* MOVED FROM JS: Mobile Menu Override */
    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
        padding: 1rem;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 3rem 0;
    }
    
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .calculator-body,
    .results-section {
        padding: 1.5rem;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

/* ===================================
   CSP FIX: Success Message Styles 
   ================================== */
.success-message {
    position: fixed;
    top: 100px;
    left: 50%;
    /* transform: translateX(-50%) is handled by keyframes */
    background: var(--success-color); 
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    animation: slideDown 0.3s ease-out; 
}

/* Keyframes MOVED FROM main.js */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}