/* vibegen - CSS Stylesheet */

:root {
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --transition: all 0.2s ease-in-out;
}

/* Light Theme */
[data-theme="light"] {
    --bg-page: #f5f7fb;
    --bg-card: #ffffff;
    --bg-card-subtle: #f9fafb;
    --bg-input: #ffffff;
    --border-color: #e2e8f0;
    --border-focus: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-contrast: #ffffff;
    --accent-yellow: #ca8a04;
    --accent-green: #16a34a;
    --code-bg: #0f172a;
    --code-text: #f8fafc;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-page: #0b0f19;
    --bg-card: #111827;
    --bg-card-subtle: #1f2937;
    --bg-input: #172033;
    --border-color: #2e3a50;
    --border-focus: #60a5fa;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-contrast: #ffffff;
    --accent-yellow: #facc15;
    --accent-green: #22c55e;
    --code-bg: #060911;
    --code-text: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-badge {
    font-size: 1.8rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    width: 2.8rem;
    height: 2.8rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Main Container */
.app-container {
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.85rem;
    flex: 1;
}

#vibegen-form {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

/* Cards & Fieldsets */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    box-shadow: var(--shadow-sm);
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
    transition: var(--transition);
}

.form-section:focus-within {
    border-color: var(--border-focus);
}

.section-legend {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-icon {
    font-size: 1.25rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Presets Grid */
.presets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 0.85rem;
}

.presets-grid .btn,
.btn-preset {
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.35rem;
    transition: var(--transition);
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    height: auto;
    width: 100%;
    min-width: 0;
}

.btn-preset:hover {
    background-color: var(--bg-card);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.preset-icon {
    font-size: 1.4rem;
    line-height: 1;
    margin-bottom: 0.15rem;
}

.preset-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.preset-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.35;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
}
    color: var(--text-muted);
    line-height: 1.3;
}

/* Form Elements */
.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.flex-1 { flex: 1; min-width: 220px; }
.flex-2 { flex: 2; min-width: 260px; }
.flex-3 { flex: 3; min-width: 320px; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.required {
    color: #ef4444;
}

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.85rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

textarea {
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.4;
}

.input-with-toggle {
    display: flex;
    gap: 0.5rem;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
    line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.2rem;
    accent-color: var(--primary);
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    cursor: pointer;
}

.email-suboption {
    padding-left: 1.5rem;
    border-left: 2px solid var(--border-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: var(--transition);
    user-select: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-contrast);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--bg-card-subtle);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
    border-radius: var(--radius-md);
}

/* Generate Bar */
.generate-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    bottom: 1rem;
    z-index: 90;
    background-color: var(--bg-card);
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-md);
}

.generate-controls {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

/* Output Section */
.output-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--border-color);
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.output-title-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.output-title-group h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.stats-badge {
    background-color: var(--bg-card-subtle);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
}

.status-ok {
    color: var(--accent-green);
    font-weight: bold;
}

.status-warn {
    color: #ef4444;
    font-weight: bold;
}

.output-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Copy Button Styling (incorporating webutils copy-button styles) */
.copy-button {
    height: 2.2rem;
    min-width: 2.2rem;
    padding: 0.35rem 0.6rem;
    background-color: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.copy-button:hover {
    background-color: var(--border-color);
}

.copy-button img {
    height: 1.2rem;
    width: auto;
}

/* Output Pre Box */
.output-container {
    position: relative;
    max-height: 600px;
    overflow-y: auto;
    border-radius: var(--radius-md);
    background-color: var(--code-bg);
    border: 1px solid var(--border-color);
}

#generated-prompt {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--code-text);
    padding: 1.25rem;
    white-space: pre;
    overflow-x: auto;
    tab-size: 4;
}

/* Footer */
.app-footer {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 1.25rem;
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

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

.footer-container a:hover {
    text-decoration: underline;
}

/* Utility Classes */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }

/* Responsive Adjustments */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .generate-bar {
        position: static;
    }

    .output-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .output-actions {
        width: 100%;
        justify-content: space-between;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .email-suboption {
        padding-left: 0.75rem;
    }
}
