* { box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: #e0e5ec;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
}

/* Animated Background for Glassmorphism */
#background-blobs {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
}
.blob {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6;
    animation: float 10s infinite alternate;
}
.blob-1 { width: 400px; height: 400px; background: #ff9a9e; top: -100px; left: -100px; }
.blob-2 { width: 500px; height: 500px; background: #a18cd1; bottom: -150px; right: -100px; animation-delay: -5s; }
@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Glassmorphism Base Class */
.glass-panel {
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    padding: 24px;
}

.hidden {
    display: none !important;
}

/* Toast Bildirimleri */
#toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px;
}
.toast {
    background: rgba(255, 255, 255, 0.9); padding: 15px 25px;
    border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    font-weight: 600; font-size: 14px; animation: slideIn 0.3s ease-out;
    border-left: 5px solid #2d3436;
}
.toast.success { border-left-color: #00b894; color: #00b894; }
.toast.error { border-left-color: #d63031; color: #d63031; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Yükleme Progress Bar */
#progress-container {
    width: 100%; height: 8px; background: rgba(255,255,255,0.5);
    border-radius: 4px; overflow: hidden; margin-top: -5px; margin-bottom: 10px;
}
#progress-bar {
    height: 100%; width: 0%; background: #00b894;
    transition: width 0.4s ease;
}

/* Sticker Araç Çubuğu ve Stickerlar */
#sticker-toolbar {
    position: absolute; top: 20px; left: 20px; padding: 10px 15px;
    display: flex; gap: 10px; align-items: center; z-index: 110;
}
.sticker-btn {
    background: none; border: none; font-size: 24px; padding: 5px;
    box-shadow: none; width: auto; transition: transform 0.2s;
}
.sticker-btn:hover { transform: scale(1.3); background: none; box-shadow: none; }

.sticker {
    position: absolute; font-size: 40px; cursor: grab; user-select: none; z-index: 50; /* Fotoğrafların üstünde kalması için artırıldı */
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
}
.sticker:active { cursor: grabbing; }

/* Login Section */
#login-section.active { display: flex; flex-direction: column; width: 90%; max-width: 400px; gap: 15px; text-align: center; }

input {
    width: 100%; padding: 12px; margin-bottom: 10px;
    border: 1px solid rgba(255,255,255,0.6); border-radius: 8px;
    background: rgba(255,255,255,0.5); outline: none; font-family: inherit; font-size: 14px;
}
input:focus { background: rgba(255,255,255,0.9); }

button {
    width: 100%; padding: 12px; border: none; border-radius: 8px;
    background: #6c5ce7; color: white; font-weight: 600; cursor: pointer;
    transition: all 0.3s; font-family: inherit; font-size: 15px;
}
button:hover { background: #5b4bc4; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }

/* Canva-like App Layout */
#app-section { width: 95%; max-width: 1200px; display: flex; flex-direction: column; gap: 20px; margin: 40px 0; }
.header { display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; }
.header h1 { margin: 0; font-size: 24px; color: #2d3436; }
#logout-btn { width: auto; background: #ff7675; padding: 8px 20px; }
#logout-btn:hover { background: #d63031; }

.main-content { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }

/* Modern Sidebar (Upload Panel) */
.sidebar { flex: 1; min-width: 280px; display: flex; flex-direction: column; gap: 10px; background: linear-gradient(135deg, rgba(255,255,255,0.8), rgba(255,255,255,0.5)); border-radius: 20px; padding: 25px; border: 1px solid rgba(255,255,255,0.9); box-shadow: 0 10px 30px rgba(0,0,0,0.08); }
.sidebar h2 { margin-top: 0; color: #2d3436; font-size: 22px; border-bottom: 2px dashed #fbd962; padding-bottom: 15px; text-align: center; }
.sidebar label { font-size: 13px; font-weight: 600; color: #444; margin-top: 10px; }
.sidebar input, .sidebar button { border-radius: 12px; }
.sidebar input[type="file"] { background: white; cursor: pointer; padding: 8px; }

.content-area { flex: 3; min-width: 300px; min-height: 500px; }
.content-area h2 { margin-top: 0; color: #2d3436; }

/* Beautiful Folders */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 20px; margin-top: 20px; }
.folder {
    background: linear-gradient(135deg, #fbd962, #ffb142);
    height: 110px; border-radius: 8px 20px 8px 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: bold; color: #fff;
    cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s; position: relative;
}
.folder::before {
    content: ''; position: absolute; top: -10px; left: 0;
    width: 45%; height: 10px; background: #e1b12c;
    border-radius: 8px 8px 0 0;
}
.folder:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.2); }

/* Kitap ve Sayfa Tasarımı */
.book-modal {
    position: fixed; top: 5%; left: 5%; width: 90%; height: 90%;
    z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
#close-book-btn { position: absolute; top: 20px; right: 20px; width: auto; background: #2d3436; }

/* Yükleniyor Ekranı */
#book-loader {
    position: absolute; inset: 0; border-radius: 16px;
    background: rgba(224, 229, 236, 0.95); z-index: 200;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 0.3s;
}
.loader-spinner {
    border: 6px solid #fbd962; border-top: 6px solid #ffb142;
    border-radius: 50%; width: 50px; height: 50px;
    animation: spin 1s linear infinite; margin-bottom: 15px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }


/* Kitap ve Ok Butonları Konteyneri */
.book-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    width: 100%;
    max-width: 950px;
    margin: 0 auto;
}
.nav-btn {
    width: 50px; height: 50px; flex-shrink: 0;
    border-radius: 50%; background: #2d3436; color: white;
    font-size: 20px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; z-index: 10; border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    transition: all 0.2s;
}
.nav-btn:hover { background: #6c5ce7; transform: scale(1.1); }

#book {
    width: 800px; /* Kütüphanenin çökmemesi için sabit değer */
    height: 500px;
    max-width: 100%;
}

.page {
    background-color: #f9f8f3; /* Defter kağıdı rengi */
    background-image: radial-gradient(#d7d7d7 1px, transparent 1px);
    background-size: 20px 20px; /* Noktalı defter deseni */
    box-shadow: inset 0 0 20px rgba(0,0,0,0.1);
    display: block;
    overflow: hidden;
    position: relative; /* Stickerlar için gerekli */
    border: 1px solid #ddd;
}

/* Kapak Sayfası */
.cover-page {
    background: linear-gradient(135deg, #fbd962, #ffb142);
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.cover-content {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

/* Fotoğraf Konteyneri (Polaroid Görünümü) */
.photo-container {
    position: absolute;
    width: 65%;
    background: white;
    padding: 10px 10px 45px 10px; /* Başlık ve tarih için alt boşluk artırıldı */
    box-shadow: 2px 4px 12px rgba(0,0,0,0.15);
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
}
.photo-container:hover { z-index: 15; }

.photo-container img {
    width: 100%;
    height: 150px; /* Başlığa yer açmak için biraz küçültüldü */
    object-fit: cover;
    border-radius: 2px;
}

/* Fotoğraf Silme Butonu */
.delete-photo-btn {
    position: absolute; top: 8px; right: 8px;
    background: rgba(255, 255, 255, 0.9); border: none; border-radius: 50%;
    width: 32px; height: 32px; font-size: 16px;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    opacity: 0; transition: all 0.2s; z-index: 20;
}
.photo-container:hover .delete-photo-btn {
    opacity: 1;
}
.delete-photo-btn:hover {
    background: #ff7675; color: white; transform: scale(1.1);
}

/* Bant Efekti (Washi Tape) */
.tape {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%) rotate(-3deg);
    width: 90px;
    height: 25px;
    background-color: #fcf1d8; /* Opak renk - Arkadan yansımayı engeller */
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 10;
}
.photo-container:nth-child(even) .tape {
    background-color: #e5f1fa; /* Opak renk */
    transform: translateX(-50%) rotate(4deg);
}

/* Başlık Yazısı */
.photo-title {
    font-family: 'Kalam', cursive;
    font-size: 16px;
    color: #2d3436;
    text-align: center;
    margin-top: 8px;
    line-height: 1.1;
}

/* Tarih Yazısı */
.photo-date {
    position: absolute;
    bottom: 8px;
    font-family: 'Kalam', 'Poppins', cursive;
    font-size: 13px;
    font-weight: 700;
    color: #777;
}

/* MOBİL UYUMLULUK (Responsive Design) */
@media (max-width: 850px) {
    .book-controls { transform: scale(0.7); transform-origin: top center; margin-top: 20px; }
}

@media (max-width: 600px) {
    body { padding: 10px; }
    #app-section { margin: 20px 0; }
    .header { flex-direction: column; gap: 15px; text-align: center; }
    .main-content { flex-direction: column; }
    .sidebar, .content-area { width: 100%; min-width: 100%; }
    .folder-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    
    /* Mobil 3D Kitap Ölçeklendirmesi (Kütüphaneyi bozmamak için CSS Transform kullanıyoruz) */
    .book-modal { padding-top: 70px; align-items: center; justify-content: flex-start; overflow-y: auto; overflow-x: hidden;}
    .book-controls { 
        position: relative;
        transform: scale(0.42); /* 800px genişliği mobil ekrana sığdırır */
        transform-origin: top center; 
        gap: 0;
    }
    /* Ok butonlarını mobilde kitabın dışına, daha kolay basılacak şekilde konumlandırıyoruz */
    .nav-btn {
        position: absolute; top: 50%; transform: translateY(-50%);
        width: 80px; height: 80px; font-size: 32px; z-index: 100;
    }
    #prev-page-btn { left: -50px; }
    #next-page-btn { right: -50px; }
    
    #close-book-btn { top: 10px; right: 10px; font-size: 14px; z-index: 250; }
    #sticker-toolbar { top: 10px; left: 10px; flex-wrap: wrap; width: 65%; z-index: 200; }
    .sticker-btn { font-size: 20px; }
}
