/* Basic CSS Reset / Normalize */
body, h1, p, nav, footer, header, main, section, div, ul, li, a, button, input, select, textarea, blockquote, pre {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Define CSS Variables (Custom Properties) */
:root {
    --primary-color: #005A9C; /* Example Blue */
    --secondary-color: #F58025; /* Example Orange */
    --accent-color: #00A9E0; /* Lighter Blue */
    --text-color: #333;
    --light-gray: #f4f4f4;
    --dark-gray: #555;
    --white-color: #fff;
    --border-color: #ddd;

    --base-font-size: 16px;
    --font-family-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --font-family-serif: Georgia, 'Times New Roman', Times, serif; /* Optional */

    --spacing-unit: 1rem; /* 16px */
}

body {
    font-family: var(--font-family-sans);
    font-size: var(--base-font-size);
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--white-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Ensure footer sticks to bottom */
}

main {
    flex-grow: 1; /* Allow main content to take up available space */
    width: 100%; /* Ensure main takes full width */
}


/* General Layout & Spacing */
.container { /* Optional wrapper for content */
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 var(--spacing-unit);
    width: 100%;
}

/* Apply default padding/margin to sections within main */
main > section {
    padding: calc(var(--spacing-unit) * 2) var(--spacing-unit); /* Add horizontal padding */
    margin-bottom: var(--spacing-unit);
    max-width: 1100px; /* Consistent max-width */
    margin-left: auto;
    margin-right: auto;
}

/* Typography */
h1, h2, h3 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-unit);
    line-height: 1.3;
}

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

p {
    margin-bottom: var(--spacing-unit);
}

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

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

pre {
    white-space: pre-wrap; /* Allow text wrapping */
    word-wrap: break-word;
    font-family: var(--font-family-sans); /* Use standard font */
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
    background-color: var(--light-gray); /* Basic background for pre */
    padding: var(--spacing-unit);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow-x: auto; /* Add scroll if needed */
}

/* Buttons */
.cta-button, .submit-button, .download-button, .upload-label { /* Include upload-label for consistency */
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin-right: calc(var(--spacing-unit) * 0.5); /* Spacing between buttons */
    margin-bottom: calc(var(--spacing-unit) * 0.5); /* Spacing below buttons */
}

.cta-button:hover, .submit-button:hover, .download-button:hover, .upload-label:hover {
    background-color: var(--secondary-color);
    color: var(--white-color);
    text-decoration: none;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-unit);
}

.form-group label {
    display: block;
    margin-bottom: calc(var(--spacing-unit) * 0.25);
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: calc(var(--spacing-unit) * 0.5);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group textarea {
    resize: vertical; /* Allow vertical resize */
    min-height: 100px; /* Minimum height for textareas */
}

/* Status Messages (Used by JS) */
#form-status, #upload-status {
    margin-top: var(--spacing-unit);
    padding: var(--spacing-unit);
    border-radius: 5px;
    display: none; /* Hidden by default */
    text-align: center;
}

#form-status.success, #upload-status.success {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green */
    border: 1px solid #c3e6cb;
    display: block;
}

#form-status.error, #upload-status.error {
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red */
    border: 1px solid #f5c6cb;
    display: block;
}

#upload-status.loading,
#upload-status.payment { /* For simulation messages */
    background-color: #e2e3e5; /* Light gray */
    color: #383d41; /* Dark gray */
    border: 1px solid #d6d8db;
    display: block;
}


/* Header Styles */
header {
    background-color: var(--light-gray);
    padding: var(--spacing-unit) 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    background-color: rgba(244, 244, 244, 0.95); /* Slight transparency if sticky */
    backdrop-filter: blur(5px); /* Optional blur effect if sticky */
}

/* Footer Styles */
footer {
    background-color: var(--dark-gray);
    color: var(--white-color);
    text-align: center;
    padding: calc(var(--spacing-unit) * 1.5) var(--spacing-unit);
    margin-top: auto; /* Pushes footer to bottom */
    width: 100%;
}

footer p {
    margin-bottom: calc(var(--spacing-unit) * 0.5);
}

/* Basic Nav Styling (Header) */
header nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}
header nav ul li {
    display: inline-block;
    margin: 0 calc(var(--spacing-unit) * 0.75);
}
header nav ul li a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: bold;
    padding: calc(var(--spacing-unit) * 0.5) calc(var(--spacing-unit));
    border-radius: 4px;
    transition: background-color 0.2s ease, color 0.2s ease;
}
header nav ul li a:hover,
header nav ul li a.active { /* Active class set by JS */
    color: var(--white-color);
    background-color: var(--primary-color);
    text-decoration: none;
}

/* Footer Nav Styling */
.footer-nav ul {
    list-style: none;
    padding: 0;
    margin: calc(var(--spacing-unit) * 0.5) 0 0 0;
    text-align: center;
}
.footer-nav ul li {
    display: inline-block;
    margin: 0 calc(var(--spacing-unit) * 0.75);
}
.footer-nav ul li a {
    text-decoration: none;
    color: #ccc; /* Lighter color for footer links */
}
.footer-nav ul li a:hover {
    color: var(--white-color);
    text-decoration: underline;
}

/* Utility Classes */
.text-center { text-align: center; }
.margin-top-md { margin-top: var(--spacing-unit); }


/* --- Modal Styles --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1040; /* Below modal, above other content */
    display: none; /* Hidden by default */
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--white-color);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 1050; /* Above backdrop */
    width: 90%;
    max-width: 500px; /* Max width for the modal */
    display: none; /* Hidden by default */
    max-height: 90vh; /* Max height */
    overflow-y: auto; /* Scroll if content overflows */
}

.modal-content {
    /* Add specific styling for content area if needed */
}

.modal h2 {
    margin-top: 0;
    margin-bottom: calc(var(--spacing-unit) * 1.5);
    text-align: center;
    color: var(--primary-color);
}

.modal .form-group {
    margin-bottom: calc(var(--spacing-unit) * 1.2);
}

.modal .submit-button {
    width: 100%;
    padding: calc(var(--spacing-unit) * 0.7);
    margin-top: var(--spacing-unit);
}

.modal .close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--dark-gray);
    cursor: pointer;
    line-height: 1;
}

.modal .close-button:hover {
    color: var(--text-color);
}

.modal .error-message,
.modal .success-message {
    text-align: center;
    padding: calc(var(--spacing-unit) * 0.5);
    margin-top: var(--spacing-unit);
    border-radius: 4px;
    font-size: 0.9rem;
}

.modal .error-message {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block; /* Ensure it shows when populated */
}

.modal .success-message {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block; /* Ensure it shows when populated */
}


/* --- Basic Responsive Design --- */

/* Medium screens (Tablets) */
@media (max-width: 992px) {
    .container, main > section {
        max-width: 90%;
    }
    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.4rem; }
}

/* Small screens (Mobiles) */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.3rem; }

    header nav ul li {
        margin: 0 calc(var(--spacing-unit) * 0.5); /* Reduce nav spacing */
    }
    header nav ul li a {
        padding: calc(var(--spacing-unit) * 0.4) calc(var(--spacing-unit) * 0.8);
    }

    .cta-button, .submit-button, .download-button, .upload-label {
        padding: calc(var(--spacing-unit) * 0.6) calc(var(--spacing-unit) * 1.2);
        font-size: 0.95rem;
        width: auto; /* Ensure buttons don't stretch full width unless intended */
    }

    /* Stack buttons if needed in specific contexts (handled in page-specific CSS) */
}
