﻿/* ==================== BASE STYLES ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { overscroll-behavior: none; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background: #f5f7fa; 
    color: #2C3E50; 
    line-height: 1.5;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}
.hidden { display: none !important; }

/* ==================== AUTH STYLES ==================== */
#auth-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2C3E50 0%, #3498DB 100%); padding: 20px; }
.auth-box { background: white; padding: 40px; border-radius: 16px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,0.2); }
.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo h1 { color: #2C3E50; font-size: 28px; margin-top: 10px; }
.auth-box h2 { color: #2C3E50; margin-bottom: 20px; text-align: center; }
.auth-box input { width: 100%; padding: 14px 16px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 16px; margin-bottom: 16px; transition: border-color 0.3s; }
.auth-box input:focus { outline: none; border-color: #E67E22; }
.auth-box button { width: 100%; }
.auth-switch { text-align: center; margin-top: 20px; color: #666; }
.auth-switch a { color: #E67E22; text-decoration: none; font-weight: 600; }

/* ==================== BUTTONS ==================== */
.btn { padding: 12px 24px; border: none; border-radius: 8px; font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.3s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: #E67E22; color: white; }
.btn-primary:hover { background: #D35400; }
.btn-secondary { background: #ecf0f1; color: #2C3E50; }
.btn-secondary:hover { background: #d5dbdb; }
.btn-success { background: #27AE60; color: white; }
.btn-success:hover { background: #219A52; }
.btn-danger { background: #E74C3C; color: white; }
.btn-danger:hover { background: #C0392B; }
.btn-add { margin-bottom: 20px; }
.icon-btn { background: none; border: none; padding: 8px; cursor: pointer; color: #666; border-radius: 8px; transition: all 0.3s; }
.icon-btn:hover { background: #f0f0f0; color: #2C3E50; }

/* ==================== APP HEADER ==================== */
.app-header { position: fixed; top: 0; left: 0; right: 0; height: 60px; background: white; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); z-index: 100; }
.header-brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.header-brand span { font-size: 20px; font-weight: 700; color: #2C3E50; }
.header-actions { display: flex; gap: 8px; }

/* ==================== BOTTOM NAV ==================== */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: 70px; background: white; display: flex; justify-content: space-around; align-items: center; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 100; padding-bottom: env(safe-area-inset-bottom); }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: #95a5a6; padding: 8px 12px; border-radius: 12px; transition: all 0.3s; }
.nav-item span { font-size: 11px; font-weight: 500; }
.nav-item.active { color: #E67E22; }
.nav-item:hover { color: #E67E22; }

/* Desktop Sidebar Layout */
@media (min-width: 769px) {
    .bottom-nav {
        position: fixed;
        left: 0;
        top: 60px;
        bottom: 0;
        right: auto;
        width: 200px;
        height: auto;
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 12px;
        padding-bottom: 140px;
        box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    }
    .nav-item {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
    }
    .nav-item span {
        font-size: 14px;
    }
    .app-main {
        margin-left: 200px;
    }
    .sidebar-footer {
        display: block !important;
        left: 0;
        width: 200px;
        bottom: 0;
    }
}

/* ==================== MAIN CONTENT ==================== */
.app-main { margin-top: 60px; margin-bottom: 70px; padding: 20px; min-height: calc(100vh - 130px); }
.page { display: none; }
.page.active { display: block; }
.page-title { margin-bottom: 24px; }
.page-title h1 { font-size: 28px; color: #2C3E50; font-weight: 700; }
.page-title p { color: #95a5a6; margin-top: 4px; }

/* ==================== STATS GRID ==================== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 30px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.stat-card { background: white; padding: 20px; border-radius: 12px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.stat-icon.blue { background: #EBF5FB; color: #3498DB; }
.stat-icon.green { background: #E8F8F5; color: #27AE60; }
.stat-icon.orange { background: #FEF5E7; color: #E67E22; }
.stat-icon.purple { background: #F4ECF7; color: #9B59B6; }
.stat-info { display: flex; flex-direction: column; }
.stat-number { font-size: 28px; font-weight: 700; color: #2C3E50; }
.stat-label { font-size: 13px; color: #95a5a6; }

/* ==================== DASHBOARD ==================== */
.dashboard-section { margin-bottom: 30px; }
.dashboard-section h3 { font-size: 18px; color: #2C3E50; margin-bottom: 16px; }
.progress-card { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.progress-header { display: flex; justify-content: space-between; margin-bottom: 12px; }
.progress-value { color: #E67E22; font-weight: 600; }
.progress-bar { height: 8px; background: #ecf0f1; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #27AE60, #2ECC71); border-radius: 4px; transition: width 0.5s; }
.progress-footer { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; color: #95a5a6; }
.progress-footer strong { color: #2C3E50; }

/* ==================== RECENT BOOKS ==================== */
.recent-list { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.recent-item { display: flex; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid #f0f0f0; cursor: pointer; transition: background 0.3s; }
.recent-item:hover { background: #f8f9fa; }
.recent-item:last-child { border-bottom: none; }
.recent-cover { width: 50px; height: 70px; border-radius: 6px; object-fit: cover; background: #ecf0f1; }
.recent-info h4 { font-size: 15px; color: #2C3E50; margin-bottom: 4px; }
.recent-info p { font-size: 13px; color: #95a5a6; }
.empty-text { padding: 40px; text-align: center; color: #95a5a6; }

/* ==================== SCAN PAGE ==================== */
.scan-tabs { display: flex; gap: 12px; margin-bottom: 20px; }
.tab-btn { flex: 1; padding: 12px; background: #ecf0f1; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.3s; }
.tab-btn.active { background: #E67E22; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }
#scanner-viewport { width: 100%; height: 280px; background: #000; border-radius: 12px; overflow: hidden; position: relative; margin-bottom: 16px; }
#scanner-viewport video, #scanner-viewport canvas { position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; object-fit: cover !important; }
.scanner-controls { text-align: center; }
.manual-search { max-width: 500px; margin: 0 auto; }
.manual-search label { display: block; margin-bottom: 8px; font-weight: 600; color: #2C3E50; }
.search-input-group { display: flex; gap: 12px; }
.search-input-group input { flex: 1; padding: 14px 16px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 16px; }
.search-input-group input:focus { outline: none; border-color: #E67E22; }
.search-result { margin-top: 24px; background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

/* ==================== BOOKS PAGE ==================== */
.filters-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; align-items: center; }
.filter-select { padding: 10px 16px; border: 2px solid #e0e0e0; border-radius: 20px; font-size: 14px; background: white; cursor: pointer; min-width: 140px; }
.filter-select:focus { outline: none; border-color: #E67E22; }
.view-toggle { display: flex; gap: 4px; margin-left: auto; background: #ecf0f1; padding: 4px; border-radius: 8px; }
.view-btn { padding: 8px 12px; border: none; background: transparent; border-radius: 6px; cursor: pointer; color: #95a5a6; transition: all 0.3s; }
.view-btn.active { background: #E67E22; color: white; }
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.books-list { display: flex; flex-direction: column; gap: 12px; }

/* ==================== BOOK CARD ==================== */
.book-card { background: white; border-radius: 12px; overflow: hidden; cursor: pointer; transition: all 0.3s; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.book-card:hover { transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.book-cover { position: relative; aspect-ratio: 2/3; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .no-cover { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: white; opacity: 0.9; padding: 8px; text-align: center; font-size: 12px; }
.read-badge { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.read-badge.read { background: #27AE60; color: white; }
.read-badge.unread { background: #E67E22; color: white; }
.book-info { padding: 12px; }
.book-title { font-size: 14px; font-weight: 600; color: #2C3E50; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-author { font-size: 12px; color: #E67E22; }

/* ==================== SHELVES PAGE ==================== */
.shelves-list { display: flex; flex-direction: column; gap: 12px; }
.shelf-card { background: white; border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); border-left: 4px solid #E67E22; }
.shelf-icon { width: 48px; height: 48px; border-radius: 10px; background: #FEF5E7; display: flex; align-items: center; justify-content: center; color: #E67E22; }
.shelf-info { flex: 1; }
.shelf-info h3 { font-size: 16px; color: #2C3E50; margin-bottom: 4px; }
.shelf-info p { font-size: 13px; color: #95a5a6; }
.shelf-actions { display: flex; gap: 8px; }

/* ==================== MODAL - MODERN ==================== */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); }
.modal-content { 
    position: relative; 
    background: white; 
    border-radius: 20px; 
    width: 100%; 
    max-width: 480px; 
    max-height: 90vh; 
    overflow-y: auto; 
    animation: modalPop 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal-content.modal-lg { max-width: 600px; }
@keyframes modalPop { from { opacity: 0; transform: scale(0.9) translateY(-20px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 24px 28px; 
    border-bottom: 1px solid #f0f0f0; 
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-radius: 20px 20px 0 0;
}
.modal-header h2 { font-size: 22px; color: #2C3E50; font-weight: 700; }
.close-btn { 
    width: 40px; 
    height: 40px; 
    border: none; 
    background: #f0f0f0; 
    border-radius: 50%; 
    font-size: 20px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    color: #666; 
    transition: all 0.3s;
}
.close-btn:hover { background: #E74C3C; color: white; transform: rotate(90deg); }
.modal-actions { 
    display: flex; 
    justify-content: flex-end; 
    gap: 12px; 
    padding: 20px 28px; 
    background: #f8f9fa;
    border-radius: 0 0 20px 20px;
}

/* ==================== FORMS - MODERN ==================== */
#shelf-form, .modal form { padding: 28px; }
.form-group { margin-bottom: 20px; }
.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    font-size: 13px; 
    font-weight: 600; 
    color: #64748b; 
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-group input, .form-group select, .form-group textarea { 
    width: 100%; 
    padding: 14px 16px; 
    border: 2px solid #e2e8f0; 
    border-radius: 12px; 
    font-size: 15px; 
    transition: all 0.3s;
    background: #f8fafc;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { 
    outline: none; 
    border-color: #E67E22; 
    background: white;
    box-shadow: 0 0 0 4px rgba(230, 126, 34, 0.1);
}
.form-group input::placeholder { color: #94a3b8; }
.form-group input[type="color"] {
    height: 50px;
    padding: 8px;
    cursor: pointer;
}
.form-group input[type="number"] {
    -moz-appearance: textfield;
}
.form-row { margin-bottom: 16px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 500px) { .form-row.two-col { grid-template-columns: 1fr; } }
.form-divider { text-align: center; margin: 28px 0; position: relative; }
.form-divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: linear-gradient(90deg, transparent, #e0e0e0, transparent); }
.form-divider span { position: relative; background: white; padding: 0 16px; font-size: 11px; font-weight: 700; color: #94a3b8; letter-spacing: 2px; }
.book-detail-body { padding: 20px; }
.book-detail-top { display: flex; gap: 20px; margin-bottom: 24px; padding: 20px; background: #f8f9fa; border-radius: 12px; }
.detail-cover { width: 100px; height: 140px; border-radius: 8px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); overflow: hidden; flex-shrink: 0; }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-info h1 { font-size: 20px; color: #2C3E50; margin-bottom: 8px; }
.detail-author { color: #E67E22; font-size: 15px; margin-bottom: 8px; }
.detail-isbn { font-size: 13px; color: #95a5a6; }

/* ==================== FORMS ==================== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: #2C3E50; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px 14px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 15px; transition: border-color 0.3s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #E67E22; }
.form-row { margin-bottom: 16px; }
.form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 500px) { .form-row.two-col { grid-template-columns: 1fr; } }
.form-divider { text-align: center; margin: 24px 0; position: relative; }
.form-divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 100%; height: 1px; background: #e0e0e0; }
.form-divider span { position: relative; background: white; padding: 0 16px; font-size: 12px; font-weight: 600; color: #95a5a6; letter-spacing: 1px; }

/* ==================== TOGGLE SWITCH ==================== */
.toggle-group { display: flex; align-items: center; gap: 12px; padding-top: 8px; }
.toggle-switch { position: relative; width: 50px; height: 26px; display: inline-block; cursor: pointer; }
.toggle-switch input { 
    position: absolute; 
    opacity: 0; 
    width: 100%; 
    height: 100%; 
    top: 0; 
    left: 0; 
    margin: 0; 
    cursor: pointer; 
    z-index: 2; 
}
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 26px; transition: 0.3s; pointer-events: none; }
.toggle-slider::before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle-switch input:checked + .toggle-slider { background: #27AE60; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(24px); }

/* ==================== SETTINGS ==================== */
.settings-list { background: white; border-radius: 12px; overflow: hidden; margin-bottom: 24px; }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; }
.settings-item:last-child { border-bottom: none; }
.settings-section { margin-bottom: 24px; }
.settings-section h3 { font-size: 18px; margin-bottom: 16px; color: #2C3E50; }
.backup-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.backup-card { background: white; padding: 24px; border-radius: 12px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.backup-card svg { color: #95a5a6; margin-bottom: 12px; }
.backup-card h4 { font-size: 16px; color: #2C3E50; margin-bottom: 8px; }
.backup-card p { font-size: 13px; color: #95a5a6; margin-bottom: 16px; }
.user-info { color: #666; margin-bottom: 16px; }
.switch { position: relative; width: 50px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #ccc; border-radius: 26px; transition: 0.3s; }
.slider::before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.switch input:checked + .slider { background: #27AE60; }
.switch input:checked + .slider::before { transform: translateX(24px); }

/* ==================== EMPTY STATE ==================== */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state svg { margin-bottom: 16px; }
.empty-state h3 { color: #95a5a6; margin-bottom: 16px; }

/* ==================== TOAST - MODERN ==================== */
#toast-container { 
    position: fixed; 
    bottom: 100px; 
    left: 50%; 
    transform: translateX(-50%); 
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast { 
    background: #1a1a2e; 
    color: #ffffff !important; 
    padding: 16px 24px; 
    border-radius: 12px; 
    font-size: 14px; 
    font-weight: 500;
    animation: toastSlide 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); 
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: 400px;
    pointer-events: auto;
}
.toast::before {
    content: '';
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}
.toast.success { 
    background: linear-gradient(135deg, #00b894, #00cec9); 
    color: #fff !important;
}
.toast.success::before {
    content: '✓';
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.toast.error { 
    background: linear-gradient(135deg, #e74c3c, #c0392b); 
    color: #fff !important;
}
.toast.error::before {
    content: '✕';
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.toast.warning { 
    background: linear-gradient(135deg, #f39c12, #e67e22); 
    color: #fff !important;
}
.toast.warning::before {
    content: '!';
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
}
.toast.info { 
    background: linear-gradient(135deg, #3498db, #2980b9); 
    color: #fff !important;
}
.toast.info::before {
    content: 'i';
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-style: italic;
}
@keyframes toastSlide { 
    from { opacity: 0; transform: translateY(30px) scale(0.9); } 
    to { opacity: 1; transform: translateY(0) scale(1); } 
}

/* ==================== DESKTOP SIDEBAR ==================== */
@media (min-width: 768px) {
    .bottom-nav {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 220px;
        height: auto;
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 0;
        border-right: 1px solid #e0e0e0;
        box-shadow: none;
    }
    .nav-item {
        flex-direction: row;
        justify-content: flex-start;
        padding: 14px 24px;
        gap: 12px;
        border-radius: 0;
        width: 100%;
    }
    .nav-item span {
        font-size: 14px;
    }
    .nav-item.active {
        background: #FEF5E7;
        border-right: 3px solid #E67E22;
    }
    .app-main {
        margin-left: 220px;
        margin-bottom: 0;
        padding: 30px;
    }
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (min-width: 1200px) {
    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==================== TOGGLE SWITCH ==================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}
.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider {
    background-color: #27AE60;
}
.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ==================== BOOK FORM ==================== */
.book-form-container {
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.book-form-container .form-group input:focus,
.book-form-container .form-group select:focus,
.book-form-container .form-group textarea:focus {
    border-color: #E67E22;
    outline: none;
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.1);
}
.book-form-container select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
@media (max-width: 600px) {
    .book-form-container .form-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==================== CATEGORY MANAGER ==================== */
.category-manager {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.category-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}
.category-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}
.category-input-group input:focus {
    outline: none;
    border-color: #E67E22;
}
.categories-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
}
.category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 20px;
    font-size: 13px;
    color: #333;
    transition: all 0.2s;
}
.category-tag:hover {
    background: #e0e0e0;
}
.category-tag .remove-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #ccc;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #666;
    transition: all 0.2s;
}
.category-tag .remove-btn:hover {
    background: #E74C3C;
    color: white;
}

/* ==================== SHELF STATS ==================== */
.shelf-stats-container {
    display: grid;
    gap: 12px;
}
.shelf-stat-item {
    background: white;
    padding: 16px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.shelf-stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.shelf-stat-name {
    font-weight: 600;
    color: #2C3E50;
    display: flex;
    align-items: center;
    gap: 8px;
}
.shelf-stat-name .color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.shelf-stat-count {
    font-size: 13px;
    color: #666;
}
.shelf-stat-bar {
    height: 8px;
    background: #ecf0f1;
    border-radius: 4px;
    overflow: hidden;
}
.shelf-stat-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}
.shelf-stat-details {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #95a5a6;
}

/* ==================== CONFIRM DIALOG ==================== */
.confirm-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.confirm-dialog-overlay.open {
    opacity: 1;
}
.confirm-dialog {
    background: #2C3E50;
    border-radius: 12px;
    min-width: 300px;
    max-width: 400px;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.2s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.confirm-dialog-overlay.open .confirm-dialog {
    transform: scale(1);
}
.confirm-dialog-content {
    padding: 24px;
    color: white;
    font-size: 15px;
    line-height: 1.5;
}
.confirm-dialog-content p {
    margin: 0;
}
.confirm-dialog-buttons {
    display: flex;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.confirm-dialog-buttons button {
    flex: 1;
    padding: 14px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-confirm-cancel {
    background: transparent;
    color: white;
    border-right: 1px solid rgba(255,255,255,0.1) !important;
}
.btn-confirm-cancel:hover {
    background: rgba(255,255,255,0.1);
}
.btn-confirm-ok {
    background: #E67E22;
    color: white;
}
.btn-confirm-ok:hover {
    background: #D35400;
}

/* ==================== SIDEBAR FOOTER ==================== */
.sidebar-footer {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1a252f 0%, #2C3E50 100%);
    padding: 8px 12px;
    z-index: 999;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Desktop'ta sidebar genişliğinde */
@media (min-width: 769px) {
    .sidebar-footer {
        bottom: 0;
        width: 200px;
        right: auto;
    }
}

/* Mobilde bottom-nav üstünde */
@media (max-width: 768px) {
    .sidebar-footer {
        bottom: 70px;
    }
    .app-main {
        padding-bottom: 80px;
    }
}

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.footer-bottom {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 10px;
    color: rgba(255,255,255,0.5);
}
.user-info-compact {
    display: flex;
    align-items: center;
    gap: 6px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    flex: 1;
    min-width: 0;
}
.user-info-compact svg {
    flex-shrink: 0;
    opacity: 0.8;
}
.user-info-compact span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.btn-logout-small {
    background: rgba(231, 76, 60, 0.3);
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    color: #E74C3C;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.btn-logout-small:hover {
    background: #E74C3C;
    color: white;
}

/* ==================== SEARCH BOX ==================== */
.search-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.search-box input {
    flex: 1;
    border: none;
    font-size: 15px;
    outline: none;
    background: transparent;
}
.search-box input::placeholder {
    color: #999;
}

/* ==================== LOAD MORE ==================== */
.load-more-container {
    text-align: center;
    padding: 20px 0;
}
.load-more-container .btn {
    padding: 14px 32px;
}

/* ==================== TOAST MODERN ==================== */
#toast-container {
    position: fixed;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    background: white;
    color: #2C3E50;
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
    min-width: 280px;
    border-left: 4px solid #3498DB;
}
.toast.success {
    border-left-color: #27AE60;
}
.toast.error {
    border-left-color: #E74C3C;
}
.toast.warning {
    border-left-color: #F39C12;
}
.toast.info {
    border-left-color: #3498DB;
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ==================== CHARTS ==================== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}
@media (max-width: 768px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}
.chart-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.chart-card h4 {
    font-size: 16px;
    color: #2C3E50;
    margin-bottom: 16px;
    font-weight: 600;
}
.chart-container {
    position: relative;
    height: 250px;
}

/* ==================== ACCOUNT SETTINGS ==================== */
.account-info-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.account-field {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f0f0f0;
}
.account-field:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.account-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #95a5a6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.user-info-value {
    font-size: 16px;
    color: #2C3E50;
    font-weight: 500;
}
.editable-field {
    display: flex;
    gap: 10px;
}
.editable-field input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}
.editable-field input:focus {
    outline: none;
    border-color: #E67E22;
}
.btn-sm {
    padding: 10px 16px;
    font-size: 14px;
}
.password-change-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.password-change-form input {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.3s;
}
.password-change-form input:focus {
    outline: none;
    border-color: #E67E22;
}
.password-change-form button {
    align-self: flex-start;
}

/* ==================== SEARCH RESULT STYLES ==================== */
.search-result { margin-top: 20px; }
.search-result.hidden { display: none; }
.result-loading { text-align: center; padding: 40px; }
.result-loading .spinner { 
    width: 40px; height: 40px; 
    border: 3px solid #f0f0f0; 
    border-top-color: #E67E22; 
    border-radius: 50%; 
    animation: spin 0.8s linear infinite; 
    margin: 0 auto 15px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-content { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.result-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.result-header h3 { color: #27AE60; font-size: 18px; }
.book-preview { display: flex; gap: 20px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid #eee; }
.book-preview .book-cover, .book-preview .result-cover { width: 100px; min-width: 100px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); display: flex; align-items: center; justify-content: center; }
.book-preview .book-cover img, .book-preview .result-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-preview .book-info h4 { font-size: 18px; color: #2C3E50; margin-bottom: 8px; }
.book-preview .book-info .book-author { color: #E67E22; font-size: 14px; margin-bottom: 4px; }
.book-preview .book-info .book-publisher { color: #666; font-size: 13px; }
.book-form .form-row { margin-bottom: 16px; }
.book-form .form-row.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.book-form .form-group label { display: block; font-size: 13px; color: #666; margin-bottom: 6px; font-weight: 500; }
.book-form .form-group input, .book-form .form-group select, .book-form .form-group textarea {
    width: 100%; padding: 12px; border: 2px solid #e0e0e0; border-radius: 8px; font-size: 15px; transition: border-color 0.3s;
}
.book-form .form-group input:focus, .book-form .form-group select:focus, .book-form .form-group textarea:focus { outline: none; border-color: #E67E22; }
.form-actions { margin-top: 20px; }
.form-actions .btn { width: 100%; }
.result-error { text-align: center; padding: 40px; background: white; border-radius: 12px; }
.result-error p { margin-top: 15px; color: #666; }
.result-error a { color: #E67E22; font-weight: 600; text-decoration: none; }
.btn-ghost { background: none; border: none; padding: 8px; cursor: pointer; color: #666; }
.btn-ghost:hover { color: #2C3E50; }

/* ==================== HAMBURGER MENU & SIDEBAR TOGGLE ==================== */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #2C3E50;
    border-radius: 8px;
    transition: all 0.3s;
}
.hamburger-btn:hover {
    background: #f5f7fa;
}
.hamburger-btn svg {
    width: 24px;
    height: 24px;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 149;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Sidebar Styles */
@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .bottom-nav {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding: 16px;
        padding-top: 0;
        padding-bottom: 120px;
        background: white;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        z-index: 150;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .bottom-nav.open {
        left: 0;
    }
    
    /* Sidebar Header */
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 0;
        margin-bottom: 8px;
        border-bottom: 1px solid #eee;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }
    
    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .sidebar-brand span {
        font-size: 18px;
        font-weight: 700;
        color: #2C3E50;
    }
    
    .sidebar-close-btn {
        background: none;
        border: none;
        padding: 8px;
        cursor: pointer;
        color: #95a5a6;
        border-radius: 8px;
        transition: all 0.3s;
    }
    
    .sidebar-close-btn:hover {
        background: #f5f7fa;
        color: #2C3E50;
    }
    
    .bottom-nav .nav-item {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        padding: 14px 16px;
        gap: 14px;
        border-radius: 10px;
        margin-bottom: 4px;
    }
    
    .bottom-nav .nav-item span {
        font-size: 15px;
        font-weight: 500;
        color: #2C3E50;
    }
    
    .bottom-nav .nav-item.active {
        background: #FEF5E7;
    }
    
    .bottom-nav .nav-item.active span {
        color: #E67E22;
    }
    
    .bottom-nav .nav-item svg {
        width: 22px;
        height: 22px;
    }
    
    /* Sidebar Footer - Inside nav for mobile */
    .bottom-nav .sidebar-footer {
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        padding: 14px 16px;
        border-top: 1px solid #eee;
        background: #f8f9fa;
        margin: 0;
    }
    
    .bottom-nav .sidebar-footer .footer-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .bottom-nav .sidebar-footer .user-info-compact {
        color: #2C3E50;
    }
    
    .bottom-nav .sidebar-footer .user-info-compact svg {
        color: #E67E22;
    }
    
    .bottom-nav .sidebar-footer .footer-bottom {
        color: #95a5a6;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid #e0e0e0;
    }
    
    .app-main {
        margin-bottom: 20px;
    }
}

/* Desktop: Hide sidebar header */
@media (min-width: 769px) {
    .sidebar-header {
        display: none;
    }
}

/* ==================== HELP MODAL STYLES ==================== */
.modal-lg {
    max-width: 600px;
    width: 95%;
    max-height: 85vh;
}

.help-modal-content {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.help-modal-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: linear-gradient(135deg, #E67E22 0%, #F39C12 100%);
    color: white;
}

.help-modal-header .close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    color: white;
    background: rgba(255,255,255,0.2);
}

.help-modal-header .close-btn:hover {
    background: rgba(255,255,255,0.3);
}

.help-header-icon {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.help-modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.help-modal-header p {
    font-size: 13px;
    opacity: 0.9;
}

.help-modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.help-section {
    background: #fafafa;
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid #eee;
    transition: all 0.3s;
}

.help-section:hover {
    border-color: #ddd;
}

.help-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    background: white;
    transition: background 0.3s;
}

.help-section-header:hover {
    background: #f9f9f9;
}

.help-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.help-section-header h3 {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #2C3E50;
}

.help-chevron {
    color: #95a5a6;
    transition: transform 0.3s;
    flex-shrink: 0;
}

.help-section-content.open ~ .help-section-header .help-chevron,
.help-section-header:has(+ .help-section-content.open) .help-chevron {
    transform: rotate(180deg);
}

.help-section-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: white;
}

.help-section-content.open {
    max-height: 500px;
    padding: 4px 16px 16px;
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    border-bottom: 1px solid #f0f0f0;
}

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

.help-emoji {
    font-size: 16px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.help-modal-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.help-modal-footer p {
    font-size: 12px;
    color: #95a5a6;
}

.help-contact {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #E67E22;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.help-contact:hover {
    color: #D35400;
}

/* Help Nav Item Styles */
.help-nav-item {
    position: relative;
}

/* ==================== DARK THEME HELP MODAL ==================== */
[data-theme="dark"] .help-modal-content {
    background: #1e1e1e;
}

[data-theme="dark"] .help-modal-header {
    background: linear-gradient(135deg, #E67E22 0%, #D35400 100%);
}

[data-theme="dark"] .help-section {
    background: #252525;
    border-color: #333;
}

[data-theme="dark"] .help-section:hover {
    border-color: #444;
}

[data-theme="dark"] .help-section-header {
    background: #2a2a2a;
}

[data-theme="dark"] .help-section-header:hover {
    background: #303030;
}

[data-theme="dark"] .help-section-header h3 {
    color: #eee;
}

[data-theme="dark"] .help-section-content {
    background: #2a2a2a;
}

[data-theme="dark"] .help-list li {
    color: #ccc;
    border-bottom-color: #333;
}

[data-theme="dark"] .help-modal-footer {
    background: #252525;
    border-top-color: #333;
}

