/**
 * Deniz Matbaa - 3D Canlı Ürün Simülatörü & Doku Stilleri
 * (Kartvizit, El İlanı / Broşür, Sticker / Etiket)
 * CSS3D + Canvas Texture Engine
 */

/* Görünüm Modu Sekmeleri (3D vs Galeri) */
.view-mode-tabs {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 0.85rem;
    gap: 4px;
    border: 1px solid #e2e8f0;
}

.view-mode-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 14px;
    border-radius: 9px;
    border: none;
    background: transparent;
    font-weight: 700;
    font-size: 0.82rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
}

.view-mode-tab:hover {
    color: #0f172a;
}

.view-mode-tab.active {
    background: #ffffff;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

/* 3D Sahne Kapsayıcısı */
.stage-3d-wrapper {
    background: #ffffff;
    border-radius: 20px;
    padding: 16px;
    position: relative;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
    overflow: hidden;
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.stage-badge {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.2px;
}

.stage-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.stage-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 0.73rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: inherit;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.stage-btn:hover {
    background: #f8fafc;
    color: #2563eb;
    border-color: #93c5fd;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.1);
}

.stage-btn.active {
    background: #eff6ff;
    color: #1d4ed8;
    border-color: #3b82f6;
}

/* ========================================================
   1. KARTVİZİT 3D SAHNESİ
   ======================================================== */
.card-3d-stage {
    perspective: 1200px;
    width: 100%;
    height: 255px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    background: radial-gradient(circle at center, #f8fafc 0%, #ffffff 80%);
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
    position: relative;
}

.card-3d-stage:active {
    cursor: grabbing;
}

.card-3d-object {
    width: 320px;
    height: 196px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.08s ease-out;
}

@media (max-width: 480px) {
    .card-3d-object {
        width: 270px;
        height: 168px;
    }
    .card-3d-stage {
        height: 220px;
    }
}

.card-3d-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.20), 0 6px 14px -2px rgba(15, 23, 42, 0.10), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
    transition: border-radius 0.25s ease, box-shadow 0.25s ease;
}

.card-3d-face canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.card-3d-face.card-front {
    transform: translateZ(1px);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card-3d-face.card-back {
    transform: rotateY(180deg) translateZ(1px);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* 700gr Kalın Sıvama Modu */
.card-3d-object.thick-premium-mode .card-3d-face.card-front {
    transform: translateZ(2.5px) !important;
}
.card-3d-object.thick-premium-mode .card-3d-face.card-back {
    transform: rotateY(180deg) translateZ(2.5px) !important;
}
.card-3d-face.thick-premium {
    box-shadow: 
        0 1px 0 #1e293b,
        0 2.5px 0 #0f172a,
        0 4px 6px -1px rgba(0, 0, 0, 0.25),
        0 20px 35px -5px rgba(15, 23, 42, 0.22),
        inset 0 0 0 1.5px rgba(37, 99, 235, 0.3) !important;
}

/* Oval Köşe Seçimi */
.card-3d-face.oval-corners {
    border-radius: 18px !important;
}

/* ========================================================
   2. EL İLANI & BROŞÜR 3D SAHNESİ
   ======================================================== */
.flyer-3d-stage {
    perspective: 1400px;
    width: 100%;
    height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    background: radial-gradient(circle at center, #f8fafc 0%, #ffffff 85%);
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
    overflow: hidden;
    position: relative;
}

.flyer-3d-stage:active {
    cursor: grabbing;
}

/* 3D Kapsayıcı Nesne */
.flyer-3d-object {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.08s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Ortak Yüz Stilleri */
.flyer-3d-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 2.5px;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.2), 0 6px 14px -2px rgba(15, 23, 42, 0.1), inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.flyer-3d-face canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* 1. KATLAMASIZ (DÜZ) EL İLANI */
.flyer-flat-wrap {
    width: 220px;
    height: 312px;
    position: relative;
    transform-style: preserve-3d;
}

.flyer-flat-wrap .flyer-3d-face.flyer-front {
    transform: translateZ(1px);
}

.flyer-flat-wrap .flyer-3d-face.flyer-back {
    transform: rotateY(180deg) translateZ(1px);
}

/* 2. ORTADAN KATLAMA (1 KIRIM - 4 SAYFA / V-KATLAMA) */
.flyer-bifold-wrap {
    width: 300px;
    height: 285px;
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    justify-content: center;
}

.bifold-leaf {
    width: 150px;
    height: 285px;
    position: absolute;
    top: 0;
    transform-style: preserve-3d;
    transition: transform 0.4s ease;
}

.bifold-leaf.bifold-left {
    right: 50%;
    transform-origin: right center;
    transform: rotateY(28deg);
}

.bifold-leaf.bifold-right {
    left: 50%;
    transform-origin: left center;
    transform: rotateY(-28deg);
}

.bifold-leaf .flyer-3d-face.face-inside {
    transform: translateZ(1px);
}

.bifold-leaf .flyer-3d-face.face-outside {
    transform: rotateY(180deg) translateZ(1px);
}

/* Kırım / Katlama Kat İzi Çizgisi */
.bifold-spine-crease {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%) translateZ(2px);
    background: rgba(15, 23, 42, 0.25);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
    z-index: 10;
    pointer-events: none;
}

/* 3. 3'E KATLAMA / İKİ KIRIM (MEKTUP / C-KIRIM - 6 SAYFA) */
.flyer-trifold-wrap, .flyer-twofold-wrap {
    width: 320px;
    height: 285px;
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trifold-panel, .twofold-panel {
    width: 106px;
    height: 285px;
    position: absolute;
    top: 0;
    transform-style: preserve-3d;
    transition: transform 0.4s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.trifold-panel.panel-center, .twofold-panel.panel-center {
    left: 50%;
    transform: translateX(-50%) translateZ(0);
}

.trifold-panel.panel-left, .twofold-panel.panel-left {
    right: 50%;
    margin-right: 53px;
    transform-origin: right center;
    transform: rotateY(58deg);
}

.trifold-panel.panel-right, .twofold-panel.panel-right {
    left: 50%;
    margin-left: 53px;
    transform-origin: left center;
    transform: rotateY(-62deg);
}

.trifold-panel .flyer-3d-face.face-inside, .twofold-panel .flyer-3d-face.face-inside {
    transform: translateZ(1px);
}

.trifold-panel .flyer-3d-face.face-outside, .twofold-panel .flyer-3d-face.face-outside {
    transform: rotateY(180deg) translateZ(1px);
}

/* 4. AKORDİYON KATLAMA (Z-KATLAMA - 6 SAYFA) */
.flyer-zfold-wrap {
    width: 320px;
    height: 285px;
    position: relative;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zfold-panel {
    width: 106px;
    height: 285px;
    position: absolute;
    top: 0;
    transform-style: preserve-3d;
    transition: transform 0.4s ease;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.zfold-panel.panel-center {
    left: 50%;
    transform: translateX(-50%) translateZ(0);
}

.zfold-panel.panel-left {
    right: 50%;
    margin-right: 53px;
    transform-origin: right center;
    transform: rotateY(38deg);
}

.zfold-panel.panel-right {
    left: 50%;
    margin-left: 53px;
    transform-origin: left center;
    transform: rotateY(38deg);
}

.zfold-panel .flyer-3d-face.face-inside {
    transform: translateZ(1px);
}

.zfold-panel .flyer-3d-face.face-outside {
    transform: rotateY(180deg) translateZ(1px);
}

@media (max-width: 480px) {
    .flyer-3d-stage {
        height: 310px;
    }
    .flyer-flat-wrap {
        width: 180px;
        height: 255px;
    }
    .flyer-bifold-wrap {
        width: 250px;
        height: 235px;
    }
    .bifold-leaf {
        width: 125px;
        height: 235px;
    }
    .flyer-trifold-wrap, .flyer-twofold-wrap, .flyer-zfold-wrap {
        width: 280px;
        height: 225px;
    }
    .trifold-panel, .twofold-panel, .zfold-panel {
        width: 93px;
        height: 225px;
    }
}

/* ========================================================
   3. STICKER & ETİKET 3D SAHNESİ
   ======================================================== */
.sticker-3d-stage {
    perspective: 1200px;
    width: 100%;
    height: 255px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    touch-action: none;
    background: radial-gradient(circle at center, #f8fafc 0%, #ffffff 80%);
    border-radius: 14px;
    border: 1px dashed #cbd5e1;
    position: relative;
}

.sticker-3d-stage:active {
    cursor: grabbing;
}

.sticker-3d-object {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.08s ease-out;
}

.sticker-3d-face {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: border-radius 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.20), 0 4px 10px rgba(0,0,0,0.08);
}

.sticker-3d-face canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.sticker-3d-face.sticker-front {
    transform: translateZ(1px);
}

.sticker-3d-face.sticker-back {
    transform: rotateY(180deg) translateZ(1px);
    background: #fef08a; /* Sarı silikonlu taşıyıcı kağıt */
}

/* Kesim Şekilleri */
.sticker-3d-object.cut-kare .sticker-3d-face {
    border-radius: 10px;
}

.sticker-3d-object.cut-yuvarlak .sticker-3d-face {
    border-radius: 50% !important;
}

.sticker-3d-object.cut-giyotin .sticker-3d-face {
    border-radius: 2px;
}

.sticker-3d-object.cut-ozel .sticker-3d-face {
    border-radius: 28px;
    box-shadow: 0 0 0 2px #3b82f6, 0 16px 36px -6px rgba(15, 23, 42, 0.20);
}

/* Şeffaf Etiket Zemin Efekti */
.sticker-3d-object.mat-seffaf .sticker-3d-face.sticker-front {
    box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.15), inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* Parlak Selefon Şeffaf Işıltı Katmanı */
.sticker-sheen-overlay, .sheen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.65;
    mix-blend-mode: overlay;
    transition: opacity 0.3s;
}

/* Alt İpucu & Bilgi */
.stage-tip {
    text-align: center;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 500;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.stage-tip i {
    color: #2563eb;
}

/* Dosya Yükleme Alanı */
.upload-zone-box {
    border: 2px dashed #93c5fd;
    background: #f0f9ff;
    border-radius: 14px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-zone-box:hover {
    border-color: #3b82f6;
    background: #e0f2fe;
}
