:root {
    /* Premium Dark Theme Palette */
    --bg-base: #0f1115;
    --primary: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --secondary: #22d3ee;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Glassmorphism configs */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow: hidden; /* Prevent body scroll, manage in content */
}

/* Base Utility Classes */
.hidden { display: none !important; }
.full-center { display: flex; align-items: center; justify-content: center; height: 100vh; width: 100vw; }
h1, h2, h3 { font-weight: 600; }
a { text-decoration: none; color: inherit; }

/* Glass Panel Reusable Classes */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--glass-shadow);
    padding: 24px;
}

/* Inputs & Buttons */
.input-group {
    position: relative;
    margin-bottom: 20px;
    display: flex;
}
.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.input-group input, .glass-select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 14px 16px 14px 45px;
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    transition: 0.3s ease;
}
.glass-select { padding-left: 16px; } /* no icon for select usually */
.glass-select option { background: var(--bg-base); color: var(--text-main); }
.input-group input:focus, .glass-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.primary-btn:active { transform: scale(0.98); }
.outline-btn {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-main);
}
.text-btn { background: transparent; color: var(--text-muted); margin-top: 10px; }

/* Screens & Views */
.screen { display: none; height: 100vh; height: 100dvh; width: 100vw; flex-direction: column; overflow: hidden;}
.screen.active { display: flex; }
.view { display: none; padding: 20px; overflow-y: auto; height: 100%; width: 100%; }
.view.active { display: block; animation: fadeIn 0.4s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Login Screen Specifics */
.login-box { width: 90%; max-width: 400px; text-align: center; }
.logo-area { margin-bottom: 30px; }
.logo-area i { font-size: 48px; color: var(--primary); margin-bottom: 15px; }
.error-msg { color: #ef4444; font-size: 14px; margin-top: 15px; min-height: 20px;}

/* Header */
.app-header {
    padding: 20px;
    background: rgba(15, 17, 21, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}
.header-content { display: flex; justify-content: space-between; align-items: center; }
#logout-btn { background: transparent; border: none; color: var(--text-muted); font-size: 20px; cursor: pointer; }

/* Library Content */
.filters { margin-bottom: 20px; }
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

/* Book Card */
.book-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.2s;
}
.book-card:active { transform: scale(0.96); }
.book-cover { width: 100%; height: 180px; object-fit: cover; background: #2a2d35; }
.book-cover-placeholder { width: 100%; height: 180px; background: #2a2d35; display:flex; align-items:center; justify-content:center; color: var(--text-muted); font-size: 32px;}
.book-info { padding: 12px; flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 8px;}
.b-title { 
    font-size: 14px; 
    font-weight: 600; 
    line-height: 1.2; 
    display: -webkit-box; 
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; 
    overflow: hidden; 
}
.b-author { font-size: 12px; color: var(--text-muted); }
.b-status { font-size: 12px; display: flex; align-items: center; gap: 5px; cursor: pointer; padding: 4px; border-radius: 6px; background: rgba(0,0,0,0.2); justify-content: center; margin-top: auto;}
.status-read { color: #10b981; }
.status-unread { color: #f59e0b; }

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(15px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    transition: 0.3s;
}
.nav-item i { font-size: 24px; transition: 0.3s ease; }
.nav-item.active { 
    color: var(--primary) !important; 
    text-shadow: 0 0 15px rgba(99, 102, 241, 0.6) !important;
}
.nav-item.active i {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.8)) !important;
}
.nav-item.active span {
    font-weight: 700 !important;
}

/* Scanner Button Glow when Active */
.nav-item.active .scanner-btn-inner {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.8), 0 0 40px rgba(34, 211, 238, 0.4) !important;
    transform: scale(1.05) !important;
}

/* Central Scan Button Float effect */
.scanner-nav-item { position: relative; top: -15px; }
.scan-button {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.5);
    border: 4px solid var(--bg-base);
}

/* Scanner View Elements */
.scanner-container { text-align: center; }
#reader { width: 100%; max-width: 400px; margin: 0 auto 20px; overflow: hidden; border-radius: 12px; }
.text-sep { margin: 20px 0; color: var(--text-muted); font-size: 14px; }
#add-book-form-container { margin-top: 20px; text-align: left; }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-content { width: 90%; max-width: 400px; max-height: 80vh; overflow-y: auto;}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.close-modal { background: none; border: none; color: var(--text-main); font-size: 24px; cursor: pointer; }
.styled-list { list-style: none; margin-bottom: 20px; }
.styled-list li { padding: 12px; border-bottom: 1px solid var(--glass-border); display: flex; justify-content: space-between; align-items: center;}
.styled-list li:last-child { border-bottom: none; }
.divider { border: 0; height: 1px; background: var(--glass-border); margin: 20px 0; }
