/* Global Styles */
:root {
    --primary-color: #E62117; /* Deep Red */
    --primary-hover: #c41e15;
    --bg-color: #F9FAFB; /* Light Gray */
    --text-color: #111827;
    --text-muted: #6B7280;
    --card-bg: #FFFFFF;
    --border-color: #E5E7EB;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

/* Header */
header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
}

h1 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
    color: var(--text-color);
    font-weight: 700;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin: 0;
}

/* Main Content */
main {
    flex: 1;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Ad Spaces */
.ad-space {
    background-color: #f3f4f6;
    border: 1px dashed #d1d5db;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
    border-radius: var(--radius);
    position: relative;
    min-height: 100px; /* Placeholder height */
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-label {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    font-size: 0.625rem;
    color: #9ca3af;
    text-transform: uppercase;
}

/* Input Section */
.input-section {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    text-align: center;
}

.input-group {
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

@media (min-width: 640px) {
    .input-group {
        flex-direction: row;
    }
}

input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 33, 23, 0.1);
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: var(--primary-hover);
}

.error-msg {
    color: var(--primary-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    text-align: left;
}

.hidden {
    display: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loadingText {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-color);
}

/* Result Section */
.result-section {
    margin-bottom: 2rem;
}

.thumbnail-card {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    margin-bottom: 2rem;
}

#thumbnailImg {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn.secondary {
    background-color: white;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    text-decoration: none;
    display: inline-block;
}

.btn.secondary:hover {
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

/* SEO Content */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .feature-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.feature-item h2 {
    font-size: 1.25rem;
    color: var(--text-color);
    margin-bottom: 0.75rem;
}

.feature-item p, .feature-item li {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.feature-item ul, .feature-item ol {
    padding-left: 1.5rem;
}

/* Footer */
footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    text-align: center;
    margin-top: auto;
}

footer p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}
