/**
 * Builder Modal Styles - Modern Split Layout
 * Sol: Canlı Önizleme | Sağ: Form
 */

/* ========================================
   BASE MODAL
   ======================================== */
.builder-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #fff;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.builder-modal[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

/* ========================================
   LOADING SCREEN
   ======================================== */
.builder-loading {
    position: absolute;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
}

.builder-loading.active {
    display: flex;
}

.builder-loading-content {
    text-align: center;
    color: #fff;
}

.builder-loading-spinner {
    width: 56px;
    height: 56px;
    margin: 0 auto 24px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.builder-loading-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.builder-loading-content p {
    opacity: 0.8;
    margin-bottom: 24px;
}

.builder-loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.builder-loading-bar-fill {
    height: 100%;
    width: 0;
    background: #fff;
    border-radius: 2px;
    transition: width 0.3s;
}

/* ========================================
   MAIN LAYOUT
   ======================================== */
.builder-layout {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

/* ========================================
   LEFT: PREVIEW PANEL
   ======================================== */
.builder-preview {
    flex: 1;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

@media (min-width: 1024px) {
    .builder-preview {
        display: flex;
    }
}

.builder-preview-inner {
    width: 100%;
    max-width: 600px;
}

/* Browser Frame */
.builder-preview-browser {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.15);
    overflow: hidden;
    transition: max-width 0.3s ease;
}

.browser-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.browser-dots {
    display: flex;
    gap: 6px;
}

.browser-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e2e8f0;
}

.browser-dots span:first-child { background: #fca5a5; }
.browser-dots span:nth-child(2) { background: #fcd34d; }
.browser-dots span:last-child { background: #6ee7b7; }

.browser-url {
    flex: 1;
    padding: 6px 12px;
    background: #fff;
    border-radius: 6px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

.browser-content {
    min-height: 400px;
    position: relative;
}

/* Empty State */
.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
}

.preview-empty svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.preview-empty h3 {
    font-size: 18px;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
}

.preview-empty p {
    font-size: 14px;
}

/* Live Preview Site */
.preview-site {
    display: none;
    font-size: 11px;
}

.preview-site.active {
    display: block;
}

/* Preview Nav */
.pv-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
}

.pv-logo {
    font-weight: 700;
    font-size: 14px;
    color: var(--pv-primary, #2563EB);
}

.pv-menu {
    display: flex;
    gap: 16px;
    color: #64748b;
    font-size: 10px;
}

/* Preview Hero */
.pv-hero {
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--pv-primary, #2563EB) 0%, var(--pv-secondary, #3B82F6) 100%);
    text-align: center;
    color: #fff;
}

.pv-hero h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.pv-hero p {
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.pv-btn {
    display: inline-block;
    padding: 8px 20px;
    background: #fff;
    color: var(--pv-primary, #2563EB);
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
}

/* Preview Features */
.pv-features {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 24px 20px;
    background: #f8fafc;
}

.pv-feature {
    text-align: center;
}

.pv-feature-icon {
    width: 32px;
    height: 32px;
    margin: 0 auto 8px;
    background: var(--pv-primary, #2563EB);
    opacity: 0.2;
    border-radius: 8px;
}

.pv-feature span {
    font-size: 10px;
    color: #475569;
}

/* Preview Contact */
.pv-contact {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px;
    background: #1e293b;
    color: #fff;
    font-size: 10px;
}

/* Device Toggle */
.preview-devices {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.device-btn {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.device-btn:hover,
.device-btn.active {
    background: #2563EB;
    border-color: #2563EB;
    color: #fff;
}

/* Mobile Preview Mode */
.builder-preview-browser.mobile-view {
    max-width: 320px;
    margin: 0 auto;
}

/* ========================================
   RIGHT: FORM PANEL
   ======================================== */
.builder-panel {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .builder-panel {
        width: 480px;
        max-width: 480px;
        border-left: 1px solid #e5e7eb;
    }
}

/* Panel Header */
.builder-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
}

.btn-back,
.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    border-radius: 10px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover,
.btn-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.btn-back.hidden {
    visibility: hidden;
}

/* Progress Dots */
.builder-progress-dots {
    display: flex;
    gap: 8px;
}

.builder-progress-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: all 0.3s;
}

.builder-progress-dots .dot.active {
    width: 24px;
    border-radius: 4px;
    background: linear-gradient(135deg, #2563EB, #7C3AED);
}

.builder-progress-dots .dot.completed {
    background: #10B981;
}

/* ========================================
   FORM & STEPS
   ======================================== */
.builder-form {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.builder-step {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 24px 20px;
    animation: fadeIn 0.3s ease;
}

.builder-step.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Step Header */
.step-header {
    margin-bottom: 24px;
}

.step-badge {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #eff6ff, #f0f0ff);
    color: #2563EB;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
    margin-bottom: 12px;
}

.step-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.step-header p {
    color: #64748b;
    font-size: 14px;
}

/* ========================================
   STEP 1: SECTOR GRID
   ======================================== */
.sector-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

@media (min-width: 480px) {
    .sector-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .sector-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.sector-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sector-item:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.sector-item.active {
    border-color: var(--color, #2563EB);
    background: linear-gradient(to bottom, rgba(37, 99, 235, 0.05), rgba(124, 58, 237, 0.05));
}

.sector-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.1));
    border-radius: 12px;
    color: var(--color, #2563EB);
    transition: all 0.2s;
}

.sector-item.active .sector-icon {
    background: linear-gradient(135deg, var(--color, #2563EB), var(--color, #2563EB));
    color: #fff;
}

.sector-icon svg {
    width: 24px;
    height: 24px;
}

.sector-item span {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
    text-align: center;
}

.sector-item.active span {
    color: #1e293b;
    font-weight: 600;
}

/* ========================================
   STEP 3: COLOR GRID
   ======================================== */
.color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.color-item:hover {
    border-color: #cbd5e1;
}

.color-item.active {
    border-color: #2563EB;
    background: #f0f7ff;
}

.color-preview {
    display: flex;
    gap: 4px;
}

.color-preview span {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.color-name {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

/* ========================================
   STEP 5: PACKAGE LIST
   ======================================== */
.package-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.package-option {
    position: relative;
    display: block;
    padding: 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.package-option:hover {
    border-color: #cbd5e1;
}

.package-option input {
    position: absolute;
    opacity: 0;
}

.package-option.active {
    border-color: #2563EB;
    background: #f0f7ff;
}

.package-option.popular {
    border-color: #7C3AED;
}

.popular-tag {
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #7C3AED, #9333EA);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
}

.package-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.package-info strong {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.package-info span {
    font-size: 13px;
    color: #64748b;
}

.package-price {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

.package-price small {
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
}

/* ========================================
   FORM FIELDS
   ======================================== */
.form-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-group label .req {
    color: #ef4444;
}

.form-group input,
.form-group textarea {
    padding: 12px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2563EB;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #9ca3af;
}

/* ========================================
   BUTTONS
   ======================================== */
.step-actions {
    margin-top: auto;
    padding-top: 20px;
}

.btn-next,
.btn-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-next:hover,
.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.2);
}

.btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.form-note {
    text-align: center;
    font-size: 13px;
    color: #64748b;
    margin-top: 12px;
}

/* ========================================
   MOBILE STYLES
   ======================================== */
@media (max-width: 1023px) {
    .builder-layout {
        flex-direction: column;
    }
    
    .builder-preview {
        display: none;
    }
    
    .builder-panel {
        width: 100%;
        max-width: 100%;
    }
    
    .step-header h2 {
        font-size: 22px;
    }
    
    .sector-grid {
        max-height: calc(100vh - 280px);
    }
}

/* Small mobile */
@media (max-width: 375px) {
    .sector-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .sector-item {
        padding: 12px 8px;
    }
    
    .sector-icon {
        width: 40px;
        height: 40px;
    }
    
    .color-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .builder-step {
        padding: 20px 16px;
    }
}
