/* --- 1. CSS Değişkenleri --- */
:root {
    --bg-dark: #0f172a; --bg-sidebar: #1e293b; --border-color: #334155;
    --primary-color: #3b82f6; --text-color: #f8fafc;
    
    --lap-w: 960px; --lap-h: 600px;
    --tab-w: 420px; --tab-h: 580px;
    --mob-w: 260px; --mob-h: 520px;
}

body.light-theme {
    --bg-dark: #f1f5f9; --bg-sidebar: #ffffff; --border-color: #e2e8f0;
    --primary-color: #2563eb; --text-color: #0f172a;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', sans-serif; height: 100vh; overflow: hidden; color: var(--text-color); }

.app-container { display: flex; height: 100vh; width: 100vw; background: var(--bg-dark); transition: 0.3s; }

/* SIDEBAR */
.sidebar {
    width: 320px; min-width: 320px; background: var(--bg-sidebar); border-right: 1px solid var(--border-color);
    display: flex; flex-direction: column; padding: 20px; gap: 20px; overflow-y: auto; transition: 0.3s; z-index: 10;
}
.sidebar-header { display: flex; justify-content: space-between; align-items: center; }
.sidebar-header h2 { margin: 0; font-size: 1.2rem; font-weight: bold; }
.theme-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); border-radius: 50%; width: 35px; height: 35px; cursor: pointer; }

.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-group label { font-size: 0.82rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }

input[type="text"], .view-dropdown {
    width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2); color: var(--text-color); outline: none; font-size: 14px; transition: border-color 0.3s;
}
body.light-theme input[type="text"], body.light-theme .view-dropdown { background: rgba(255, 255, 255, 0.8); color: #333; border-color: rgba(0,0,0,0.2); }
.view-dropdown option { background: var(--bg-sidebar); color: var(--text-color); }
body.light-theme .view-dropdown option { background: #fff; color: #333; }
input:focus, .view-dropdown:focus { border-color: var(--primary-color); }

.btn { padding: 12px; border: none; border-radius: 8px; font-weight: 600; cursor: pointer; width: 100%; }
.btn-primary { background: var(--primary-color); color: white; }
.btn-secondary { background: transparent; border: 1px solid var(--border-color); color: var(--text-color); }
.btn-secondary:hover { background: var(--border-color); }

#statusMessage { font-size: 0.8rem; color: #64748b; }
.size-row { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.size-row span { width: 60px; font-weight: bold; }

.sidebar-footer { margin-top: auto; padding-top: 15px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 10px; }
#footerContainer { font-size: 0.75rem; color: #64748b; text-align: center; }

/* --- TUVAL AREA --- */
.preview-area {
    flex: 1; display: flex; justify-content: center; align-items: center; overflow: hidden; position: relative;
    background-image: radial-gradient(var(--border-color) 1px, transparent 1px); background-size: 20px 20px;
}

/* ANA SARMALAYICI (İçeriğe göre otomatik esner) */
.showcase-wrapper {
    display: flex; transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    width: max-content; height: max-content;
}

/* CİHAZ ORTAK AYARLARI */
.device { position: relative; background: #000; display: flex; justify-content: center; align-items: center; transition: all 0.4s ease; }
.device iframe { width: 100%; height: 100%; border: none; background: #fff; }

/* Cihaz Detay Çizimleri */
.laptop { width: var(--lap-w); height: var(--lap-h); padding: 15px 15px 40px 15px; border-radius: 20px 20px 0 0; box-shadow: inset 0 0 0 2px #333, 0 30px 60px rgba(0,0,0,0.5); }
.laptop iframe { border-radius: 4px; }
.laptop::after { content: ''; position: absolute; bottom: -20px; left: -2px; width: calc(100% + 4px); height: 20px; background: linear-gradient(to bottom, #ccc, #888); border-radius: 0 0 16px 16px; }
.laptop::before { content: ''; position: absolute; bottom: -20px; left: 50%; transform: translateX(-50%); width: 100px; height: 6px; background: #999; border-radius: 0 0 6px 6px; z-index: 2; }
.laptop .camera { position: absolute; top: 6px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; background: #222; border-radius: 50%; }

.tablet { width: var(--tab-w); height: var(--tab-h); padding: 20px; border-radius: 36px; box-shadow: inset 0 0 0 3px #555, 0 20px 40px rgba(0,0,0,0.4); }
.tablet iframe { border-radius: 16px; }
.tablet .camera { position: absolute; top: 7px; left: 50%; transform: translateX(-50%); width: 6px; height: 6px; background: #222; border-radius: 50%; }

.mobile { width: var(--mob-w); height: var(--mob-h); padding: 15px; border-radius: 45px; box-shadow: inset 0 0 0 3px #666, 0 20px 40px rgba(0,0,0,0.4); }
.mobile iframe { border-radius: 30px; }
.mobile .dynamic-island { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 80px; height: 22px; background: #000; border-radius: 12px; z-index: 10; }

/* =========================================
   DİNAMİK ŞABLON DÜZENLERİ (FLEXBOX MİMARİSİ)
   ========================================= */

/* 1. ŞABLON: YAN YANA GÖRÜNÜM */
.layout-side-by-side {
    flex-direction: row; align-items: center; gap: 40px;
}

/* 2. ŞABLON: KATMANLI GÖRÜNÜM (Am I Responsive Tarzı Üst Üste) */
.layout-overlapping {
    flex-direction: row; align-items: flex-end; /* Alt tabandan hizala */
}
.layout-overlapping .tablet { order: 1; margin-right: -140px; margin-bottom: 30px; z-index: 2; }
.layout-overlapping .laptop { order: 2; z-index: 1; }
.layout-overlapping .mobile { order: 3; margin-left: -100px; margin-bottom: -10px; z-index: 3; }

/* 3. ŞABLON: DİKEY SIRALAMA */
.layout-vertical {
    flex-direction: column; align-items: center; gap: 50px;
}

/* FİLTRELEME DURUMUNDA DİĞERLERİNİ TAMAMEN SİL (Flexbox alanını daraltır) */
.view-desktop .tablet, .view-desktop .mobile { display: none !important; }
.view-tablet .laptop, .view-tablet .mobile { display: none !important; }
.view-mobile .laptop, .view-mobile .tablet { display: none !important; }