/**
 * Tabelanı Tasarla - Kutay Theme
 * Temayla uyumlu, profesyonel görünüm + canlı önizleme
 */

/* --- Sayfa container (tema .container ile uyumlu) --- */
.tabelani-tasarla-page .tabelani-tasarla-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 40px 56px;
}

@media (max-width: 768px) {
    .tabelani-tasarla-page .tabelani-tasarla-container {
        padding: 24px 16px 40px;
    }
}

/* --- Başlık (tema .section-title ile aynı stil) --- */
.tabela-configurator-header {
    text-align: center;
    margin-bottom: 40px;
}

.tabela-configurator-title.section-title {
    font-size: 42px;
    font-weight: 700;
    color: #111;
    margin: 0 0 12px;
    line-height: 1.2;
}

.tabela-configurator-subtitle {
    color: #555;
    font-size: 1.125rem;
    margin: 0;
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 768px) {
    .tabela-configurator-title.section-title {
        font-size: 28px;
    }
    .tabela-configurator-subtitle {
        font-size: 1rem;
    }
}

/* --- İki sütun: form (sol) + önizleme (sağ) – tablet/mobilde tek sütun --- */
.tabela-configurator-wrap {
    display: grid;
    grid-template-columns: 1fr 480px;
    gap: 32px;
    align-items: start;
}

@media (max-width: 1023px) {
    .tabela-configurator-wrap {
        grid-template-columns: 1fr;
    }
}

.tabela-configurator-form {
    min-width: 0;
}

/* --- Bölüm kartları (tema feature-card / kutu hissi) --- */
.tabela-configurator {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.tabela-section {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s ease;
}

.tabela-section:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.tabela-section-title {
    margin: 0;
    padding: 16px 24px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color, #f57c00) 0%, #ff9800 100%);
    letter-spacing: 0.02em;
}

.tabela-section-inner {
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    align-items: end;
}

.tabela-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tabela-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #333;
}

.tabela-input,
.tabela-select {
    width: 100%;
    padding: 12px 14px;
    font-size: 0.9375rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: #fff;
    color: #111;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.tabela-input:focus,
.tabela-select:focus {
    outline: none;
    border-color: var(--primary-color, #f57c00);
    box-shadow: 0 0 0 3px rgba(245, 124, 0, 0.12);
}

.tabela-input::placeholder {
    color: #999;
}

.tabela-zemin-boyut.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* --- Fiyat bölümü --- */
.tabela-section-fiyat .tabela-section-inner {
    grid-template-columns: 1fr;
}

.tabela-ozet {
    max-width: 100%;
}

.tabela-ozet-baslik {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 12px;
    color: #111;
}

.tabela-ozet-list {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
}

.tabela-ozet-list li {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
    font-size: 0.9375rem;
    color: #444;
}

.tabela-ozet-list li:last-child {
    border-bottom: none;
}

.tabela-toplam-wrap {
    padding: 20px 0;
    margin: 16px 0;
    border-top: 2px solid var(--primary-color, #f57c00);
}

.tabela-toplam-label {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.tabela-toplam-fiyat {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color, #f57c00);
    margin-top: 4px;
}

.tabela-not {
    font-size: 0.8125rem;
    color: #888;
    margin: 0 0 20px;
}

/* --- Buton (tema .signage-btn / .add_to_cart_button ile uyumlu) --- */
.tabela-actions {
    margin-top: 8px;
}

.tabela-btn {
    display: inline-block;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tabela-btn-primary {
    background: linear-gradient(135deg, var(--primary-color, #f57c00) 0%, #ff9800 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245, 124, 0, 0.3);
}

.tabela-btn-primary:hover {
    background: linear-gradient(135deg, #e65100 0%, #f57c00 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(245, 124, 0, 0.35);
}

.tabela-btn:active {
    transform: translateY(0);
}

/* ========== CANLI ÖNİZLEME ========== */
.tabela-preview-column {
    position: sticky;
    top: 100px;
}

/* Tablet ve mobil: önizleme üstte, sticky yok; mobilde kart padding korunur */
@media (max-width: 1023px) {
    .tabela-preview-column {
        position: static;
        order: -1;
    }
}

@media (max-width: 768px) {
    .tabela-preview-card {
        padding: 20px 16px;
    }
    .tabela-preview-box {
        padding: 10px;
        min-height: 200px;
    }
}

.tabela-preview-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 20px 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tabela-preview-heading {
    margin: 0 0 16px;
    font-size: 1.125rem;
    font-weight: 700;
    color: #111;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--primary-color, #f57c00);
}

.tabela-preview-box {
    background: #f5f5f5;
    border-radius: 10px;
    padding: 12px;
    min-height: 220px;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    width: 100%;
    box-sizing: border-box;
}

/* Siyah önizleme alanı container'ın tamamına yayılır; gereksiz boşluk yok */
.tabela-preview-sign {
    width: 100%;
    max-width: none;
    min-height: 160px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    border-radius: 8px;
    position: relative;
    transition: background 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

/* Tabela yönü: yatay (varsayılan) / dikey – genişlik container’a göre */
.tabela-preview-sign.yon-yatay {
    flex-direction: row;
    min-height: 160px;
}

.tabela-preview-sign.yon-dikey {
    flex-direction: column;
    min-height: 280px;
}

.tabela-preview-sign.yon-dikey .tabela-preview-text {
    writing-mode: horizontal-tb;
}

/* Zemin stilleri (önizleme arka planı) */
.tabela-preview-sign.zemin-yok {
    background: linear-gradient(145deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #fff;
}

.tabela-preview-sign.zemin-kompozit {
    background: linear-gradient(145deg, #6b7280 0%, #4b5563 100%);
    color: #fff;
}

.tabela-preview-sign.zemin-pleksi {
    background: linear-gradient(145deg, #e5e7eb 0%, #d1d5db 100%);
    color: #111;
}

.tabela-preview-sign.zemin-ahsap {
    background: linear-gradient(145deg, #92400e 0%, #78350f 100%);
    color: #fef3c7;
}

.tabela-preview-sign.zemin-aluminyum {
    background: linear-gradient(145deg, #9ca3af 0%, #6b7280 100%);
    color: #fff;
}

/* Işıklı efekt (harf etrafında glow) */
.tabela-preview-sign.isikli .tabela-preview-text {
    text-shadow: 0 0 12px rgba(255, 200, 100, 0.9),
                 0 0 24px rgba(255, 150, 50, 0.6),
                 0 0 36px rgba(255, 124, 0, 0.4);
}

.tabela-preview-sign.isikli.zemin-pleksi .tabela-preview-text,
.tabela-preview-sign.isikli.zemin-ahsap .tabela-preview-text {
    text-shadow: 0 0 14px rgba(255, 180, 80, 0.9),
                 0 0 28px rgba(255, 124, 0, 0.5);
}

.tabela-preview-text {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1.2;
    font-family: Arial, sans-serif;
    transition: font-family 0.2s, text-shadow 0.2s, writing-mode 0.2s;
    word-break: break-word;
    text-align: center;
}

/* Yazı yönü: yatay = normal; dikey = harf harf alt alta (JS ile span'lara bölünür) */
.tabela-preview-text.yazi-yatay {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
}

/* Dikey: kelime kelime yan yana, her kelimenin harfleri alt alta */
.tabela-preview-text.yazi-dikey {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.4em;
    writing-mode: horizontal-tb;
}

.tabela-preview-text.yazi-dikey .tabela-dikey-kelime {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.1;
}

.tabela-preview-text.yazi-dikey .tabela-dikey-kelime span {
    display: block;
}

/* Logo konumu */
.tabela-preview-sign.logo-sol {
    flex-direction: row;
    justify-content: flex-start;
}
.tabela-preview-sign.logo-orta .tabela-preview-logo-placeholder {
    order: -1;
    margin-bottom: 8px;
}
.tabela-preview-sign.logo-orta {
    flex-direction: column;
}
.tabela-preview-sign.logo-sag {
    flex-direction: row;
    justify-content: flex-end;
}

/* Yön dikey iken tabela her zaman dikey (logo konumu sadece iç hizalamayı etkiler) */
.tabela-preview-sign.yon-dikey,
.tabela-preview-sign.yon-dikey.logo-sol,
.tabela-preview-sign.yon-dikey.logo-sag {
    flex-direction: column;
    justify-content: center;
}

.tabela-preview-logo-placeholder {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0.8;
}

.tabela-preview-sign.zemin-pleksi .tabela-preview-logo-placeholder {
    border-color: rgba(0,0,0,0.2);
}

.tabela-preview-logo-placeholder.hidden {
    display: none !important;
}

.tabela-preview-hint {
    margin: 12px 0 0;
    font-size: 0.8125rem;
    color: #888;
    text-align: center;
}

/* --- Modal (tema ile uyumlu) --- */
.tabela-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.tabela-modal.active {
    opacity: 1;
    visibility: visible;
}

.tabela-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.tabela-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.tabela-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #666;
    transition: background 0.2s, color 0.2s;
}

.tabela-modal-close:hover {
    background: #e0e0e0;
    color: #111;
}

.tabela-modal-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 700;
    color: #111;
}

.tabela-modal-desc {
    margin: 0 0 16px;
    font-size: 0.9375rem;
    color: #666;
}

.tabela-modal-ozet {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: #444;
    white-space: pre-line;
}

.tabela-teklif-form .tabela-form-row {
    margin-bottom: 14px;
}

.tabela-teklif-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.tabela-teklif-form .required {
    color: #c00;
}

.tabela-teklif-form input[type="text"],
.tabela-teklif-form input[type="tel"],
.tabela-teklif-form input[type="email"],
.tabela-teklif-form textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 0.9375rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box;
}

.tabela-teklif-form textarea {
    resize: vertical;
    min-height: 80px;
}

.tabela-form-submit {
    margin-top: 20px;
    margin-bottom: 0;
}

.tabela-form-submit .tabela-btn {
    width: 100%;
}

.tabela-form-success {
    padding: 20px;
    background: #e8f5e9;
    border-radius: 8px;
    color: #2e7d32;
    font-weight: 500;
}

.tabela-form-success p {
    margin: 0;
}

.tabela-form-submit button.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .tabela-section-inner {
        grid-template-columns: 1fr;
        padding: 20px;
    }
    .tabela-configurator-title.section-title {
        font-size: 24px;
    }
    .tabela-toplam-fiyat {
        font-size: 1.5rem;
    }
    .tabela-preview-text {
        font-size: 1.35rem;
    }
}

/* ============================================
   MASAÜSTÜ (DESKTOP) GÖRÜNÜM – SADECE min-width: 1024px
   Tablet ve mobilde mevcut tasarım aynen korunur.
   ============================================ */
@media (min-width: 1024px) {
    /* Sayfa düzeni: önce önizleme (en üstte), altında 4 blok yan yana; görsel ayrışma */
    .tabela-configurator-wrap {
        display: flex;
        flex-direction: column;
        gap: 48px;
        align-items: stretch;
    }

    /* Canlı önizleme – en üste taşındı, odak noktası; genişlik/yükseklik değiştirilmez */
    .tabela-preview-column {
        order: -1;
        width: 100%;
        max-width: 100%;
        position: static;
    }

    .tabela-configurator-form {
        order: 0;
        width: 100%;
    }

    /* Önizleme kartı: tam genişlik, yan boşluklar azaltıldı */
    .tabela-preview-card {
        padding: 24px 20px 28px;
        border-radius: 16px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
        border: 1px solid #e5e5e5;
        max-width: 100%;
        width: 100%;
    }

    .tabela-preview-heading {
        font-size: 1.25rem;
        margin-bottom: 16px;
        padding-bottom: 14px;
    }

    /* Önizleme kutusu: siyah alan tam yayılsın diye padding az, min-height belirgin */
    .tabela-preview-box {
        min-height: 260px;
        padding: 12px;
        border-radius: 12px;
        background: linear-gradient(180deg, #f8f8f8 0%, #f0f0f0 100%);
        width: 100%;
        box-sizing: border-box;
    }

    .tabela-preview-sign {
        padding: 24px;
    }

    .tabela-preview-sign.yon-yatay {
        min-height: 180px;
    }

    .tabela-preview-sign.yon-dikey {
        min-height: 300px;
    }

    .tabela-preview-hint {
        margin-top: 14px;
        font-size: 0.875rem;
    }

    /* Form alanı: 4 eşit blok yan yana, ferah gap, kart yapısı */
    .tabela-configurator {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 28px;
    }

    .tabela-section {
        border-radius: 14px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
        border: 1px solid #e8e8e8;
        transition: box-shadow 0.2s ease, transform 0.2s ease;
    }

    .tabela-section:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
    }

    .tabela-section-title {
        padding: 18px 20px;
        font-size: 1rem;
    }

    .tabela-section-inner {
        padding: 20px;
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .tabela-section-fiyat .tabela-section-inner {
        grid-template-columns: 1fr;
    }
}
