/* Core Layout */
.builder-container {
    display: flex;
    min-height: 100vh;
    background: #f8fafc;
    font-family: 'Inter', 'Plus Jakarta Sans', Arial, sans-serif;
}

/* Sidebar Styling */
.builder-sidebar {
    width: 430px;
    background: white;
    box-shadow: 2px 0 24px rgba(0,0,0,0.06);
    padding: 0;
    overflow-y: auto;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 10;
    padding-top: 90px;
}

/* Sidebar header and section titles */
.builder-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 2rem 1rem;
    text-align: center;
    border-bottom: 1px solid #f1f5f9;
}

.builder-header h2 {
    margin-bottom: .25rem;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.template-selected {
    background: rgba(255,255,255,0.16);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: .95rem;
    margin-top: 1rem;
    display: inline-block;
}

.form-section {
    padding: 2rem 1.25rem;
    border-bottom: 1px solid #f3f4f6;
}

/* Input groups and labels */
.form-group {
    margin-bottom: 1.7rem;
}

.form-section h3 {
    color: #2d3748;
    margin-bottom: 1.4rem;
    font-size: 1.05rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Group multiple fields */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
    font-size: .95rem;
}

.form-group label i {
    color: #667eea;
    width: 16px;
    text-align: center;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 13px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 7px;
    font-size: 1rem;
    font-family: inherit;
    transition: border 0.2s, background 0.2s;
    background: #fafbfc;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 2px rgba(102,126,234,0.10);
}

.form-group textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.45;
}

.form-group small {
    display: block;
    margin-top: 0.5em;
    color: #6b7280;
    font-size: .83rem;
}

/* Generate Button */
.generate-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 20px 0;
    border-radius: 14px;
    font-size: 1.13rem;
    font-weight: 700;
    cursor: pointer;
    margin: 2rem 0;
    box-shadow: 0 8px 24px rgba(102,126,234,0.13);
    transition: background 0.3s, transform 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(102,126,234,0.13);
}

.generate-btn small {
    font-size: .92em;
    font-weight: 400;
    opacity: 0.85;
}

.generate-btn:disabled {
    opacity: .68;
    cursor: not-allowed;
}

/* Right Preview Panel */
.builder-preview {
    flex: 1;
    margin-left: 430px;
    padding: 2.2rem 1.5rem;
    background: #f8fafc;
    min-height: 100vh;
}

/* Preview Panel Header */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: #fff;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.09);
}

.preview-header h3 {
    color: #2d3748;
    margin: 0;
    font-size: 1.22em;
    font-weight: 700;
}

.preview-controls {
    display: flex;
    gap: 0.55rem;
}

.preview-btn {
    width: 42px;
    height: 42px;
    border: 2px solid #e2e8f0;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    color: #718096;
    transition: all 0.18s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-btn.active,
.preview-btn:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.preview-container {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 36px rgba(0,0,0,0.08);
    min-height: 630px;
}

.preview-frame {
    width: 100%;
    min-height: 630px;
    border: none;
    background: #fff;
    transition: all 0.25s;
    overflow: auto;
}

.preview-frame.desktop { width: 100%; }
.preview-frame.tablet { width: 840px; margin: 0 auto; }
.preview-frame.mobile { width: 375px; margin: 0 auto; }

/* Preview placeholder */
.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 630px;
    color: #718096;
    text-align: center;
    font-size: 1.2rem;
    background: #ffffff;
    border-radius: 12px;
}

.placeholder-icon {
    width: 86px;
    height: 86px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.7rem;
    color: #fff;
    margin-bottom: 2.2rem;
}

.placeholder-icon i {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08);}
}

/* Ad Banner Area */
.ad-container.ad-builder-side {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    width: 340px;
    max-width: 90vw;
    height: 250px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 13px;
    z-index: 5;
    box-shadow: 0 7px 14px rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Interstitial Ad Modal */
.interstitial-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.90);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}

.ad-content {
    background: #fff;
    padding: 2.7rem 3rem;
    border-radius: 18px;
    text-align: center;
    max-width: 95vw;
    max-height: 95vh;
    box-shadow: 0 26px 72px rgba(0,0,0,0.16);
}

.ad-close-timer {
    font-size: 1.26rem;
    margin-bottom: 2rem;
    color: #2d3748;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
}

.ad-close-timer i {
    color: #764ba2;
    animation: spin 1.5s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0);}
    100% { transform: rotate(360deg);}
}

.ad-subtitle {
    margin-top: 1rem;
    color: #718096;
    font-size: 1.1rem;
}

.interstitial-ad-space {
    min-width: 320px;
    min-height: 170px;
    background: #f8fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-weight: 500;
    margin: 0 auto;
}

/* Success Message */
.success-message {
    position: fixed;
    top: 26px;
    right: 26px;
    background: #10b981;
    color: #fff;
    padding: 1.05rem 1.6rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16,185,129,0.19);
    z-index: 10001;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 600;
    animation: slideInRight 0.5s;
}

@keyframes slideInRight {
    from { transform: translateX(110%); opacity: 0;}
    to { transform: translateX(0); opacity: 1;}
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ad-container.ad-builder-side { display: none;}
}

@media (max-width: 900px) {
    .sidebar, .builder-sidebar { width: 100%; position: static; height: auto;}
    .builder-preview { margin-left: 0; padding: 1.5rem .5rem;}
    .ad-container.ad-builder-side { display: none;}
}

@media (max-width: 768px) {
    .builder-container { flex-direction: column;}
    .builder-sidebar { position: static; width: 100%; height: auto; box-shadow: none; padding-top: 0;}
    .form-row { grid-template-columns: 1fr;}
    .builder-preview { margin-left: 0;}
    .preview-header, .form-section { padding: 1.3rem;}
    .preview-controls { display: none;}
    .preview-frame { width: 100% !important;}
    .template-selected { margin-top: 0.6rem;}
}

@media (max-width: 480px) {
    .builder-header { padding: 1rem; }
    .form-section { padding: 1rem;}
    .preview-header { padding: .8rem;}
}


