/*
 Theme Name: AIBuilderTheme
 Description: AI WordPress site builder – 20/80vh layout
 Version: 1.1
*/
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    font-family: Arial, Helvetica, sans-serif;
    background: #f9fafb;
    overflow: hidden;
}

/* === MAIN LAYOUT === */
#builder-wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

#header {
	display:none;
}

/* === PROMPT BAR – 20% OF SCREEN === */
#prompt-bar {
    height: 12vh;
    min-height: 140px;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    padding: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#prompt-bar h1 {
    font-size: 2rem;
    margin-bottom: .75rem;
    text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

#prompt-form {
    display: flex;
    gap: .75rem;
    align-items: flex-end;
    width: 100%;
}

#user-prompt {
    flex: 1;
    padding: .75rem 1rem;
    font-size: 1rem;
    border-radius: .5rem;
    border: 2px solid rgba(255,255,255,.3);
    background: rgba(255,255,255,.15);
    color: #fff;
    resize: none;
    height: 2.5rem;
}

#user-prompt::placeholder {
    color: rgba(255,255,255,.7);
}

#generate-btn {
    background: #fff;
    color: #6366f1;
    font-weight: bold;
    padding: .75rem 1.5rem;
    border: none;
    border-radius: .5rem;
    cursor: pointer;
    transition: transform .2s, background .2s;
}

#generate-btn:hover {
    background: #f3f4f6;
    transform: scale(1.05);
}

/* === SPLIT CONTAINER – 80% OF SCREEN === */
#split-container {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: 88vh;
}

/* === PREVIEW AREA – 80% of 80vh = 64% total === */
#preview-area {
    width: 80%;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-right: 3px solid #e5e7eb;
}

#preview-header {
    background: #f8fafc;
    padding: .75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: #374151;
    flex-shrink: 0;
}

#page-selector {
    padding: .4rem;
    border-radius: .4rem;
    border: 1px solid #d1d5db;
}

#regenerate-btn {
    background: #6366f1;
    color: #fff;
    border: none;
    padding: .4rem .8rem;
    border-radius: .4rem;
    cursor: pointer;
    font-size: .85rem;
}

#regenerate-btn:hover {
    background: #4f46e5;
}

#preview-iframe {
    flex: 1;
    width: 98%;
    border: none;
    margin: 1rem;
    border-radius: .75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    min-height: 0; /* Critical for flex */
}

/* === CODE EDITOR – 20% of 80vh = 16% total === */
#code-area {
    width: 20%;
    background: #1f2937;
    color: #34d399;
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    font-size: .85rem;
    display: flex;
    flex-direction: column;
}

#code-header {
    background: #111827;
    color: #e5e7eb;
    padding: .75rem;
    text-align: center;
    font-weight: bold;
    border-bottom: 1px solid #374151;
    flex-shrink: 0;
}

#code-editor {
    flex: 1;
    background: transparent;
    color: #34d399;
    padding: 1rem;
    border: none;
    outline: none;
    resize: none;
    line-height: 1.5;
    min-height: 0; /* Critical for flex */
}

/* === PUBLISH BAR === */
#publish-bar {
    padding: .75rem 1rem;
    background: #f3f4f6;
    border-top: tiles 1px solid #e5e7eb;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

/* === WIZARD STEPS (LAYOUT & PAGES) === */
.step {
    display: none;
    padding: 0px;
    height: 100vh;
    overflow-y: auto;
}

.step.active {
    display: block;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    text-align: center;
}

.subtitle {
    color: #6b7280;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* === LAYOUT GRID === */
.layouts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.layout-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
}

.layout-card:hover {
    border-color: #6366f1;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,.1);
}

.layout-card.selected {
    border-color: #6366f1 !important;
    background: #f0f4ff !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

/* === FORM STYLES === */
#site-name {
    width: 100%;
    padding: .75rem;
    border: 1px solid #d1d5db;
    border-radius: .5rem;
    font-size: 1rem;
    margin-bottom: 1rem;
}

#pages-list {
    margin-bottom: 1rem;
}

.page-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .5rem;
}

.page-row input {
    flex: 1;
}

.remove-page {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 0 .75rem;
    border-radius: .4rem;
    cursor: pointer;
}

/* === BUTTONS === */
.btn-primary {
    background: #6366f1;
    color: #fff;
    padding: .75rem 1.5rem;
    border: none;
    border-radius: .5rem;
    font-weight: bold;
    cursor: pointer;
    margin-top: 1rem;
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
    padding: .5rem 1rem;
    border: none;
    border-radius: .5rem;
    font-size: .9rem;
}

.btn-ghost {
    background: none;
    color: #6b7280;
    border: 1px solid #d1d5db;
    padding: .5rem 1rem;
    border-radius: .5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* === LOADER === */
#loader {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

.loader-box {
    background: #fff;
    padding: 2rem 3rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

.loader-box svg {
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0); }
    to { transform: rotate(360deg); }
}

/* === PREVIEW MENU === */
#preview-iframe body nav a {
    color: white;
    margin: 0 1rem;
    text-decoration: none;
    font-weight: 500;
}

#preview-iframe body nav a:hover {
    text-decoration: underline;
}

/* === GRADIENT STEP CONTAINER === */
.step-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* === STEP CONTENT (CENTERED CARD) === */
.step-content {
    background: white;
    padding: 3rem;
    border-radius: 1.5rem;
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
    max-width: 900px;
    width: 100%;
    text-align: center;
}

.step-content h1 {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: #1f2937;
}

/* === LAYOUT GRID === */
.layouts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.layout-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.layout-card:hover {
    transform: translateY(-8px);
    border-color: #6366f1;
    box-shadow: 0 12px 24px rgba(99,102,241,0.15);
}

.layout-card.selected {
    border-color: #6366f1 !important;
    background: #f0f4ff !important;
    box-shadow: 0 0 0 4px rgba(99,102,241,0.2);
}

.layout-card .icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.layout-card h3 {
    margin: 0.5rem 0;
    font-size: 1.3rem;
    color: #1f2937;
}

.layout-card p {
    color: #6b7280;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* === FORM STYLES (STEP 2) === */
#logo-upload-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 1rem;
    border: 2px dashed #cbd5e1;
}

#logo-preview img {
    max-height: 80px;
    border-radius: .5rem;
    margin-top: .5rem;
    display: none;
}

#site-name {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid #e2e8f0;
    border-radius: .75rem;
    margin-bottom: 1.5rem;
}

.page-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
}

.page-row input {
    flex: 1;
    padding: .75rem;
    border: 2px solid #e2e8f0;
    border-radius: .5rem;
}

.remove-page {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0 .75rem;
    border-radius: .5rem;
    cursor: pointer;
}

.form-actions {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}