/*
 * Zarf Projesi Genel Stil Dosyası
 * Tüm özel CSS kodları (Header, Anasayfa, Tekil Sayfa ve Tasarım Paneli) bu dosyada birleştirilmiştir.
 */

/* =========================================
   1. GENEL AYARLAR & HEADER (Modernleştirilmiş)
   ========================================= */
body { margin: 0; padding: 0; background: #f0f2f5; font-family: 'Helvetica Neue', sans-serif; padding-top: 70px; }
.game-container { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #fff; /* Beyaz arka plan */
    box-shadow: 0 2px 10px rgba(0,0,0,0.05); /* Hafif gölge */
    position: fixed; /* Sticky yerine fixed daha iyi bir kullanıcı deneyimi sunar */
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    height: 70px;
}

.game-header .logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.game-header .header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.game-header .header-actions a {
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: #555;
    transition: color 0.2s;
}

.game-header .header-actions a:hover {
    color: #000;
}

.game-header .btn-new-zarf {
    background-color: #e74c3c; /* Kırmızı vurgu */
    color: #fff !important;
    padding: 8px 15px;
    border-radius: 5px;
    font-weight: 600;
    transition: background-color 0.2s;
}

.game-header .btn-new-zarf:hover {
    background-color: #c0392b;
}

/* =========================================
   2. TASARIM PANELİ (Mevcut Koddan Korundu)
   ========================================= */
#toggleDesignBtn { 
    position: fixed; top: 90px; right: 0; 
    background: #333; color: #fff; border: none; 
    padding: 12px 20px; border-radius: 30px 0 0 30px; 
    cursor: pointer; z-index: 9100; font-weight: bold;
    display: block;
}

.design-toolbar {
    position: fixed; top: 0; right: 0; 
    width: 320px; height: 100vh;
    background: #ffffff; 
    box-shadow: -10px 0 30px rgba(0,0,0,0.15); 
    z-index: 9999;
    transform: translateX(100%); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px; padding-top: 90px;
    box-sizing: border-box; 
    display: flex; flex-direction: column; overflow-y: auto;
}
.design-toolbar.open { transform: translateX(0); }

@media (min-width: 901px) {
    .design-toolbar { 
        transform: translateX(0); 
        box-shadow: none; border-left: 1px solid #eee;
        z-index: 8000;
    }
    #toggleDesignBtn { display: none; }
    #closeDesignPanel { display: none; }
    .stage {
        width: calc(100% - 320px) !important;
        margin-right: 320px;
    }
}

.design-group { margin-bottom: 25px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.design-btn { 
    width: 100%; padding: 12px; margin-bottom: 8px; border: 1px solid #ddd; 
    background: #f9f9f9; color: #333; border-radius: 8px; cursor: pointer; 
    text-align: left; display: flex; align-items: center; gap: 10px; transition:0.2s;
}
.design-btn:hover { background: #eee; }
.design-btn.active { background: #333; color: #fff; border-color: #333; }
.input-text, .input-select { width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 8px; }

/* =========================================
   3. ANASAYFA ZARF KARTLARI (front-page.php'den)
   ========================================= */
.zarf-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 20px;
    box-sizing: border-box;
}

.zarf-header { text-align: center; margin-bottom: 60px; }

.zarf-grid-3-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    row-gap: 80px;
    width: 100%;
    margin-bottom: 80px;
}

.zarf-card-wrapper {
    position: relative;
    width: 100%;
    height: 240px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    cursor: pointer;
    isolation: isolate; 
    margin-bottom: 20px;
}
.zarf-card-item {
    /* Yeni kapsayıcı, meta veriyi zarfın altına itmek için */
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- MEKTUP KAĞIDI (ARKADA / HAREKETLİ) --- */
.card-paper {
    position: absolute;
    bottom: 10px;
    width: 85%;
    height: 180px;
    background-color: #fff;
    background-size: cover; background-position: center;
    border-radius: 8px;
    box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
    z-index: 1;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- ZARF YÜZÜ (ÖNDE / SABİT) --- */
.card-skin {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 180px; /* Yükseklik 140px'ten 180px'e çıkarıldı */
    background-color: #e74c3c;
    background-size: cover; background-position: center;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 5;
    display: flex; align-items: center; justify-content: center;
}

.btn-detay {
    display: inline-block; padding: 10px 25px;
    background: rgba(0,0,0,0.8); color: #fff; 
    text-decoration: none; border-radius: 30px;
    font-size: 0.9rem; font-weight: bold;
    backdrop-filter: blur(4px);
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.card-meta {
    /* Artık zarfın altındaki kapsayıcıda, absolute pozisyonu kaldırıldı */
    width: 100%; 
    text-align: center;
    display: flex; flex-direction: column; gap: 5px;
    margin-top: 20px; /* Zarf ile meta veri arasına boşluk */
}

.meta-title {
    font-size: 1.1rem; font-weight: 700; color: #333; margin: 0;
    line-height: 1.2;
}

.meta-author {
    font-size: 0.85rem; color: #888; font-weight: 500;
}

.zarf-card-wrapper:hover .card-paper {
    transform: translateY(-100px); /* Yukarı çıkış mesafesi artırıldı */
}

.zarf-card-wrapper:hover .btn-detay {
    opacity: 1;
    transform: scale(1);
}

.tab-btn { background:#555; border:2px solid #333; padding:10px 30px; border-radius:10px; cursor:pointer; margin:0 5px; font-weight:700; transition:0.3s; }
.tab-btn.active { background:#333; color:#fff; }

/* =========================================
   4. TEKİL ZARF SAYFASI (single-user_envelope.php'den)
   ========================================= */

.stage { 
    width: 100%; min-height: 85vh; 
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding-bottom: 120px; box-sizing: border-box; overflow: visible;
    position: relative;
    perspective: 1500px; /* Mevcut koddan korundu */
    transition: width 0.3s ease; /* Mevcut koddan korundu */
}
.zarf-comments-section {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    margin-top: 50px;
}

.page-title-top {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    text-align: center;
    font-family: 'Georgia', serif;
    color: #333;
    font-size: 1.8rem;
    z-index: 50;
}

/* --- ZARF VE MEKTUP ANİMASYONU İYİLEŞTİRMESİ --- */
.env-part, .letter-paper, .envelope-wrapper.shape-circle::after {
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), z-index 0.2s;
}

/* Zarf Gövdesi Aşağı İner */
.envelope-wrapper.open .env-back,
.envelope-wrapper.open .env-left,
.envelope-wrapper.open .env-right,
.envelope-wrapper.shape-circle.open::after {
    transform: translateY(80px);
}

.envelope-wrapper.open .env-flap {
    transform: translateY(80px) rotateX(180deg); 
    z-index: 1;
}

.letter-paper {
    z-index: 2 !important; 
    bottom: 5px;
    transform: translateX(-50%) scale(0.9);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
}

.envelope-wrapper.open .letter-paper {
    transform: translateX(-50%) translateY(-125px) scale(1.5) !important;
    z-index: 15 !important;
}

.letter-content {
    width: 100%;
    height: 100%;
    max-height: 280px;
    overflow-y: auto;
    font-family: 'Georgia', serif; 
    font-size: 0.9rem;
    color: #222;
    line-height: 1.6;
    text-align: left;
    padding-right: 5px;
}

.letter-content::-webkit-scrollbar { width: 4px; }
.letter-content::-webkit-scrollbar-track { background: #f1f1f1; }
.letter-content::-webkit-scrollbar-thumb { background: #d4af37; border-radius: 4px; }

/* --- AKSİYON BUTONLARI (Sayfanın Altına Taşındı) --- */
.page-actions {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 15px; align-items: center; justify-content: center;
    z-index: 1000; background: rgba(255,255,255,0.95);
    padding: 10px 25px; border-radius: 40px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
    backdrop-filter: blur(8px); border: 1px solid rgba(0,0,0,0.05);
    white-space: nowrap;
}
.asset-links {
    display: flex; align-items: center; gap: 10px;
    font-size: 0.75rem; color: #666;
    padding-right: 15px; border-right: 1px solid #ddd;
}
.asset-links a { text-decoration: none; color: #555; font-weight: 600; transition: color 0.2s; }
.asset-links a:hover { color: #000; text-decoration: underline; }

#closeBtn { position: fixed; bottom: 100px; right: 20px; width: 45px; height: 45px; border-radius: 50%; background: rgba(0,0,0,0.8); color: #fff; border: none; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; cursor: pointer; z-index: 2000; opacity: 0; pointer-events: none; transition: transform 0.2s; }
#closeBtn:active { transform: scale(0.9); }

/* =========================================
   5. MOBİL OPTİMİZASYON (Tüm Dosyalardan Toplandı ve İyileştirildi)
   ========================================= */

@media (max-width: 900px) { 
    .zarf-grid-3-col { grid-template-columns: repeat(2, 1fr); } 
    
    /* Tasarım Paneli Mobil */
    .design-toolbar { width: 100%; top: 70px; height: calc(100vh - 70px); }
    .envelope-wrapper { transform: scale(0.75); }
    .envelope-wrapper:hover { transform: scale(0.75); }
}

@media (max-width: 600px) { 
    .zarf-grid-3-col { grid-template-columns: 1fr; } 
    
    /* Header Mobil */
    .game-header { padding: 10px 15px; height: 60px; }
    body { padding-top: 60px; }
    .game-header .logo a { font-size: 1.2rem; }
    .game-header .header-actions { gap: 10px; }
    .game-header .header-actions a { font-size: 0.8rem; }
    .game-header .btn-new-zarf { padding: 6px 10px; }
    
    /* Tekil Zarf Sayfası Mobil */
    .envelope-wrapper { transform: scale(0.6) !important; margin-top: 20px; }
    .page-title-top { font-size: 1.4rem; top: 15px; }
    .envelope-wrapper.open .letter-paper { 
        transform: translateX(-50%) translateY(-100px) scale(1.25) !important; 
    }
    .page-actions { width: 92%; bottom: 15px; padding: 8px 15px; gap: 10px; }
    .asset-links { display: none; } /* Mobilde linkleri gizle */
}

/* =========================================
   6. MEVCUT KODDAN KORUNAN DİĞER STİLLER
   ========================================= */
.envelope-wrapper { 
    position: relative; width: 300px; height: 200px; 
    cursor: pointer; transition: transform 0.5s ease;
    will-change: transform, filter; 
}
.envelope-wrapper:hover { transform: scale(1.05); }

.env-part { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.env-back { background: #e74c3c; border-radius: 6px; box-shadow: 0 15px 35px rgba(0,0,0,0.2); background-size: cover; background-position: center; z-index: 1; }

/* MODEL 1: STANDART */
.env-left { border-style: solid; border-width: 100px 0 100px 150px; border-color: transparent transparent transparent rgba(0,0,0,0.05); z-index: 3; }
.env-right { border-style: solid; border-width: 0 0 200px 300px; border-color: transparent transparent #e74c3c transparent; z-index: 4; }
.env-flap { height: 110px; background-color: #e74c3c; clip-path: polygon(0 0, 100% 0, 50% 100%); transform-origin: top; z-index: 5; background-size: cover; background-position: center; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), z-index 0.2s; filter: brightness(0.9); }

/* MODEL 2: ÇEMBER */
.envelope-wrapper.shape-circle { width: 280px; height: 280px; border-radius: 50%; }
.envelope-wrapper.shape-circle .env-back { border-radius: 50%; }
.envelope-wrapper.shape-circle .env-left, .envelope-wrapper.shape-circle .env-right { display: none; }
.envelope-wrapper.shape-circle .env-flap { width: 100%; height: 140px; clip-path: none; border-radius: 140px 140px 0 0; transform-origin: bottom; top: 0; z-index: 5; background-color: #c0392b; }
.envelope-wrapper.shape-circle::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 140px; background-color: #e74c3c; border-radius: 0 0 140px 140px; z-index: 4; pointer-events: none; box-shadow: inset 0 10px 20px rgba(0,0,0,0.1); }

.envelope-wrapper.shape-circle .letter-paper { width: 220px; height: 220px; border-radius: 50%; bottom: 30px; }

/* AÇILMA DURUMU */
.envelope-wrapper.open .env-flap { transform: rotateX(180deg); z-index: 0; }
.envelope-wrapper.open .letter-paper { transform: translateX(-50%) translateY(-150px) scale(1); z-index: 10; }
.letter-content { width: 100%; height: 100%; opacity: 0; transition: 0.5s; overflow:hidden; }
.envelope-wrapper.open .letter-content { opacity: 1; transition-delay: 0.4s; }

/* EFEKTLER (Mevcut Koddan Korundu) */
@keyframes floatAnim {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
.envelope-wrapper.effect-float {
    animation: floatAnim 4s ease-in-out infinite;
}

@keyframes pulseAnim {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}
.envelope-wrapper.effect-pulse {
    animation: pulseAnim 2s infinite ease-in-out;
}

@keyframes glowAnim {
    0%, 100% { filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.2)); }
    50% { filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.8)); }
}
.envelope-wrapper.effect-glow {
    animation: glowAnim 2s infinite alternate;
}

@keyframes shakeAnim {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-3px, 0px) rotate(1deg); }
    30% { transform: translate(3px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-3px, 1px) rotate(0deg); }
    70% { transform: translate(3px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}
.envelope-wrapper.effect-shake {
    animation: shakeAnim 0.8s;
}

#closeBtn { position: absolute; top: 100px; left: 50%; transform: translateX(-50%); padding: 10px 25px; background: #333; color: #fff; border: none; border-radius: 30px; opacity: 0; pointer-events: none; z-index: 100; }
