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

/* Root Variables */
:root {
    --primary-color: #2173DF;
    --primary-hover: #4f46e5;
    --secondary-color: #FFD800;
    --accent-color: #2173DF;
    --accent-light: #818cf8;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-elevation: 0 25px 50px rgba(0, 0, 0, 0.15), 0 15px 25px rgba(0, 0, 0, 0.08);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
}

a {
    color: var(--text-gray);
}

/* Header */
header {
    background: #222831;
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.95;
}

header a {
    color: white;
}

/* Main Container */
main {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

/* Sections */
section {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

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

.section-header h2 {
    margin-bottom: 0;
}

section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--text-dark);
    font-weight: 600;
    border-bottom: 3px solid var(--secondary-color);
    display:inline-flex;
}

.config-section {
    grid-column: 2;
    grid-row: 1 / 3;
}

.output-section {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 2rem;
    align-self: start;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.preview-section {
    grid-column: 1;
    grid-row: 2;
}

/* Form Groups */
.form-group {
    margin-bottom: 3rem;
}

/* Brand Header */
.brand-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.brand-header .toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 1rem;
}

/* Brand Input Container */
.brand-input-container {
    overflow: hidden;
    max-height: 200px;
    opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.4s ease;
}

.brand-input-container.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
}

/* Prompt Customization Section */
#customPrompts {
    margin-top: 1rem;
}

.prompt-customization {
    overflow: hidden;
    max-height: 500px;
    opacity: 1;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.4s ease, padding 0.4s ease;
}

.prompt-customization.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding: 0;
    border-width: 0;
}

.prompt-customization h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 600;
}

.prompt-customization textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-customization textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(33, 115, 223, 0.1);
}

code {
    background-color: #1e293b;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #afbbce;
}

.radio-group,
.checkbox-group {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Model Selection Grid */
.model-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.model-checkbox-label {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-white);
    min-height: 80px;
}

.model-checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.model-checkbox-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
}

.model-checkbox-content::before {
    content: '☐';
    font-size: 2rem;
    color: var(--text-gray);
    transition: opacity 0.3s;
}

.model-checkbox-label:has(input:checked) .model-checkbox-content::before {
    content: '';
    opacity: 0;
}

.model-icon {
    display: none;
    transition: transform 0.2s;
}

.model-checkbox-label:has(input:checked) .model-icon {
    display: block;
}

.model-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
}

/* Brand-specific colors */
.model-checkbox-label[data-model="chatgpt"] input:checked ~ .model-checkbox-content {
    color: #ffffff;
}

.model-checkbox-label[data-model="chatgpt"] input:checked {
    background-color: #74AA9C;
}

.model-checkbox-label[data-model="chatgpt"]:has(input:checked) {
    background-color: #74AA9C;
    border-color: #74AA9C;
}

.model-checkbox-label[data-model="chatgpt"]:has(input:checked) .model-name {
    color: #ffffff;
}

.model-checkbox-label[data-model="perplexity"]:has(input:checked) {
    background-color: #21808D;
    border-color: #21808D;
}

.model-checkbox-label[data-model="perplexity"]:has(input:checked) .model-name {
    color: #ffffff;
}

.model-checkbox-label[data-model="claude"]:has(input:checked) {
    background-color: #DE7356;
    border-color: #DE7356;
}

.model-checkbox-label[data-model="claude"]:has(input:checked) .model-name {
    color: #ffffff;
}

.model-checkbox-label[data-model="google"]:has(input:checked) {
    background-color: #4285F4;
    border-color: #4285F4;
}

.model-checkbox-label[data-model="google"]:has(input:checked) .model-name {
    color: #ffffff;
}

.model-checkbox-label[data-model="grok"]:has(input:checked) {
    background-color: #000000;
    border-color: #000000;
}

.model-checkbox-label[data-model="grok"]:has(input:checked) .model-name {
    color: #ffffff;
}

.model-checkbox-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.model-checkbox-label:hover .model-icon {
    transform: scale(1.1);
}

label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-dark);
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.2s;
}

label:hover {
    background-color: var(--bg-light);
}

input[type="radio"],
input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

input[type="text"],
textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin-bottom: 0.5rem;
}

input[type="text"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

small {
    color: var(--text-gray);
    font-size: 0.85rem;
}

/* Toggle Switch */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
}

.toggle-container input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background-color: var(--border-color);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s;
    margin: 0;
}

.toggle-container input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-container input[type="checkbox"]:checked {
    background-color: var(--primary-color);
}

.toggle-container input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-dark);
    font-weight: 500;
}

/* Info Icon and Tooltip */
.info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    font-size: 1.1rem;
    margin-left: 0.25rem;
    user-select: none;
    outline: none;
    transition: transform 0.2s;
}

.info-icon:hover,
.info-icon:focus {
    transform: scale(1.1);
}

.info-icon .tooltip {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--text-dark);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: normal;
    white-space: normal;
    width: 280px;
    max-width: 90vw;
    text-align: left;
    z-index: 1000;
    transition: opacity 0.3s, visibility 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    line-height: 1.4;
}

.info-icon .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--text-dark) transparent transparent transparent;
}

/* Show tooltip on hover for desktop */
.info-icon:hover .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Show tooltip on focus for keyboard navigation */
.info-icon:focus .tooltip {
    visibility: visible;
    opacity: 1;
}

/* Mobile: Show tooltip on click/touch */
@media (hover: none) and (pointer: coarse) {
    .info-icon:active .tooltip {
        visibility: visible;
        opacity: 1;
    }
}

/* Advanced Options */
.advanced-options {
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.4s ease;
    background-color: #FFECC0;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.advanced-options.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding: 0;
}

/* Custom Post Type Section (Advanced) */
.custom-post-type-section {
    overflow: hidden;
    max-height: 1000px;
    opacity: 1;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.4s ease;
    background-color: #FFECC0;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.custom-post-type-section.hidden {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding: 0;
}

/* Custom Prompt Form */
.custom-prompt-form {
    margin-top: 0.75rem;
}

.custom-prompt-input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.custom-prompt-input-row input {
    flex: 1;
    min-width: 200px;
}

.custom-prompt-input-row button {
    flex-shrink: 0;
}

.custom-prompt-textarea-row {
    margin-bottom: 1rem;
}

.custom-prompt-textarea-row textarea {
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

.helper-text {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-top: 0.5rem;
}

/* Custom Prompts List */
.custom-prompts-list {
    margin-top: 1rem;
}

.custom-prompt-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.custom-prompt-item-label {
    font-weight: 600;
    color: var(--text-dark);
}

.custom-prompt-item-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.75rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.delete-custom-prompt-btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    background-color: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.delete-custom-prompt-btn:hover {
    background-color: #b91c1c;
}

/* Buttons */
button {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
    box-shadow: var(--shadow-sm);
}

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

.secondary-btn {
    background-color: var(--bg-light);
    color: var(--text-dark);
    border: 1px solid var(--border-color);
}

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

/* Preview Container */
.preview-container {
    min-height: 200px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    position: relative;
    background-color: var(--bg-light);
}

.preview-content {
    color: var(--text-gray);
    line-height: 1.8;
}

/* Code Output */
.instructions {
    color: var(--text-gray);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.code-container {
    background-color: #1e293b;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    max-height: 10rem;
}

.code-container pre {
    margin: 0;
}

.code-container code {
    color: #e2e8f0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    display: block;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Feedback */
.feedback {
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    font-weight: 600;
    margin-top: 1rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.feedback.show {
    opacity: 1;
}

.feedback.success {
    background-color: #d1fae5;
    color: #065f46;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .config-section {
        grid-column: 1;
        grid-row: auto;
    }

    .output-section {
        grid-column: 1;
        grid-row: auto;
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    .preview-section {
        grid-column: 1;
        grid-row: auto;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    header p {
        font-size: 1rem;
    }

    main {
        padding: 1rem;
    }

    section {
        padding: 1.5rem;
    }

    section h2 {
        font-size: 1.25rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .toggle-label {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 2rem 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    section {
        padding: 1rem;
    }

    button {
        padding: 0.75rem 1rem;
    }
}

/* Changelog Section */
.changelog-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem 2rem;
    margin-bottom: 2rem;
}

.changelog-container {
    /* Card styling removed for cleaner look */
}

.changelog-container h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.changelog-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.changelog-toggle:hover {
    color: var(--primary-color);
}

.changelog-arrow {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.changelog-toggle.expanded .changelog-arrow {
    transform: rotate(-180deg);
}

.changelog-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease;
}

.changelog-content.expanded {
    max-height: 1000px;
    opacity: 1;
    margin-top: 1rem;
}

.changelog-entry {
    padding: 1rem 0;
}

.changelog-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.changelog-version {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.changelog-date {
    color: var(--text-gray);
    font-size: 0.9rem;
}

.changelog-description {
    color: var(--text-dark);
    line-height: 1.6;
    font-size: 0.95rem;
}

.changelog-description strong {
    color: var(--text-dark);
    font-weight: 600;
}

/* Feature Sections */
.features-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.feature-block {
    display: flex;
    align-items: center;
    gap: 3rem;
    margin-bottom: 4rem;
    /* Card styling removed for cleaner look */
}

.feature-block.reverse {
    flex-direction: row-reverse;
}

.feature-image {
    flex: 1;
    min-width: 0;
}

.feature-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.feature-content {
    flex: 1;
    min-width: 0;
}

.feature-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.feature-content p {
    font-size: 1rem;
    color: var(--text-gray);
    line-height: 1.7;
}

/* Feature Sections Responsive */
@media (max-width: 768px) {
    .feature-block,
    .feature-block.reverse {
        flex-direction: column;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .features-section {
        padding: 2rem 1rem;
    }

    .feature-content h3 {
        font-size: 1.25rem;
    }
}
