/* Global Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    line-height: 1.6;
    color: #4a5568;
}

/* Ad Placeholder Styles */
.ad-placeholder {
    background: #f8fafc;
    border: 2px dashed #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

.ad-placeholder::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Top Banner Ad */
.ad-top {
    width: 728px;
    height: 90px;
    max-width: 100%;
    margin-bottom: 20px;
}

/* Bottom Banner Ad */
.ad-bottom {
    width: 728px;
    height: 90px;
    max-width: 100%;
    margin-top: 20px;
}

/* Side Ads - Hidden by default */
.ad-sidebar {
    display: none;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 160px;
    height: 600px;
    z-index: 100;
}

.ad-left {
    left: 20px;
}

.ad-right {
    right: 20px;
}

/* Page Layout Container */
.page-container {
    width: 100%;
    max-width: 1200px;
    position: relative;
}

.container {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px 50px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 900px;
    width: 100%;
    animation: slideIn 0.6s ease-out;
    margin: 0 auto; /* Center the container */
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typography Styles */
h1 {
    text-align: center;
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    text-align: center;
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.1rem;
    font-weight: 400;
    line-height: 1.5;
}

h2 {
    color: #2d3748;
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.7rem;
    font-weight: 700;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

h3 {
    color: #2d3748;
    font-size: 1.4rem;
    margin-top: 30px;
    font-weight: 600;
    margin-bottom: 12px;
}

/* Calculator Specific Styles */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.input-group {
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #4a5568;
    font-weight: 600;
    font-size: 0.95rem;
}

input, textarea {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fff;
}

input:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

input:hover, textarea:hover {
    border-color: #cbd5e0;
}

textarea {
    min-height: 150px;
    resize: vertical;
}

.currency-input {
    position: relative;
}

.currency-input::before {
    content: '$';
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
}

.currency-input input {
    padding-left: 40px;
}

.percent-input {
    position: relative;
}

.percent-input::after {
    content: '%';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    font-weight: 600;
    pointer-events: none;
}

.percent-input input {
    padding-right: 40px;
}

.calculate-btn, .submit-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 18px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    width: 100%;
}

.calculate-btn:hover, .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.calculate-btn:active, .submit-btn:active {
    transform: translateY(0);
}

/* Results Section Styles */
.results-section {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid #e2e8f0;
}

.results-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 25px;
    text-align: center;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.result-label {
    color: #4a5568;
    font-weight: 500;
}

.result-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2d3748;
}

.monthly-payment {
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.3rem;
}

.breakdown {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #e2e8f0;
}

.breakdown-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 15px;
}

/* Contact Form Styles */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.contact-info {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid #e2e8f0;
}

.contact-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 25px;
    text-align: center;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.contact-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    margin-right: 15px;
    color: #667eea;
    font-size: 1.2rem;
}

.contact-content {
    flex-grow: 1;
}

.contact-label {
    color: #4a5568;
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.contact-text {
    color: #2d3748;
    font-size: 1rem;
    line-height: 1.5;
}

.contact-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.contact-text a:hover {
    color: #4a5568;
    text-decoration: underline;
}

.message-sent {
    display: none;
    background-color: #c6f6d5;
    border: 1px solid #9ae6b4;
    color: #276749;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 20px;
}

/* Content Sections (Terms, Privacy, etc.) */
.content-section {
    margin-bottom: 35px;
    padding: 0 10px;
}

.content-section p {
    margin-bottom: 18px;
    color: #4a5568;
    line-height: 1.8;
    font-size: 1.05rem;
    letter-spacing: 0.01rem;
    max-width: 80ch; /* Improves readability */
}

.content-section ul {
    margin-left: 25px;
    margin-bottom: 20px;
    color: #4a5568;
    line-height: 1.8;
    list-style-type: square;
    padding-left: 10px;
}

.content-section li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 5px;
}

.content-section a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 1px dotted rgba(102, 126, 234, 0.4);
    padding-bottom: 1px;
}

.content-section a:hover {
    color: #5a67d8;
    text-decoration: none;
    border-bottom: 1px solid rgba(90, 103, 216, 0.8);
}

.content-section strong {
    color: #2d3748;
    font-weight: 600;
    letter-spacing: 0.01rem;
}

/* Privacy Policy specific styles */
.privacy-intro {
    font-size: 1.1rem;
    line-height: 1.9;
    color: #2d3748;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(237, 242, 247, 0.5);
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

h4 {
    color: #4a5568;
    font-size: 1.2rem;
    font-weight: 600;
    margin-top: 25px;
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e2e8f0;
}

.last-updated-date {
    display: block;
    font-style: italic;
    color: #718096;
    margin: -5px 0 30px;
    text-align: center;
    font-size: 0.95rem;
}

/* Navigation and Links */
.back-link {
    display: block;
    text-align: center;
    margin-top: 30px;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.back-link:hover {
    color: #4a5568;
    transform: translateY(-2px);
}

.back-link:active {
    transform: translateY(0);
}

/* SEO Content Styles */
.seo-content {
    margin-top: 50px;
    padding-top: 40px;
    border-top: 2px solid #e2e8f0;
}

/* Footer Styles */
.footer {
    margin-top: 50px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    text-align: center;
    color: #4a5568;
    font-size: 0.9rem;
}

.footer p {
    margin-bottom: 10px;
}

.footer nav ul {
    list-style: none;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer nav ul li {
    display: inline;
}

.footer nav ul li a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer nav ul li a:hover {
    color: #4a5568;
}

.footer nav ul li a:focus {
    outline: none;
    text-decoration: underline;
}

.footer nav ul li a:active {
    color: #2d3748;
}

/* Utility Styles */
.error {
    border-color: #e53e3e !important;
    background-color: #fed7d7;
}

.error-message {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 5px;
}

.last-updated {
    font-style: italic;
    color: #718096;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 30px;
    font-size: 0.9rem;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
        margin: 0 auto;
    }

    .calculator-grid, .contact-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    h1 {
        font-size: 2rem;
    }

    .results-section {
        order: -1;
    }

    .contact-info {
        order: -1;
    }

    /* Mobile Ad Adjustments */
    .ad-top, .ad-bottom {
        width: 320px;
        height: 50px;
    }
    
    .footer nav ul {
        flex-direction: column;
        gap: 10px;
    }
}

/* Large Screen Media Query for Sidebar Ads */
@media (min-width: 1400px) {
    .ad-sidebar {
        display: flex;
    }
    
    .container {
        margin: 0 auto;
    }
    
    .footer {
        max-width: 1200px;
        margin: 0 auto;
    }
}

/* Extra Large Screen Adjustments */
@media (min-width: 1600px) {
    .container {
        margin: 0 auto;
    }
    
    .ad-left {
        left: 40px;
    }
    
    .ad-right {
        right: 40px;
    }
    
    .footer {
        max-width: 1400px;
    }
}

/* Privacy Policy Specific Enhancements */
.container h1 + .last-updated-date {
    margin-bottom: 35px;
}

/* Modern list styling */
.modern-list {
    list-style-type: none;
    padding-left: 0;
    margin-left: 0;
}

.modern-list li {
    margin-bottom: 15px;
    padding-left: 30px;
    position: relative;
}

.modern-list li:before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 0;
    color: #667eea;
    font-size: 18px;
}

.modern-list li strong {
    color: #4a5568;
    font-weight: 600;
}

/* Definition lists for privacy policy */
.definition-list {
    list-style-type: none;
    margin-left: 0 !important;
}

.definition-list li {
    margin-bottom: 20px;
    padding-left: 0;
    position: relative;
}

.definition-list li strong {
    color: #4a5568;
    font-size: 1.05rem;
    background: rgba(237, 242, 247, 0.7);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.definition-list p {
    margin-top: 2px;
    position: relative;
}

/* Section highlight boxes */
.highlight-box {
    background: rgba(237, 242, 247, 0.7);
    border-left: 4px solid #5a67d8;
    padding: 20px;
    margin: 25px 0;
    border-radius: 8px;
}

.highlight-box h4 {
    border-bottom: none;
    margin-top: 0;
}

/* Table styles for structured data */
.privacy-table-container {
    overflow-x: auto;
    margin: 25px 0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.privacy-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 8px;
    overflow: hidden;
}

.privacy-table th {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.privacy-table td {
    padding: 14px 20px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    line-height: 1.7;
}

.privacy-table tr:hover td {
    background-color: rgba(237, 242, 247, 0.5);
}

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

/* Print Button */
.print-button {
    display: inline-block;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    margin-top: 30px;
    text-align: center;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.print-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.print-button:before {
    content: "🖨️ ";
    margin-right: 5px;
}

/* Table of Contents */
.toc-container {
    background: rgba(237, 242, 247, 0.7);
    padding: 20px 30px;
    border-radius: 10px;
    margin: 30px 0;
    border-left: 4px solid #667eea;
}

.toc-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    color: #2d3748;
}

.toc-list {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 20px;
}

.toc-list li:before {
    content: '•';
    position: absolute;
    left: 0;
    top: 0;
    color: #667eea;
    font-size: 18px;
}

.toc-list a {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.toc-list a:hover {
    color: #667eea;
    text-decoration: none;
}

/* Print styles for privacy policy */
@media print {
    .ad-placeholder, .footer nav, .back-link {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .container {
        box-shadow: none !important;
        max-width: 100% !important;
        padding: 20px !important;
    }
    
    h1, h2, h3, h4 {
        page-break-after: avoid;
    }
    
    p, li {
        page-break-inside: avoid;
    }
}
