/* static/css/style.css */

/* General Body and Layout */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5; /* Light grey background */
    color: #333;
    line-height: 1.6;
}

/* Header Styling */
header {
    background-color: #0056b3; /* Darker blue */
    color: #ffffff;
    padding: 15px 20px; /* Add horizontal padding */
    display: flex; /* Use flexbox for layout */
    justify-content: space-between; /* Space out title/toggle and nav */
    align-items: center; /* Vertically align items */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    position: relative; /* Needed for absolute positioning of mobile nav */
}

header h1 {
    margin: 0;
    font-size: 2.2em;
}

/* Navigation Styling (Desktop/Larger Screens) */
.main-nav {
    display: flex; /* Ensure links are in a row */
}
.main-nav a {
    margin-left: 15px; /* Space between links */
    color: #ffffff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease, background-color 0.3s ease;
    padding: 5px 10px;
    border-radius: 4px;
}
.main-nav a:hover {
    color: #e0f2f7; /* Very light blue on hover */
    background-color: rgba(255, 255, 255, 0.2);
}

/* Hamburger Menu Toggle Button (Hidden by default on Desktop) */
.menu-toggle {
    display: none; /* Hide on larger screens by default */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1000; /* Ensure it's above other content if necessary */
}

.hamburger-icon {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #ffffff; /* White lines for hamburger */
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* Styles for when the menu is open (hamburger icon transformation) */
.menu-toggle.active .hamburger-icon:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.menu-toggle.active .hamburger-icon:nth-child(2) {
    opacity: 0;
}
.menu-toggle.active .hamburger-icon:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* --- Media Query for Mobile Devices --- */
@media (max-width: 768px) {
    header {
        flex-wrap: wrap; /* Allow items to wrap to next line if needed */
        justify-content: space-between; /* Keep title/toggle spaced */
        padding: 10px 15px;
    }

    header h1 {
        font-size: 1.8em; /* Adjust font size for mobile */
    }

    .menu-toggle {
        display: block; /* Show hamburger icon on mobile */
    }

    .main-nav {
        display: none; /* Hide navigation links by default on mobile */
        flex-direction: column; /* Stack links vertically */
        width: 100%; /* Take full width */
        position: absolute; /* Position relative to header */
        top: 65px; /* Adjust based on header height for mobile */
        left: 0;
        background-color: #004085; /* Slightly darker blue for mobile menu background */
        box-shadow: 0 5px 10px rgba(0,0,0,0.3);
        padding: 10px 0;
        z-index: 999; /* Ensure menu is above main content */
        max-height: 0; /* Hidden state */
        overflow: hidden; /* Hide overflow content */
        transition: max-height 0.3s ease-out, padding 0.3s ease-out; /* Smooth slide transition */
    }

    .main-nav.active { /* Class added by JavaScript when menu is open */
        display: flex; /* Show the menu */
        max-height: 200px; /* Adjust as needed to fit all links, allows transition */
        padding: 15px 0;
    }

    .main-nav a {
        margin: 0; /* Remove horizontal margins */
        padding: 10px 20px; /* Add vertical padding for touch targets */
        border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Separator lines */
        text-align: center;
        width: auto; /* Allow links to naturally size */
    }

    .main-nav a:last-child {
        border-bottom: none; /* No border on last item */
    }
}


/* Main Content Area */
main {
    max-width: 960px;
    margin: 30px auto;
    padding: 30px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Section Headings */
section {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}
section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

h2 {
    color: #0056b3;
    font-size: 1.8em;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

h3 {
    color: #34495e;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.4em;
}

/* Form Styling */
form {
    background-color: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}
form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}
form input[type="text"],
form select,
form textarea {
    width: calc(100% - 22px); /* Account for padding and border */
    padding: 10px;
    margin-bottom: 18px; /* Slightly more space */
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; /* Include padding in width calculation */
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
form input[type="text"]:focus,
form select:focus,
form textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}
form textarea {
    resize: vertical; /* Allow vertical resizing */
    min-height: 80px;
}
form button {
    background-color: #007bff; /* Primary button color */
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
    display: inline-block; /* Prevent full width */
}
form button:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}
form button:active {
    transform: translateY(0);
}

/* Loader, Status, and Error Message Styling */
.hidden {
    display: none;
}
.loader {
    text-align: center;
    margin: 25px 0;
    font-size: 1.3em;
    color: #007bff; /* Primary color */
    font-weight: bold;
    animation: pulse 1.5s infinite alternate; /* Simple animation */
}
@keyframes pulse {
    from { opacity: 1; }
    to { opacity: 0.7; }
}

.status-message { /* General status messages */
    text-align: center;
    margin: 25px 0;
    padding: 15px;
    border-radius: 5px;
    font-weight: bold;
    opacity: 1; /* Start visible */
    transition: opacity 0.5s ease-out; /* Smooth fade-out */
}
.status-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
.status-message.error { /* For API errors not caught by general error-message */
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}


.error-message { /* For validation or network errors */
    color: #d9534f; /* Red for errors */
    font-weight: bold;
    text-align: center;
    margin: 25px 0;
    padding: 15px;
    border: 1px solid #d9534f;
    background-color: #fdd;
    border-radius: 5px;
}

/* Generated Content Output Area */
.email-output {
    border: 1px solid #cceeff; /* Light blue border */
    padding: 25px;
    margin-top: 30px;
    background-color: #e6f7ff; /* Very light blue background */
    min-height: 120px; /* Ensure it's visible even when empty */
    overflow-x: auto; /* For horizontal scrolling if content is wide */
    white-space: pre-wrap; /* Preserve whitespace and line breaks for better HTML display */
    font-family: 'Roboto Mono', 'Consolas', monospace; /* Monospaced font for code/email content */
    line-height: 1.7;
    border-radius: 8px;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.05); /* Subtle inner shadow */
    position: relative; /* For positioning download button */
}

/* Specific messages within the output area */
.email-output .loading-preview {
    text-align: center;
    color: #007bff;
    font-style: italic;
    padding: 20px;
}
.email-output .error-preview {
    text-align: center;
    color: #d9534f;
    font-style: italic;
    padding: 20px;
}

/* Download Button Styling */
.download-btn-container {
    text-align: right; /* Position button to the right */
    margin-top: 15px; /* Space from email output */
}
.download-btn {
    background-color: #28a745; /* Green for download */
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.download-btn:hover {
    background-color: #218838;
}

/* --- Styling for the "Built By" Section --- */
.built-by {
    background-color: #ffffff; /* White background */
    padding: 30px; /* Padding inside the section */
    margin: 30px auto; /* Margin top/bottom, auto for horizontal centering */
    border-radius: 8px; /* Slightly rounded corners */
    box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* Subtle shadow for depth */
    max-width: 800px; /* Limit width for readability, same as main sections */
    text-align: center; /* Center the text within the section */
}

.built-by p {
    font-size: 1.1em; /* Slightly larger font for prominence */
    line-height: 1.8; /* Good line spacing */
    color: #555; /* A slightly softer text color */
    margin-bottom: 0; /* Remove default paragraph bottom margin */
}

.built-by a {
    color: #007bff; /* Consistent link color */
    text-decoration: none; /* No underline by default */
    font-weight: bold; /* Make the link text bold */
    transition: color 0.3s ease; /* Smooth transition for hover */
}

.built-by a:hover {
    color: #0056b3; /* Darker blue on hover */
    text-decoration: underline; /* Underline on hover */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .built-by {
        padding: 20px; /* Smaller padding on mobile */
        margin: 20px 15px; /* Adjust margin for mobile to prevent touching edges */
    }
    .built-by p {
        font-size: 1em; /* Adjust font size for mobile readability */
    }
}

/* Feedback Status Message */
#feedback-status {
    margin-top: 15px;
    font-weight: bold;
    text-align: center;
    padding: 10px; /* Add padding for visual appeal */
    border-radius: 5px;
}
#feedback-status[style*="green"] { /* Targets color set by JS */
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}
#feedback-status[style*="red"] { /* Targets color set by JS */
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Footer Styling */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    color: #777;
    font-size: 0.9em;
    border-top: 1px solid #e0e0e0;
    background-color: #f9f9f9;
}

/* Horizontal Rule for separation */
hr {
    border: 0;
    height: 1px;
    background: #e0e0e0;
    margin: 40px 0;
}