/* AutoCode generated style.css for Marketing Automation Website - Iteration 5 */

/* --- CSS Variables --- */
:root {
    /* Light Theme Variables */
    --primary-color: #2980b9; /* A professional blue for accents */
    --secondary-color: #34495e; /* Darker blue/gray for main text/headings */
    --text-color: #333;
    --background-color: #f4f7f6;
    --light-gray: #ecf0f1;
    --border-color: #ddd;
    --spacing-unit: 16px; /* Base spacing unit */
    --font-family-base: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-base: 16px;

    --card-background: #ffffff;
    --button-background: var(--primary-color);
    --button-text-color: #ffffff;
    --status-active: #27ae60; /* Green */
    --status-scheduled: #f39c12; /* Orange */
    --status-draft: #95a5a6; /* Gray */
    --error-color: #e74c3c; /* Red for errors/required */
    --success-color: #28a745; /* Green for success messages */

    /* Dark Theme Variables (for future implementation, not active by default) */
    --dark-primary-color: #5dade2;
    --dark-secondary-color: #aeb6bf;
    --dark-text-color: #e0e0e0;
    --dark-background-color: #1a202c;
    --dark-light-gray: #2d3748;
    --dark-border-color: #4a5568;
    --dark-card-background: #232d3a;
    --dark-button-background: var(--dark-primary-color);
    --dark-button-text-color: #ffffff;
    --dark-error-color: #ff6b6b;
    --dark-success-color: #2ecc71;
}

/* --- Global Reset & Base Styles --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: var(--spacing-unit);
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center content horizontally */
    gap: var(--spacing-unit); /* Space between header, app, footer */
}

/* Initial header styling */
header {
    background-color: var(--card-background);
    padding: calc(var(--spacing-unit) * 1.2) calc(var(--spacing-unit) * 1.8); /* Slightly more padding */
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    max-width: 900px; /* Wider for the main header */
    width: 100%;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    line-height: 1.2;
    color: var(--secondary-color);
    margin: 0 0 calc(var(--spacing-unit) / 2); /* Adjust margin */
}

header p { /* Added styling for header paragraph */
    font-size: 1.1em;
    color: var(--text-color);
    margin-top: calc(var(--spacing-unit) / 2);
    line-height: 1.5;
}

/* Hide the static main content and footer as the JS app takes over */
/* The initial paragraph from index.html is removed by script.js. */
body > footer {
    display: none; /* Footer is hidden by default, can be shown by JS if needed */
}

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

a:hover {
    color: #216fa3; /* A darker shade of primary-color */
}

button {
    background-color: var(--button-background);
    color: var(--button-text-color);
    border: none;
    padding: calc(var(--spacing-unit) / 2) var(--spacing-unit);
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--font-size-base);
    transition: background-color 0.3s ease, box-shadow 0.2s ease;
    min-width: 120px;
}

button:hover {
    background-color: #216fa3; /* Darker primary for hover */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* Focus states for all interactive elements */
input:focus,
select:focus,
textarea:focus,
button:focus,
a:focus {
    outline: none; /* Remove default outline */
    border-color: var(--primary-color); /* Highlight border */
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.3); /* Custom focus ring */
}

/* --- Utility Classes --- */
.hidden {
    display: none !important;
}

.required-asterisk {
    color: var(--error-color);
    font-weight: bold;
    margin-left: 4px;
}

.error-message, .success-message {
    font-size: 0.9em;
    margin-top: calc(var(--spacing-unit) / 4);
    padding: calc(var(--spacing-unit) / 4) calc(var(--spacing-unit) / 2);
    border-radius: 4px;
    opacity: 0; /* Default hidden, JS will change opacity */
    transition: opacity 0.3s ease-in-out, background-color 0.3s ease;
    display: block; /* Ensure it takes full width */
}

.error-message {
    color: #ffffff;
    background-color: var(--error-color);
    border: 1px solid var(--error-color);
}

.success-message {
    color: #ffffff;
    background-color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* --- App Container --- */
#app {
    display: flex;
    flex-direction: column;
    background-color: var(--card-background);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Slightly softer shadow */
    max-width: 900px;
    width: 100%;
    min-height: 70vh; /* Ensure app takes significant height */
    overflow: hidden; /* For potential internal scrolling */
}

/* --- Main Navigation --- */
#main-nav {
    background-color: var(--secondary-color);
    padding: 0 var(--spacing-unit);
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); /* Subtle separator */
}

#main-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: flex-start; /* Align tabs to start */
    gap: 8px; /* Space between nav items */
}

#main-nav li a {
    display: block;
    padding: calc(var(--spacing-unit) / 2) var(--spacing-unit);
    color: var(--light-gray);
    font-weight: bold;
    border-radius: 4px 4px 0 0; /* Rounded top corners for tabs */
    transition: background-color 0.3s ease, color 0.3s ease;
}

#main-nav li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Updated to match script.js's ACTIVE_NAV_LINK_CLASS */
#main-nav li a.active-nav-link {
    background-color: var(--primary-color); /* Active tab color */
    color: #ffffff;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1); /* Subtle shadow for active tab */
}

/* --- Main Content Area --- */
#app-content {
    flex-grow: 1; /* Take up remaining space */
    padding: var(--spacing-unit) calc(var(--spacing-unit) * 1.5);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-unit);
}

.app-section {
    padding: var(--spacing-unit);
    background-color: var(--card-background); /* Sections inside app are also cards */
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    /* Ensure sections are focusable for accessibility when switching */
    outline: none; /* Keep for general state to avoid browser default, but add specific focus */
}

/* Add a focus style for the active app section */
.app-section.active:focus-visible {
    box-shadow: 0 0 0 4px rgba(41, 128, 185, 0.4), 0 2px 4px rgba(0, 0, 0, 0.05); /* Enhanced focus ring */
    border-color: var(--primary-color);
}


.app-section.hidden {
    display: none;
}

.app-section h2 {
    color: var(--primary-color);
    font-size: 1.8em;
    margin-top: 0;
    margin-bottom: var(--spacing-unit);
    border-bottom: 1px solid var(--light-gray);
    padding-bottom: calc(var(--spacing-unit) / 2);
}

.app-section h3 {
    color: var(--secondary-color);
    font-size: 1.3em;
    margin-top: var(--spacing-unit);
    margin-bottom: calc(var(--spacing-unit) / 2);
}

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

.form-group:last-of-type {
    margin-bottom: 0; /* No margin after the last form group in a sequence */
}

.form-group label {
    display: block;
    margin-bottom: calc(var(--spacing-unit) / 4); /* Added margin-bottom for better spacing */
    font-weight: bold;
    color: var(--secondary-color);
}

/* Common styles for all text inputs, selects, and textareas */
input[type="text"],
input[type="datetime-local"],
select,
textarea {
    padding: calc(var(--spacing-unit) / 2);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    width: 100%;
    line-height: 1.5; /* Ensure consistent vertical alignment */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Specific textarea styling */
textarea {
    min-height: 100px;
    resize: vertical; /* Allow vertical resizing for textarea */
}


/* --- Dashboard Specific Styles --- */
.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-unit);
    margin-bottom: var(--spacing-unit);
}

.metric-card {
    background-color: var(--light-gray);
    padding: var(--spacing-unit);
    border-radius: 6px;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--secondary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease; /* Added transition */
}

.metric-card:hover { /* Added hover effect */
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.metric-card span {
    display: block;
    font-size: 0.8em;
    color: var(--text-color);
    font-weight: normal;
    margin-bottom: 5px;
}

.app-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.app-section ul li {
    background-color: var(--light-gray);
    padding: calc(var(--spacing-unit) / 2) var(--spacing-unit);
    border-radius: 4px;
    margin-bottom: calc(var(--spacing-unit) / 2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-color);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease; /* Added transition */
}

.app-section ul li:hover { /* Added hover effect */
    background-color: #e0e6e8; /* Slightly darker than light-gray */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    color: #ffffff;
}

.status.active {
    background-color: var(--status-active);
}

.status.scheduled {
    background-color: var(--status-scheduled);
}

.status.draft {
    background-color: var(--status-draft);
}

/* --- AI Content Generator Specific Styles --- */
.content-generator {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) / 2); /* Controls spacing between form groups and buttons */
}

.content-generator button {
    align-self: flex-start; /* Align button to start */
    margin-top: var(--spacing-unit); /* Add extra space above buttons */
}

#copy-content-btn {
    margin-top: calc(var(--spacing-unit) / 2); /* Smaller margin for copy button */
}

.output-area {
    background-color: var(--light-gray);
    border: 1px dashed var(--border-color);
    border-radius: 4px;
    padding: var(--spacing-unit);
    min-height: 150px;
    margin-top: var(--spacing-unit);
    white-space: pre-wrap; /* Preserve whitespace and break lines */
    word-wrap: break-word; /* Break long words */
    text-align: left;
    color: var(--text-color);
}

.output-area p {
    margin: 0; /* Reset paragraph margin inside output area */
    padding: 0; /* Reset paragraph padding inside output area */
    background-color: transparent; /* Reset paragraph background */
    box-shadow: none; /* Reset paragraph shadow */
    width: auto; /* Reset paragraph width */
}

.output-area h3 { /* Style for generated content headings */
    color: var(--secondary-color);
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: calc(var(--spacing-unit) / 2);
}

.output-area ul { /* Added styling for lists within output area */
    list-style: disc;
    padding-left: var(--spacing-unit);
    margin-top: calc(var(--spacing-unit) / 2);
    margin-bottom: calc(var(--spacing-unit) / 2);
}

.output-area li { /* Added styling for list items within output area */
    margin-bottom: calc(var(--spacing-unit) / 4);
    background-color: transparent; /* Override parent li style */
    border: none;
    box-shadow: none;
    padding: 0;
    display: list-item; /* Override flex display if any parent ul li has it */
}


/* --- Campaigns Section Specific Styles --- */
.campaign-creator {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) / 2);
}

#add-campaign-btn {
    margin-top: var(--spacing-unit);
    align-self: flex-start;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    :root {
        --font-size-base: 15px;
        --spacing-unit: 12px;
    }

    body {
        padding: var(--spacing-unit);
        gap: var(--spacing-unit);
    }

    header {
        padding: var(--spacing-unit);
    }

    header h1 {
        font-size: 2em;
    }

    header p { /* Responsive adjustment for header paragraph */
        font-size: 1em;
    }

    #app {
        min-height: 60vh;
    }

    #main-nav ul {
        flex-wrap: wrap; /* Allow nav items to wrap */
        justify-content: center;
    }

    #main-nav li a {
        padding: calc(var(--spacing-unit) / 2) calc(var(--spacing-unit) * 0.8);
    }

    #app-content {
        padding: var(--spacing-unit);
    }

    .app-section h2 {
        font-size: 1.6em;
    }

    .app-section h3 {
        font-size: 1.2em;
    }

    .metrics {
        grid-template-columns: 1fr; /* Stack metric cards on small screens */
    }

    .metric-card {
        padding: calc(var(--spacing-unit) * 0.8);
        font-size: 1em;
    }

    .status {
        font-size: 0.75em;
        padding: 3px 6px;
    }

    button {
        min-width: unset; /* Remove min-width on small screens */
        width: 100%; /* Make buttons full width */
    }

    .content-generator button,
    #add-campaign-btn {
        align-self: stretch; /* Make button full width */
    }
}

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

    body {
        padding: var(--spacing-unit);
        gap: var(--spacing-unit);
    }

    header h1 {
        font-size: 1.8em;
    }

    header p { /* Responsive adjustment for header paragraph */
        font-size: 0.9em;
    }

    #app {
        min-height: 50vh;
    }

    #main-nav li a {
        padding: calc(var(--spacing-unit) / 2);
        font-size: 0.9em;
    }

    #app-content {
        padding: var(--spacing-unit);
    }

    .app-section h2 {
        font-size: 1.4em;
    }

    .app-section h3 {
        font-size: 1.1em;
    }

    .metric-card {
        padding: calc(var(--spacing-unit) * 0.6);
    }
}