:root {
    /* Color Palette - Premium Dark Theme */
    --bg-base: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-card: rgba(30, 41, 59, 0.4);
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.5);
    
    --secondary: #8b5cf6;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --border-light: rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* Effects */
    --glass-blur: blur(12px);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.5;
}

/* Background Animated Shapes */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -150px;
    left: -100px;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: var(--secondary);
    bottom: -200px;
    right: -150px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

/* Main Layout */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-sizing: border-box;
}

/* Header & Logo */
.app-header {
    margin-bottom: 2.5rem;
    width: 100%;
}

.logo-container {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo-container h1 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.logo-container h1 span {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-container p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Glassmorphism Controls */
.controls-glass {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-light);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.search-bar {
    position: relative;
    margin-bottom: 1.5rem;
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: var(--text-muted);
}

.search-bar input {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    padding: 1rem 1rem 1rem 3rem;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Filters Grid */
.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    padding-left: 0.5rem;
}

.filter-group select {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1em;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-group select option {
    background-color: var(--bg-base);
    color: var(--text-main);
}

/* Main Content */
.app-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* States (Loading & Empty) */
.state-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.state-container.hidden {
    display: none;
}

.state-container svg {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.state-container h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.state-container p {
    color: var(--text-muted);
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
    margin-bottom: 1.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* Results Grid */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header.hidden {
    display: none;
}

.results-header h3 {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 500;
}

.download-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--secondary);
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.download-all-btn:hover {
    background: #7c3aed;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.results-grid.hidden {
    display: none;
}

/* Book Card */
.book-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-light);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.4s ease backwards;
}

.book-card:hover {
    transform: translateY(-5px);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.3);
}

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

.book-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.6rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.1);
}

.badge.kurikulum-2023 { background: rgba(59, 130, 246, 0.2); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.badge.kurikulum-2013 { background: rgba(139, 92, 246, 0.2); color: #a78bfa; border: 1px solid rgba(139, 92, 246, 0.3); }
.badge.tipe-guru { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.badge.tipe-siswa { background: rgba(16, 185, 129, 0.2); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

.book-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.book-meta p {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    width: 100%;
}

.download-btn:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
    transform: translateY(-2px);
}

.download-btn svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* Footer */
footer {
    text-align: center;
    padding-top: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .logo-container h1 { font-size: 2.2rem; }
    .controls-glass { padding: 1.5rem; }
    .filters-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .app-container { padding: 1rem; }
    .logo-container h1 { font-size: 1.8rem; }
    .controls-glass { padding: 1.25rem; width: 100%; }
    .filters-grid { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    .results-header { flex-direction: column; align-items: flex-start; }
}
