/* ========================================
   STAPLE - PREMIUM PWA DESIGN SYSTEM
   Clean Architecture - Zero 
   ======================================== */

/* ========================================
   CSS VARIABLEN - THEME SYSTEM
   ======================================== */

:root {
    --brand-rgb: 15, 23, 42;
    --bg-app: #FAF9F6;
    --bg-card: #FFFFFF;
    --text-main: #1A1A1A;
    --text-muted: #717171;
    --radius-card: 2rem;
    --card-border: 1px solid rgba(15, 23, 42, 0.06);
    --card-shadow: 0 12px 40px -15px rgba(0, 0, 0, 0.03);
    
    /* PREMIUM: Glassmorphism Variables */
    --glass-blur: 10px;
    --glass-saturation: 180%;
    --glass-opacity: 0.95;
    
    /* PREMIUM: Spring Physics Timing */
    --spring-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --spring-smooth: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --spring-snappy: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark {
    --brand-rgb: 129, 140, 248;
    --bg-app: #000000;
    --bg-card: #0F172A;
    --text-main: #F1F5F9;
    --text-muted: #94A3B8;
    --card-border: 1px solid rgba(var(--brand-rgb), 0.2);
    --card-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
    
    /* PREMIUM: Dark Mode Glow */
    --glow-intensity: 0.4;
    --glow-spread: 20px;
}

[data-theme="japandi"] {
    --brand-rgb: 138, 154, 91;
    --bg-app: #F2EDE4;
    --bg-card: #F9F7F2;
    --text-main: #32302E;
    --text-muted: #8C857D;
    --radius-card: 1.25rem;
    --card-border: 1.5px solid rgba(138, 154, 91, 0.25);
    --card-shadow: 4px 4px 0px rgba(138, 154, 91, 0.05);
    letter-spacing: -0.01em;
    line-height: 1.6;
    
    /* PREMIUM: Organic Radii (Wabi-Sabi) */
    --radius-organic-1: 1.2rem 1.4rem 1.1rem 1.3rem;
    --radius-organic-2: 1.3rem 1.1rem 1.4rem 1.2rem;
    --radius-organic-3: 1.25rem 1.35rem 1.15rem 1.25rem;
}

/* ========================================
   GLASSMORPHISM 2.0 SYSTEM
   ======================================== */

body .book-card.book-card {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    padding: clamp(0.6rem, 2.5vw, 1rem);
    min-height: 90px;
    max-height: 400px; /* NEU: Verhindert riesige Karten */
    
    /* PREMIUM: Glassmorphism Effect */
    background-color: rgba(var(--brand-rgb), 0.02);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturation));
    
    border: var(--card-border);
    border-radius: var(--radius-card);
    position: relative;
    overflow: hidden;
    
    /* PREMIUM: GPU Acceleration */
    will-change: transform, box-shadow, backdrop-filter;
    transform: translate3d(0, 0, 0);
    
    /* PREMIUM: Spring Physics Transition */
    transition: 
        transform 0.6s var(--spring-smooth), 
        box-shadow 0.4s var(--spring-bounce),
        background-color 0.4s ease,
        border-color 0.4s ease,
        backdrop-filter 0.3s ease;
    
    box-shadow: var(--card-shadow);
    
    /* ⚡ MOBILE PERFORMANCE BOOST */
    contain: layout style paint;
    content-visibility: auto;
    contain-intrinsic-size: auto 200px;
}

/* PREMIUM: Enhanced Glassmorphism on Hover */
@media (hover: hover) {
    .book-card.book-card:hover {
        transform: translateY(-4px) translateZ(0);
        border-color: rgb(var(--brand-rgb));
        box-shadow: 0 12px 24px -8px rgba(var(--brand-rgb), 0.2);
        background-color: rgba(var(--brand-rgb), 0.04);
    }
}

/* PREMIUM: Spring Physics on Active (Touch) */
.book-card.book-card:active {
    transform: scale(0.98) translateY(2px) translateZ(0);
    box-shadow: 0 4px 15px -5px rgba(0,0,0,0.2);
    transition: 
        transform 0.15s var(--spring-snappy),
        box-shadow 0.15s ease;
}

/* PREMIUM: Glass Refraction Edge Effect */
.book-card.book-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%,
        rgba(255, 255, 255, 0.05) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.book-card.book-card:hover::after {
    opacity: 1;
}

/* ========================================
   DARK MODE: NEON GLOW SYSTEM
   ======================================== */

.dark body .book-card.book-card {
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.7), rgba(0, 0, 0, 0.8));
    backdrop-filter: blur(12px) saturate(150%);
    -webkit-backdrop-filter: blur(12px) saturate(150%);
}

/* PREMIUM: Neon Glow on Hover */
.dark .book-card.book-card:hover {
    border-color: rgba(var(--brand-rgb), 0.8);
    box-shadow: 
        0 0 var(--glow-spread) rgba(var(--brand-rgb), var(--glow-intensity)),
        0 0 calc(var(--glow-spread) * 2) rgba(var(--brand-rgb), calc(var(--glow-intensity) * 0.5)),
        0 20px 40px -10px rgba(0, 0, 0, 0.6);
}

/* PREMIUM: Pulsing Glow for Active Cards */
@keyframes neon-pulse {
    0%, 100% { 
        box-shadow: 
            0 0 10px rgba(var(--brand-rgb), 0.3),
            0 0 20px rgba(var(--brand-rgb), 0.2);
    }
    50% { 
        box-shadow: 
            0 0 20px rgba(var(--brand-rgb), 0.5),
            0 0 40px rgba(var(--brand-rgb), 0.3);
    }
}

.dark .book-card.has-review {
    animation: neon-pulse 3s ease-in-out infinite;
}

/* PREMIUM: Dark Mode Ambient Glow */
.dark #ambientAura {
    opacity: 0.35;
    mix-blend-mode: screen;
    filter: blur(80px);
}

/* ========================================
   JAPANDI: ORGANIC WABI-SABI RADII
   ======================================== */

/* PREMIUM: Unregelmäßige, organische Formen */
[data-theme="japandi"] body .book-card.book-card {
    border-radius: var(--radius-organic-1);
    /* Textur entfernt für cleanen Look */
    box-shadow: 
        4px 4px 0px rgba(138, 154, 91, 0.08),
        -1px -1px 0px rgba(255, 255, 255, 0.5) inset;
}

/* Pseudo-Random Organic Radii für verschiedene Cards */
[data-theme="japandi"] .book-card.book-card:nth-child(2n) {
    border-radius: var(--radius-organic-2);
}

[data-theme="japandi"] .book-card.book-card:nth-child(3n) {
    border-radius: var(--radius-organic-3);
}

[data-theme="japandi"] .book-card.book-card:hover {
    transform: translateY(-2px) rotate(0.5deg) translateZ(0);
    box-shadow: 
        6px 6px 0px rgba(138, 154, 91, 0.12),
        -1px -1px 0px rgba(255, 255, 255, 0.6) inset;
}

/* PREMIUM: Organic Avatars (Japandi) */
[data-theme="japandi"] .avatar-item {
    border-radius: 40% 60% 70% 30% / 50% 40% 60% 50%;
    transition: all 0.6s var(--spring-bounce);
}

[data-theme="japandi"] .avatar-item:hover {
    border-radius: 60% 40% 30% 70% / 40% 60% 50% 50%;
    transform: scale(1.1) rotate(5deg);
}

/* ========================================
   DYNAMIC ELEVATION SYSTEM
   ======================================== */

/* PREMIUM: Touch-Responsive Shadows */
body .book-card.book-card {
    --shadow-elevation: 1;
}

.book-card.book-card.touching {
    --shadow-elevation: 3;
    transform: translateY(-8px) scale(1.02) translateZ(0);
    box-shadow: 
        0 calc(20px * var(--shadow-elevation)) calc(40px * var(--shadow-elevation)) calc(-10px * var(--shadow-elevation)) rgba(var(--brand-rgb), 0.2);
    transition: 
        transform 0.2s var(--spring-snappy),
        box-shadow 0.2s var(--spring-snappy);
}

/* ========================================
   SPRING PHYSICS - GLOBAL ANIMATIONS
   ======================================== */

/* PREMIUM: Bouncy Buttons */
button, .icon-btn, .feature-btn {
    transition: 
        transform 0.3s var(--spring-bounce),
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

button:active, .icon-btn:active, .feature-btn:active {
    transform: scale(0.92) translateZ(0);
    transition: transform 0.1s var(--spring-snappy);
}

/* PREMIUM: Spring Entry Animation */
@keyframes spring-in {
    0% {
        opacity: 0;
        transform: translate3d(0, 30px, 0) scale(0.9);
    }
    60% {
        transform: translate3d(0, -5px, 0) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

body .book-card.book-card {
    animation: spring-in 0.6s var(--spring-bounce) backwards;
}

/* Staggered Animation für Liste */
.book-card:nth-child(1) { animation-delay: 0s; }
.book-card:nth-child(2) { animation-delay: 0.05s; }
.book-card:nth-child(3) { animation-delay: 0.1s; }
.book-card:nth-child(4) { animation-delay: 0.15s; }
.book-card:nth-child(5) { animation-delay: 0.2s; }
.book-card:nth-child(n+6) { animation-delay: 0.25s; }

/* PREMIUM: Modal Spring Entry */
body [id*="Modal"] > div {
    animation: modal-spring 0.5s var(--spring-bounce);
}

@keyframes modal-spring {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ========================================
   ICON BUTTONS - RESPONSIVE & SPRING
   ======================================== */

body .icon-btn.icon-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    background-color: transparent;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), 
                background-color 0.2s ease,
                box-shadow 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 10;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.icon-btn.icon-btn:active {
    transform: scale(0.92);
}

@media (hover: hover) {
    .icon-btn.icon-btn:hover {
        background-color: rgba(var(--brand-rgb), 0.08);
        transform: scale(1.1) translateZ(0);
    }
}

/* PREMIUM: Ripple Effect on Touch */
.icon-btn.icon-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle, rgba(var(--brand-rgb), 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s var(--spring-bounce);
}

.icon-btn.icon-btn:active::before {
    opacity: 1;
    transform: scale(1);
    transition: all 0.15s ease-out;
}

/* ========================================
   FEATURE BUTTONS - SPRING PHYSICS
   ======================================== */

body .feature-btn.feature-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    padding: 8px 4px;
    gap: 4px;
    white-space: nowrap;
    border-radius: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
    background-color: transparent; /* Hintergrund komplett weg */
    color: var(--text-muted);
    box-shadow: none; /* Schatten explizit entfernt */
    transition: transform 0.3s var(--spring-smooth), color 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Nur bei echtem Hover (Desktop) oder kurzem Tap (Mobile) */
@media (hover: hover) {
    .feature-btn.feature-btn:hover {
        color: rgb(var(--brand-rgb));
        transform: translateY(-2px);
    }
}

/* Verhindert das "Hängenbleiben" des grauen Schattens nach dem Klick */
.feature-btn.feature-btn:focus,
.feature-btn.feature-btn:active {
    background-color: transparent;
    box-shadow: none;
}

/* ========================================
   NAVIGATION - GLASS & SPRING
   ======================================== */

body nav.nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(var(--brand-rgb), 0.05);
}

nav button.nav-button {
    flex: 0 0 auto;
    white-space: nowrap;
    min-height: 48px;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: 
        transform 0.3s var(--spring-bounce),
        background-color 0.2s ease,
        color 0.2s ease,
        box-shadow 0.2s ease;
}

nav button.nav-button:hover {
    transform: translateY(-2px) translateZ(0);
}

nav button.nav-button.tab-active {
    background-color: rgb(var(--brand-rgb));
    color: #FFFFFF;
    box-shadow: 
        0 4px 12px rgba(var(--brand-rgb), 0.3),
        0 0 0 1px rgba(var(--brand-rgb), 0.2) inset;
    transform: scale(1.05) translateZ(0);
}

nav button.nav-button:active {
    transform: scale(0.95) translateZ(0);
    transition: transform 0.1s var(--spring-snappy);
}

/* ========================================
   BADGES - SPRING & GLOW
   ======================================== */

body .badge-premium.badge-premium {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 2px 7px;
    font-size: 7.5px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.4;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(var(--g-rgb), 0.1);
    color: rgb(var(--g-rgb));
    border: 0.5px solid rgba(var(--g-rgb), 0.3);
    gap: 4px;
    vertical-align: middle;
}

/* DARK MODE: CYBER GLOW */
.dark body .badge-premium.badge-premium {
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(var(--g-rgb), 0.4);
    border-top: 1.5px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 4px rgba(var(--g-rgb), 0.2);
}

/* JAPANDI: WABI-SABI PAPER */
[data-theme="japandi"] body .badge-premium.badge-premium {
    background: #f4f1ea;
    border: none;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.05);
    filter: saturate(0.7);
}

/* Textur entfernt für cleanen Look */

/* JAPANDI SPECIFIC SHAPES */
[data-theme="japandi"] .status-default { 
    clip-path: polygon(0% 0%, 100% 5%, 95% 100%, 5% 95%); 
    border-radius: 0; 
}

[data-theme="japandi"] .status-started { 
    clip-path: polygon(5% 0%, 100% 0%, 100% 100%, 0% 90%); 
    border-radius: 0; 
}

[data-theme="japandi"] .status-read { 
    clip-path: polygon(0% 10%, 95% 0%, 100% 90%, 5% 100%); 
    border-radius: 0; 
}

/* GENRE FARB-INDIZES */
.badge-genre[data-color-index="0"] { --g-rgb: 14, 165, 233; }
.badge-genre[data-color-index="1"] { --g-rgb: 244, 63, 94; }
.badge-genre[data-color-index="2"] { --g-rgb: 168, 85, 247; }
.badge-genre[data-color-index="3"] { --g-rgb: 16, 185, 129; }
.badge-genre[data-color-index="4"] { --g-rgb: 245, 158, 11; }
.badge-genre[data-color-index="5"] { --g-rgb: 236, 72, 153; }
.badge-genre[data-color-index="6"] { --g-rgb: 20, 184, 166; }
.badge-genre[data-color-index="7"] { --g-rgb: 99, 102, 241; }

/* STATUS FARB-MAPPING */
.status-default { --g-rgb: 148, 163, 184; }
.status-read { --g-rgb: 16, 185, 129; }
.status-started { --g-rgb: 245, 158, 11; }
.status-journal { --g-rgb: 99, 102, 241; }

/* DUPLIKAT BADGES - ROT (EXACT) & ORANGE (VERSION) */
.status-duplicate-exact { 
    --g-rgb: 239, 68, 68; /* Rot für exaktes Duplikat */
    background: rgba(239, 68, 68, 0.15);
    color: rgb(239, 68, 68);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-duplicate-version { 
    --g-rgb: 249, 115, 22; /* Orange für andere Version */
    background: rgba(249, 115, 22, 0.15);
    color: rgb(249, 115, 22);
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Dark Mode Optimization für Duplikat-Badges */
.dark .status-duplicate-exact {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.4);
}

.dark .status-duplicate-version {
    background: rgba(249, 115, 22, 0.2);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.4);
}

/* Japandi Theme für Duplikat-Badges */
[data-theme="japandi"] .status-duplicate-exact {
    background: #fee2e2;
    color: #991b1b;
    filter: saturate(0.8);
}

[data-theme="japandi"] .status-duplicate-version {
    background: #ffedd5;
    color: #9a3412;
    filter: saturate(0.8);
}

/* MICRO-PROGRESS BAR (Theme-Aware) */
.badge-premium.badge-premium::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: var(--pg, 0%);
    background: currentColor;
    opacity: 0.8;
    transition: width 0.8s ease;
}

.dark .badge-premium.badge-premium::after { 
    height: 1.5px; 
    box-shadow: 0 0 5px currentColor; 
}

[data-theme="japandi"] .badge-premium.badge-premium::after { 
    height: 3px; 
    opacity: 0.4; 
}

/* Scroll-Hiding */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

@keyframes pulse-glow-amber {
    0%, 100% { box-shadow: 0 0 5px rgba(251, 191, 36, 0.1); }
    50% { box-shadow: 0 0 15px rgba(251, 191, 36, 0.3); }
}

.badge-sm:hover {
    transform: scale(1.1) translateZ(0);
}

/* PREMIUM: Glow Badges in Dark Mode */
.dark .badge-sm {
    box-shadow: 0 0 8px rgba(var(--brand-rgb), 0.3);
}

/* ========================================
   HEART BUTTON - PREMIUM ANIMATION
   ======================================== */

.heart-btn {
    transition: transform 0.3s var(--spring-bounce);
}

.heart-btn:hover {
    transform: scale(1.15) translateZ(0);
}

.heart-btn:active {
    transform: scale(0.9) translateZ(0);
}

.heart-btn svg {
    transition: 
        fill 0.3s var(--spring-bounce),
        stroke 0.3s var(--spring-bounce),
        transform 0.3s var(--spring-bounce);
}

.heart-active {
    fill: #f43f5e;
    stroke: #f43f5e;
}

.heart-inactive {
    fill: none;
    stroke: #94a3b8;
}

/* PREMIUM: Heart Pop Animation */
@keyframes heart-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(-10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.heart-btn.just-favorited svg {
    animation: heart-pop 0.5s var(--spring-bounce);
}

/* ========================================
   ACCESSIBILITY - REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
        scroll-behavior: auto;
    }
    
    .book-card,
    button,
    .icon-btn,
    .feature-btn {
        transition: none;
        animation: none;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

.book-card,
.icon-btn,
.feature-btn,
nav button,
.heart-btn {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

body #bookList:not(.hidden) {
    min-height: 400px;
    contain: layout style paint;
    content-visibility: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-content: start;
}

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

html {
    font-size: clamp(14px, 2.5vw, 16px);
}

h1, .text-4xl, .text-6xl {
    font-size: clamp(2rem, 8vw, 3.75rem);
    line-height: 1.1;
}

h2, .text-3xl {
    font-size: clamp(1.5rem, 5vw, 1.875rem);
    line-height: 1.2;
}

h3, .text-2xl {
    font-size: clamp(1.4rem, 4vw, 1.75rem);
    line-height: 1.3;
}

button, input, select, textarea {
    font-size: clamp(0.875rem, 2vw, 1rem);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    transition: background-color 0.5s ease, color 0.5s ease;
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

.serif {
    font-family: 'Playfair Display', serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.bg-appBg { background-color: var(--bg-app); }
.bg-cardBg { background-color: var(--bg-card); }
.text-textMain { color: var(--text-main); }
.bg-brand { background-color: rgb(var(--brand-rgb)); color: #ffffff; }
.rounded-custom { border-radius: var(--radius-card); }

button, a {
    -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
    font-size: 16px;
}

:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ========================================
   THEME SPECIFICS
   ======================================== */

[data-theme="japandi"] .shadow-xl {
    box-shadow: 0 20px 40px -15px rgba(138, 154, 91, 0.08);
}

[data-theme="japandi"] body {
    font-weight: 300;
    letter-spacing: 0.01em;
}

[data-theme="japandi"] .serif {
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #1a1a1a;
}

[data-theme="japandi"] :focus-visible {
    outline: 2px solid rgb(var(--brand-rgb) / 0.3);
    outline-offset: 2px;
}

[data-theme="japandi"] ::-webkit-scrollbar {
    width: 6px;
}

[data-theme="japandi"] ::-webkit-scrollbar-thumb {
    background: rgb(var(--brand-rgb) / 0.2);
    border-radius: 10px;
}

/* Textur entfernt für cleanen Look */
/*
html[data-theme="japandi"]::before {
    content: "";
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("https://www.transparenttextures.com/patterns/stardust.png");
    mix-blend-mode: multiply;
}
*/

/* Verhindert das Scrollen des Hintergrunds wenn Modal offen */
html body.modal-open {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* 1. Basis: Grundsätzlich unsichtbar */
body [id*="Modal"] {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 10000;
    position: fixed;
    inset: 0;
    /* Senior-Fix: Einheitlicher Premium-Backdrop für alle Modals */
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
}

/* 2. Sichtbar: Wenn .flex vorhanden ist */
[id*="Modal"].flex {
    display: flex;
}

/* 3. Sicherung: Wenn .hidden vorhanden ist, IMMER weg (höchste Klassen-Spezifität) */
[id*="Modal"].hidden {
    display: none;
}

body [id*="Modal"] > div {
    background-color: var(--bg-card);
    /* Senior-Fix: Nutze die weiche Design-Variable statt fixer Werte */
    border: var(--card-border);
    max-height: 90dvh;
    width: 100%;
    max-width: 32rem; /* max-w-lg Entsprechung */
    border-radius: 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    position: relative;
}

[data-theme="japandi"] .tab-active {
    color: rgb(var(--brand-rgb));
    background-color: transparent;
}

.book-card p.text-slate-500.italic {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-style: normal;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 0.5rem; /* Gleicher Abstand wie zwischen Titel und Autor */
}

/* ISBN/Jahr auch mit gleichem Abstand */
.book-card p.font-mono {
    margin-top: 0.5rem;
}

/* ========================================
   BOOK CARD LAYOUT
   ======================================== */

.book-card-grid {
    display: grid;
    grid-template-columns: 75px 1fr; 
    gap: 12px;
    align-items: flex-start; 
    width: 100%;
}

.cover-container {
    width: 85px;
    aspect-ratio: 2/3;
    border-radius: 0.5rem;
    position: relative;
    background: rgba(var(--brand-rgb), 0.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    flex-shrink: 0;
    margin-top: 1px;
}

@media (min-width: 640px) {
    body .book-card.book-card {
        padding: 1.25rem;
    }
    .book-card-grid {
        grid-template-columns: 95px 1fr;
        gap: 0.75rem;
    }
}

@media (min-width: 1024px) {
    body .book-card.book-card {
        padding: 1.5rem;
    }
    .book-card-grid {
        grid-template-columns: 120px 1fr;
        gap: 1rem;
    }
}

.book-card-grid > div:first-child {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 75px;
}

.book-card-grid img {
    width: 75px;
    height: 112px;
    object-fit: cover;
    border-radius: 0.375rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.book-card h3 {
    font-size: 1.125rem; /* Größer: ca. 18px */
    font-weight: 700;
    line-height: 1.3;
}

@media (min-width: 640px) {
    .book-card-grid > div:first-child {
        width: 95px;
    }
    
    .book-card-grid img {
        width: 95px;
        height: 142px;
    }
    
    .book-card h3 {
        font-size: 1.25rem; /* ca. 20px */
    }
}

@media (min-width: 1024px) {
    .book-card-grid > div:first-child {
        width: 120px;
    }
    
    .book-card-grid img {
        width: 120px;
        height: 180px;
    }
    
    .book-card h3 {
        font-size: 1.5rem; /* ca. 24px */
    }
}

.book-cover {
    aspect-ratio: 2/3;
    width: 100%;
    height: auto;
    object-fit: cover;
    background-color: rgba(var(--brand-rgb), 0.05);
    content-visibility: auto;
    contain-intrinsic-size: 1px 150px;
}

[data-theme="japandi"] .book-card-grid > div:first-child img {
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

[data-theme="japandi"] .book-card-grid:hover > div:first-child img {
    border-radius: 4px;
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

[data-theme="japandi"] .book-card-grid > div:first-child {
    position: relative;
    perspective: 1000px;
}

[data-theme="japandi"] .book-card-grid img {
    border-radius: 2px 4px 4px 2px;
    border-left: 3px solid rgba(0,0,0,0.05);
    box-shadow: 
        1px 0 0 rgba(255,255,255,0.2) inset,
        5px 5px 15px rgba(0,0,0,0.1);
}

/* ========================================
   FEATURE BAR & BUTTONS
   ======================================== */

.feature-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    margin-top: 0.4rem;
    margin-bottom: 0;
    min-height: 44px;
    align-items: center;
}

@media (min-width: 640px) {
    .feature-bar {
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    body .feature-btn.feature-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.875rem;
    }
    
    .badge-sm {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
    }
}

@media (min-width: 1024px) {
    .feature-bar {
        gap: 0.75rem;
    }
    
    body .feature-btn.feature-btn {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
    }
}

/* ========================================
   TOUCH TARGETS
   ======================================== */

button, a, input, select {
    min-height: 48px;
    min-width: 48px;
}

.book-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    min-height: 48px;
}

@media (min-width: 640px) {
    .book-actions {
        gap: 0.75rem;
    }
}

/* ========================================
   GENRE COLORS
   ======================================== */

.spine-color-0 { background-color: #8A9A5B; }
.spine-color-1 { background-color: #C04000; }
.spine-color-2 { background-color: #D4A373; }
.spine-color-3 { background-color: #6B705C; }
.spine-color-4 { background-color: #A5A58D; }

[data-theme="japandi"] .book-spine {
    border-radius: 4px 2px 2px 4px;
    border-left: 2px solid rgba(0,0,0,0.1);
}

.book-spine {
    width: 100%;
    border-radius: 2px;
    margin-bottom: 1px;
    box-shadow: inset 2px 0 5px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.genre-0 { background-color: #8A9A5B; color: white; }
.genre-1 { background-color: #C04000; color: white; }
.genre-2 { background-color: #D4A373; color: white; }
.genre-3 { background-color: #6B705C; color: white; }
.genre-4 { background-color: #A5A58D; color: white; }
.genre-5 { background-color: #B5838D; color: white; }
.genre-6 { background-color: #4A4E69; color: white; }
.genre-7 { background-color: #997B66; color: white; }

/* ========================================
   JAPANDI BUTTONS
   ======================================== */

[data-theme="japandi"] .btn-primary {
    background: transparent;
    border: 1px solid var(--text-main);
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.75rem;
    padding: 0.75rem 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="japandi"] .btn-primary:hover {
    background: var(--text-main);
    color: var(--bg-app);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

[data-theme="japandi"] .badge {
    background: rgba(var(--brand-rgb), 0.1);
    color: rgb(var(--brand-rgb));
    border: 0.5px solid rgba(var(--brand-rgb), 0.2);
    font-weight: 500;
    font-size: 0.7rem;
}

[data-theme="japandi"] #visualProgressBar {
    background-color: rgb(var(--brand-rgb));
    box-shadow: 0 0 15px rgb(var(--brand-rgb) / 0.3);
}

[data-theme="japandi"] .empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #a0a0a0;
    font-style: italic;
}

[data-theme="japandi"] .zen-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.3;
}


[data-theme="japandi"] #ambientAura {
    opacity: 0.12;
    mix-blend-mode: multiply;
}

/* ========================================
   SKELETONS & LOADING
   ======================================== */

.skeleton-card {
    height: 140px;
    background: linear-gradient(90deg, 
        var(--bg-card) 25%, 
        rgba(var(--brand-rgb), 0.08) 50%, 
        var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.4s infinite;
    border-radius: var(--radius-card);
    margin-bottom: 1.5rem;
    border: var(--card-border);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.book-cover-skeleton {
    aspect-ratio: 2/3;
    background: linear-gradient(
        90deg,
        rgba(79, 70, 229, 0.05) 25%,
        rgba(79, 70, 229, 0.1) 50%,
        rgba(79, 70, 229, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark .book-cover-skeleton {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.06) 50%,
        rgba(255, 255, 255, 0.03) 75%
    );
}

@keyframes pulse-japandi {
    0% { background-color: #eeeae3; }
    50% { background-color: #e2ddd3; }
    100% { background-color: #eeeae3; }
}

[data-theme="japandi"] .skeleton {
    animation: pulse-japandi 2s infinite ease-in-out;
    border-radius: 4px;
}

/* ========================================
   Z-INDEX LAYERING
   ======================================== */

:root { 
    --z-nav: 50; 
    --z-modal-bg: 100; 
    --z-modal-content: 110; 
    --z-toast: 200; 
}

nav { z-index: var(--z-nav); }
body [id*="Modal"] { z-index: var(--z-modal-bg); }
#aiFloatingWindow { z-index: var(--z-nav); }
#confirmModal { z-index: var(--z-toast); }

#ambientAura {
    will-change: background;
    transform: translateZ(0);
}

/* ========================================
   RANKING COMPONENTS
   ======================================== */

body .ranking-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 12px;
    padding: clamp(0.6rem, 2.5vw, 1rem);
    min-height: 140px;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    contain: content;
    box-sizing: border-box;
}

body .ranking-cover-box {
    width: 75px;
    flex-shrink: 0;
    position: relative;
}

body .ranking-info-box {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-right: 0.5rem;
}

.ranking-action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 8px;
}

.ranking-heart-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
    border-radius: 50%;
    transition: transform 0.2s ease;
}

.ranking-heart-btn:active { 
    transform: scale(0.9); 
}

.ranking-mood-chip {
    font-size: 7px;
    padding: 2px 6px;
    background: rgba(var(--brand-rgb), 0.05);
    color: rgb(var(--brand-rgb));
    border: 1px solid rgba(var(--brand-rgb), 0.1);
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* STATISTIK TAB NAVIGATION FIX */
.stats-tab-nav {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.5rem;
}

.stats-tab-nav::-webkit-scrollbar {
    display: none;
}

.stats-tab-nav button {
    flex: 0 0 auto;
    white-space: nowrap;
    min-width: fit-content;
    padding: 0.75rem 1.5rem;
}

#commTabSocial, #commTabRoadmap {
    min-width: 120px;
    flex: 1;
    text-align: center;
}

/* ========================================
   AVATAR SYSTEM
   ======================================== */

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(55px, 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
}

.avatar-selected { 
    border-color: rgb(var(--brand-rgb)); 
    background: rgba(var(--brand-rgb), 0.15); 
}

/* ========================================
   CREW ACCORDION
   ======================================== */

.crew-accordion {
    display: grid;
    grid-template-rows: 0fr;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    visibility: hidden;
    opacity: 0;
    overflow: hidden;
}

.crew-accordion.is-open {
    grid-template-rows: 1fr;
    visibility: visible;
    opacity: 1;
    margin-top: 1rem;
}

.crew-accordion-inner {
    overflow: hidden;
}

.crew-toggle-btn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: var(--bg-card);
    border-radius: 1.25rem;
    border: 1px solid rgba(var(--brand-rgb), 0.1);
    transition: all 0.2s ease;
}

.crew-toggle-btn:active {
    transform: scale(0.97);
}

.crew-arrow {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
}

.is-open-arrow {
    transform: rotate(180deg);
}

/* ========================================
   SOCIAL CARDS
   ======================================== */

.social-invite-card {
    background: linear-gradient(135deg, rgb(79, 70, 229), rgb(124, 58, 237));
    color: white;
}

.social-invite-subtitle { 
    color: rgba(255, 255, 255, 0.8); 
}

[data-theme="japandi"] .social-invite-card {
    background: var(--bg-card);
    border: var(--card-border);
    color: var(--text-main);
}

[data-theme="japandi"] .social-invite-subtitle { 
    color: var(--text-muted); 
}

.dark .social-invite-card {
    background: linear-gradient(135deg, #1e1b4b, #000000);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   FALLBACKS
   ======================================== */

.fallback-cover {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    color: #475569;
    text-align: center;
    height: 100%;
    width: 100%;
    border-radius: inherit;
}

[data-theme="japandi"] .fallback-cover {
    background: var(--bg-app);
    color: var(--text-muted);
    border: 1px dashed var(--border-color);
}

.dark .fallback-cover {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    color: #94a3b8;
}

/* ========================================
   SCAN RESULTS
   ======================================== */

body #scanResultsList:not(.hidden) {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    padding-right: 8px;
}

#scanResultsList::-webkit-scrollbar {
    width: 6px;
}

#scanResultsList::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-rgb), 0.3);
    border-radius: 10px;
}

@media (max-width: 480px) {
    #scanResultsList {
        grid-template-columns: 1fr;
    }
}

.ambiguous-card {
    border-left: 4px solid #fbbf24;
}

#scanner-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1.5rem;
}

/* ========================================
   MISC
   ======================================== */

.flex.flex-col .overflow-x-auto {
    padding-bottom: 4px;
    margin-bottom: -4px;
}

body .book-card.book-card {
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), 
                box-shadow 0.3s ease, 
                ring-width 0.3s ease;
}

.book-card:hover .opacity-40, 
.book-card:active .opacity-40 {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.book-card p.font-mono {
    display: block;
}

/* ========================================
   PREMIUM QUOTE SYSTEM 2.0
   ======================================== */

.quote-card-wrapper {
    perspective: 1000px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.05));
}

.quote-card {
    position: relative;
    background: #ffffff;
    background-image: radial-gradient(#e5e7eb 1.2px, transparent 1.2px);
    background-size: 24px 24px;
    border-radius: 12px;
    border-left: 4px solid rgb(var(--brand-rgb));
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}

.quote-icon-mark {
    position: absolute;
    top: -10px;
    left: 15px;
    font-size: 4rem;
    font-family: 'Playfair Display', serif;
    opacity: 0.08;
    pointer-events: none;
}

.dark .quote-card {
    background: rgba(15, 23, 42, 0.6);
    background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), 
                      linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(var(--brand-rgb), 0.3);
    border-left: 4px solid rgb(var(--brand-rgb));
    box-shadow: 0 0 15px rgba(var(--brand-rgb), 0.1), 
                inset 0 0 20px rgba(0,0,0,0.2);
}

[data-theme="japandi"] .quote-card {
    background: #fdfcfb;
    /* Textur entfernt für cleanen Look */
    border: none;
    border-radius: 2px 15px 4px 12px / 15px 3px 12px 4px;
    box-shadow: 5px 5px 0px #e8e4df;
}

[data-theme="japandi"] .quote-decoration {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 45px;
    height: 18px;
    background: rgba(var(--brand-rgb), 0.15);
    clip-path: polygon(10% 0%, 90% 0%, 100% 100%, 0% 100%);
    backdrop-filter: blur(2px);
    border: 1px solid rgba(255,255,255,0.1);
}

.quote-tag {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    opacity: 0.6;
}

.quote-action-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(var(--brand-rgb), 0.05);
    color: rgb(var(--brand-rgb));
    border: 1px solid rgba(var(--brand-rgb), 0.1);
}

.dark .quote-action-btn { 
    background: rgba(255,255,255,0.05); 
    border-color: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.quote-action-btn.edit:hover { 
    background: #3b82f6; 
    color: white; 
}

.quote-action-btn.copy:hover { 
    background: rgb(var(--brand-rgb)); 
    color: white; 
}

.quote-action-btn.delete:hover { 
    background: #ef4444; 
    color: white; 
}

.book-card-title {
    font-size: clamp(1.3rem, 5.5vw, 1.8rem); 
    margin-bottom: 0;
    white-space: nowrap;
    display: block;
    letter-spacing: -0.03em;
    line-height: 1.05; /* Extrem eng für Premium-Look */
}

.book-card-author {
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    color: var(--text-muted);
    opacity: 0.8;
    font-style: italic;
    margin-top: -1px;
}

.book-card-meta {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.6;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-label {
    font-size: 7px;
    opacity: 0.7;
    font-weight: 800;
}

.meta-sep {
    color: var(--brand-rgb);
    opacity: 0.3;
    font-weight: 200;
}

/* Optional: Falls der Autor auch mitwachsen soll */
.book-card p.text-slate-500 {
    font-size: clamp(0.8rem, 3vw, 0.95rem);
}

/* ========================================
   COLLAPSIBLE ACTIONS ANIMATION
   ======================================== */

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

.animate-slide-down {
    animation: slide-down 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 💎 HIGH CLASS RATING BADGES (Borderless Tint) */
.badge-rating-tint {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.6rem;
    font-weight: 800;
    font-size: 10px;
    border: none;
    transition: transform 0.2s ease;
}

.rating-high { color: #059669; background-color: rgba(16, 185, 129, 0.12); }
.rating-mid  { color: #d97706; background-color: rgba(245, 158, 11, 0.12); }
.rating-low  { color: #e11d48; background-color: rgba(244, 63, 94, 0.12); }

/* Dark Mode Optimization */
.dark .rating-high { color: #34d399; background-color: rgba(52, 211, 153, 0.15); }
.dark .rating-mid  { color: #fbbf24; background-color: rgba(251, 191, 36, 0.15); }
.dark .rating-low  { color: #fb7185; background-color: rgba(251, 113, 133, 0.15); }

/* ========================================
   PREMIUM REVIEW MODAL OVERHAUL (No )
   ======================================== */

/* EDITORIAL REVIEW VIEW */
#reviewViewMode #scoreOrbit {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

#reviewViewMode #viewOneLiner {
    font-display: swap;
    text-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

#reviewEditMode #modalReviewOneLiner {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.4rem;
    padding: 1rem;
    transition: all 0.3s ease;
}

.review-score-container {
    background: rgba(var(--brand-rgb), 0.03);
    border: 1px solid rgba(var(--brand-rgb), 0.08);
    padding: 1.5rem;
    border-radius: 2rem;
    transition: all 0.4s var(--spring-smooth);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.dark .review-score-container {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Floating Action Bar Styling */
.review-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 2rem;
    margin-top: 1rem;
}

.btn-elite-save {
    background: rgb(var(--brand-rgb));
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    box-shadow: 0 10px 25px -5px rgba(var(--brand-rgb), 0.4);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-elite-cancel {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.btn-elite-cancel:hover {
    opacity: 1;
}

.utility-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(var(--brand-rgb), 0.05);
    color: rgb(var(--brand-rgb));
    transition: all 0.2s ease;
}

/* Morph Animation */
.animate-fade-in {
    animation: fadeInScale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Custom Mood Input Styling */
#newModalMoodInput {
    border: 1px solid transparent;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#newModalMoodInput:focus {
    width: 240px; /* Expands slightly on focus */
    background-color: rgba(var(--brand-rgb), 0.1);
    transform: translateX(-20px); /* Center adjustment for expansion */
}

.dark #newModalMoodInput:focus {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Hover-Effekt für Chips im Modal */
#modalMoodChipsContainer .mood-chip:hover {
    transform: translateY(-2px);
}

/* PREMIUM MOOD INPUT */
#newModalMoodInput {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
}

#newModalMoodInput::placeholder {
    color: var(--text-muted);
    opacity: 0.4;
}

#reviewModal #modalMoodChipsContainer {
    min-height: 40px; /* Verhindert Layout-Jumping */
}

/* Dezentere Anzeige im View-Mode */
#viewMoodContainer .flex {
    background: rgba(var(--brand-rgb), 0.03);
    padding: 0.4rem 0.8rem;
    border-radius: 99px;
}

#newGenreNameInput::placeholder {
    font-weight: 400;
    opacity: 0.3;
}

#genreInputModal .bg-cardBg {
    max-height: 80vh;
}

/* ========================================
   ALIEN TWIN 2.0 - OMNISCIENT DESIGN
   ======================================== */

/* 1. Basis Chat Bubbles */
#twinChatArea .bg-white, 
#twinChatArea .bg-slate-900 {
    position: relative;
    border-left: 4px solid #6366f1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark #twinChatArea .bg-slate-900 {
    border-left-color: #818cf8;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

/* 2. DNA Profil Analyse Box */
#twinChatArea .bg-gradient-to-r {
    backdrop-filter: blur(10px);
    box-shadow: inset 0 0 20px rgba(255,255,255,0.05), 0 8px 32px rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.dark #twinChatArea .bg-gradient-to-r {
    background: linear-gradient(to right, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.08));
    border-color: rgba(129, 140, 248, 0.2);
}

#twinChatInput:focus {
    background-color: var(--bg-card);
    box-shadow: 0 8px 20px -10px rgba(var(--brand-rgb), 0.3);
}

/* Premium Button Integration */
#readingTwinModal button[type="submit"] {
    background: linear-gradient(135deg, rgb(var(--brand-rgb)), #818cf8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#readingTwinModal button[type="submit"]:active {
    transform: scale(0.9) translateZ(0);
}

/* 4. Intelligence Glow & Scan Animations */
#twinChatArea .animate-fade-in:last-child .bg-white,
#twinChatArea .animate-fade-in:last-child .bg-slate-900 {
    animation: intelligence-scan 2.5s ease-in-out forwards;
}

@keyframes intelligence-scan {
    0% { border-left-color: #6366f1; filter: brightness(1); }
    50% { border-left-color: #a855f7; filter: brightness(1.15); box-shadow: 0 0 25px rgba(99, 102, 241, 0.3); }
    100% { border-left-color: #6366f1; filter: brightness(1); }
}

@keyframes alien-float {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

#readingTwinModal .animate-bounce {
    animation: alien-float 4s ease-in-out infinite;
}

/* Mobile-Safe Scroll Behavior */
#twinChatArea {
    overscroll-behavior: contain;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Verhindert den blauen Rahmen in der Unified Search Bar */
#aiQuickInputField:focus {
    outline: none;
    box-shadow: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
}

/* Verhindert Layout-Shift beim Tippen */
#formSection .group:focus-within {
    border-color: rgba(var(--brand-rgb), 0.3);
}

/* === ROADMAP & ADMIN PREMIUM UI === */
.roadmap-filter-btn {
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    background: var(--bg-card);
    color: var(--text-muted);
    border: var(--card-border);
    box-shadow: var(--card-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.roadmap-filter-btn.active-filter {
    background: rgb(var(--brand-rgb));
    color: #ffffff;
    border-color: rgb(var(--brand-rgb));
    box-shadow: 0 10px 20px -5px rgba(var(--brand-rgb), 0.4);
    transform: translateY(-1px);
}

/* === ELITE ROADMAP CARD SYSTEM === */
.roadmap-card {
    background-color: var(--bg-card);
    border: var(--card-border) !important;
    box-shadow: var(--card-shadow);
    transition: all 0.4s var(--spring-smooth);
}

.roadmap-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--brand-rgb), 0.4) !important;
}

/* Subtiler "Mehr lesen" Button */
.btn-read-more {
    font-size: 9px !important;
    font-weight: 900 !important;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgb(var(--brand-rgb));
    opacity: 0.6;
    padding: 4px 0;
    transition: all 0.2s ease;
    background: transparent;
    border: none;
    min-width: auto;
    min-height: auto;
}

.btn-read-more:hover {
    opacity: 1;
    letter-spacing: 0.2em;
}

/* Status Badges in der Roadmap */
.roadmap-badge {
    font-size: 8px !important;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-action-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.25rem;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid transparent;
}
.admin-action-btn.delete { background: rgba(244, 63, 94, 0.1); color: #e11d48; }
.admin-action-btn.approve { background: rgba(16, 185, 129, 0.1); color: #059669; }

/* === PREMIUM PRIVACY TOGGLES (iOS Style) === */
.privacy-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    background: rgba(var(--brand-rgb), 0.04);
    border-radius: 1.5rem;
    border: 1px solid rgba(var(--brand-rgb), 0.08);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    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: #e2e8f0;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input:checked + .toggle-slider { background-color: rgb(var(--brand-rgb)); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* === INVITE INPUT FIX === */
.social-invite-input-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 1.25rem;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* === UNIFIED SEARCH BAR PREMIUM FIX === */

/* 1. Fix für das weiße Feld (Eingabehintergrund) */
#aiQuickInputField {
    background-color: transparent;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}

/* Verhindert weißes Feld bei Autocomplete (Chrome/Safari) */
#aiQuickInputField:-webkit-autofill,
#aiQuickInputField:-webkit-autofill:hover, 
#aiQuickInputField:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-main);
    -webkit-box-shadow: 0 0 0px 1000px var(--bg-card) inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* 2. KI-Button (Links) Optimierung */
#aiQuickAddBtn {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--spring-smooth);
    white-space: nowrap;
    padding: 0 0.5rem;
    min-width: 44px;
    color: rgb(var(--brand-rgb));
}

/* Wenn die KI sucht (Text-Modus) */
#aiQuickAddBtn:has(span) {
    background: rgba(var(--brand-rgb), 0.1);
    border-radius: 1rem;
    margin-right: 0.5rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

/* 3. Fokus-Zustand der gesamten Bar */
/* Fokus-Effekt nur für die Suchleiste, nicht für Buchkarten */
#formSection .group:focus-within {
    background-color: var(--bg-card);
    border-color: rgba(var(--brand-rgb), 0.4);
}

/* Buchkarten behalten ihre Ruhe beim Aufklappen */
.book-card.group:focus-within {
    box-shadow: var(--card-shadow);
    background-color: var(--bg-card);
}

/* === FRIEND PROFILE PREMIUM UI === */
.friend-nav-btn {
    padding: 0.6rem 1.25rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.friend-nav-btn.active {
    background: rgb(var(--brand-rgb));
    color: #ffffff;
    box-shadow: 0 8px 16px -4px rgba(var(--brand-rgb), 0.4);
    transform: translateY(-1px);
}

.friend-nav-btn:not(.active):hover {
    background: rgba(var(--brand-rgb), 0.05);
    color: rgb(var(--brand-rgb));
}

/* === STAPLE ELITE QUOTE SYSTEM (ZERO-BORDER) === */
/* Senior-Fix: Einheitliche Elite Designsprache für maximale Konsistenz */
.elite-input-row, 
#bookForm input, 
#bookForm select, 
#bookForm textarea,
.review-card input,
.review-card select {
    background: rgba(var(--brand-rgb), 0.04);
    border: none;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.dark .elite-input-row {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.2);
}

/* Fokus-Zustand: Nur die Fläche wird minimal heller, kein Rahmen! */
.elite-input-row:focus-within {
    background: rgba(var(--brand-rgb), 0.06);
    box-shadow: 0 10px 25px -10px rgba(var(--brand-rgb), 0.15);
    transform: translateY(-1px);
}

.dark .elite-input-row:focus-within {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 15px 30px -10px rgba(0, 0, 0, 0.4);
}

/* Alle Standard-Browser-Rahmen für Inputs im Modal entfernen */
#quoteModal input, 
#quoteModal textarea {
    border: none;
    outline: none;
    box-shadow: none;
    background: transparent;
    -webkit-appearance: none;
}

/* === ELITE STAPLE LOGO - BLUEPRINT SYSTEM === */
.blueprint-logo {
    display: inline-block;
    vertical-align: middle;
    overflow: visible;
    flex-shrink: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.blueprint-logo .book-obj rect {
    stroke: currentColor;
    stroke-width: 1.2;
    fill: none;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.blueprint-logo .detail-line {
    stroke: currentColor;
    stroke-width: 0.8;
    opacity: 0.2;
    stroke-dasharray: 10;
    stroke-dashoffset: 10;
    transition: all 0.4s ease;
}

.blueprint-logo .b-1 { opacity: 0.3; }
.blueprint-logo .b-2 { opacity: 0.6; }
.blueprint-logo .b-3 { opacity: 1; }

/* Elite Hover Interaction */
.group:hover .blueprint-logo {
    transform: scale(1.05) rotate(-2deg);
}

.group:hover .blueprint-logo .book-obj rect {
    stroke-width: 2;
}

.group:hover .blueprint-logo .detail-line {
    opacity: 0.6;
    stroke-dashoffset: 0;
    animation: blueprint-draw 1s ease forwards;
}

@keyframes blueprint-draw {
    to { stroke-dashoffset: 0; }
}

#scoreOrbit {
    border-color: rgba(var(--brand-rgb), 0.1);
    box-shadow: 0 0 40px rgba(var(--brand-rgb), 0.05);
    background: radial-gradient(circle at center, rgba(var(--brand-rgb), 0.02) 0%, transparent 70%);
}

.dark #scoreOrbit {
    background: radial-gradient(circle at center, rgba(var(--brand-rgb), 0.1) 0%, transparent 70%);
}

/* JAPANDI FLOATING NAV STYLES */
.floating-nav-container {
    position: fixed;
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    z-index: 9999;
    pointer-events: none; /* Klicks gehen durch den Container... */
}

.floating-nav-island {
    pointer-events: auto; /* ...aber nicht durch die Insel selbst */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: rgba(var(--bg-card-rgb, 255, 255, 255), 0.75);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border-radius: 2.5rem;
    border: 1px solid rgba(var(--brand-rgb), 0.15);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s var(--spring-smooth);
}

[data-theme="japandi"] .floating-nav-container {
    background-color: transparent;
}

[data-theme="japandi"] .floating-nav-island {
    background-color: var(--bg-card);
    border: 1.5px solid rgba(138, 154, 91, 0.25);
    box-shadow: 4px 4px 0px rgba(138, 154, 91, 0.05);
}

[data-theme="japandi"] .nav-item.tab-active {
    background-color: rgba(138, 154, 91, 0.1);
    color: rgb(138, 154, 91);
}

.nav-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--text-muted);
    transition: all 0.3s var(--spring-smooth);
    background: transparent;
    padding: 0; /* WICHTIG: Verhindert das Stauchen des Icons */
    flex-shrink: 0;
}

#floatingNav .floating-nav-island .nav-item svg {
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: block;
    transition: transform 0.3s var(--spring-smooth);
}

/* Subtiler Effekt: Das aktive Icon wird noch ein Stück größer */
.nav-item.tab-active svg {
    transform: scale(1.1);
}

.nav-item.tab-active {
    background-color: rgb(var(--brand-rgb));
    color: #ffffff;
    box-shadow: 0 8px 20px -4px rgba(var(--brand-rgb), 0.4);
    transform: scale(1.1) translateY(-2px);
}

/* Verhindert, dass Content unter der Nav verschwindet */
#appSection {
    padding-bottom: 120px;
}

/* PULSE FEEDBACK ANIMATION */
@keyframes nav-item-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); filter: brightness(1.2); }
    100% { transform: scale(1); }
}

.nav-pulse-active {
    animation: nav-item-pulse 0.5s var(--spring-bounce);
}

/* ULTRA-DEZENTER TOGGLE */
/* Erhöhte Spezifität überschreibt globale Button-Regeln ohne  */
#formSection #minimizeFormBtn {
    background: transparent;
    border: none;
    box-shadow: none;
    min-height: 0;
    min-width: 0;
    padding: 0;
}

#minimizeFormBtn span {
    border-bottom: 1px solid transparent;
}

#minimizeFormBtn:hover span {
    border-bottom-color: currentColor;
}

/* === BASELINE & LAYOUT ENGINE === */

/* ⚡ Unified Layout Engine: Alle aktiven Sektionen rücken exakt gleich auf */
#appSection > div > section:not(.hidden),
#appSection > div > div:not(.hidden) {
    margin-top: 1.5rem;
    position: relative;
    z-index: 10;
}

/* Spezialfall Journal/Statistik: Wenn das erste Element (Suche) wegfällt, rückt der Nachfolger auf */
#formSection.hidden + #listsSection,
#listsSection.hidden ~ #statsSection {
    margin-top: 1.5rem;
}

/* In der Bibliothek klebt die Liste direkt (0px) an der Suche */
body #listsSection {
    margin-top: 0;
    position: relative;
    z-index: 10;
}

/* 4. Innere Container (WICHTIG: :not(.hidden) verhindert, dass sie überall auftauchen!) */
body #communitySection:not(.hidden), 
body #rankingContainer:not(.hidden) {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-top: 0;
}

/* Titel-Größe wird nun einheitlich über .tab-header-title gesteuert */

/* Filter-Button optisch anpassen für die kompakte Zeile */
#listsSection button[onclick*="toggleFilterSection"] {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* SIDE TWIN DOCK - SINGLE ICON EDITION */
.side-twin-dock {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    background: rgb(var(--brand-rgb));
    padding: 10px 6px 10px 10px; /* Etwas breiter nach links */
    border-radius: 1.25rem 0 0 1.25rem;
    z-index: 100;
    box-shadow: -4px 0 25px rgba(var(--brand-rgb), 0.3);
    /* Senior-Fix: Getrennte Transition für flüssigeres Ausblenden */
    transition: transform 0.5s var(--spring-smooth), opacity 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-right: none;
    will-change: transform, opacity;
    touch-action: none; /* WICHTIG: Verhindert Seiten-Scrollen beim Draggen */
    cursor: grab;
}

.side-twin-dock:active {
    cursor: grabbing;
}

/* Fokus-Modus: Dock verstecken, wenn ein Modal offen ist */
body.modal-open .side-twin-dock {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-50%) translateX(100%);
}

.side-dock-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: transparent;
    border: none;
    transition: all 0.3s var(--spring-bounce);
    cursor: pointer;
}

.side-dock-item svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

/* Hover-Effekt: Das Dock "atmet" beim Drüberfahren */
@media (hover: hover) {
    .side-twin-dock:hover {
        padding-left: 15px;
        background: rgb(var(--brand-rgb) / 0.95);
    }
    .side-dock-item:hover {
        transform: scale(1.1);
    }
}

/* Mobile: Etwas tiefer für bessere Daumen-Erreichbarkeit */
@media (max-width: 768px) {
    .side-twin-dock {
        top: 65%;
    }
}

/* Verhindert Textumbruch in der Roadmap */
#commTabRoadmap .tab-label {
    white-space: nowrap;
}

/* === COMMUNITY PREMIUM NAV SYSTEM - GRID 25% === */
.community-nav-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* Exakt 25% pro Spalte */
    background-color: var(--bg-card);
    align-items: stretch;
}

/* Button-Inhalt: Logo oben, Text unten */
.community-nav-container .community-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    width: 100%;
}

/* Aktiv-Zustand */
.community-nav-container .community-tab-btn.active {
    background-color: rgb(var(--brand-rgb));
    color: #FFFFFF;
}

/* Premium: Icon-Animation beim Tab-Wechsel */
.community-tab-btn svg {
    transition: transform 0.4s var(--spring-bounce), stroke-width 0.3s ease;
}

.community-tab-btn.active svg {
    transform: scale(1.1) translateY(-1px);
    stroke-width: 2.5px; /* Aktives Icon wird minimal fetter */
}

/* Japandi Theme: Weißer Hintergrund & Olive Akzent */
[data-theme="japandi"] .community-nav-container {
    background-color: #FFFFFF;
    border: 1.5px solid rgba(138, 154, 91, 0.2);
}

[data-theme="japandi"] .community-nav-container .community-tab-btn.active {
    background-color: rgba(var(--brand-rgb), 0.1);
    color: rgb(var(--brand-rgb));
    border: 1px solid rgba(var(--brand-rgb), 0.2);
}

/* Dark Mode: Hintergrund wird durch var(--bg-card) automatisch korrekt */
.dark .community-nav-container .community-tab-btn.active {
    box-shadow: 0 4px 15px rgba(var(--brand-rgb), 0.4);
}

/* === GLOBAL TAB LABELS (No Important) === */
.tab-label {
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-top: 2px;
}

@media (min-width: 640px) {
    .tab-label {
        font-size: 10px;
    }
}

/* === SEGMENTED NAV SYSTEM (Global Design Pattern) === */
.segmented-nav-container {
    display: grid;
    background-color: var(--bg-card);
    align-items: stretch;
    border-radius: 1rem; /* Entspricht rounded-2xl */
}

.segmented-nav-container .segmented-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.segmented-nav-container .segmented-tab-btn.active {
    background-color: rgb(var(--brand-rgb));
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(var(--brand-rgb), 0.4);
}

.segmented-tab-btn svg {
    transition: transform 0.4s var(--spring-bounce), stroke-width 0.3s ease;
}

.segmented-nav-container .segmented-tab-btn.active svg {
    transform: scale(1.1) translateY(-1px);
    stroke-width: 2.5px;
}

/* Japandi Support */
[data-theme="japandi"] .segmented-nav-container {
    background-color: #FFFFFF;
    border: 1.5px solid rgba(138, 154, 91, 0.2);
}
[data-theme="japandi"] .segmented-nav-container .segmented-tab-btn.active {
    background-color: rgba(138, 154, 91, 0.1);
    color: rgb(138, 154, 91);
    border: 1px solid rgba(138, 154, 91, 0.2);
    box-shadow: none;
}

/* Verhindert, dass versteckte Elemente Platz einnehmen */
.hidden { display: none; }

/* ⚡ Unified Tab Header System */
.tab-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem; /* Gleicht die Flucht mit den Buchkarten aus */
}

.tab-header-title {
    font-size: 1.5rem; /* Entspricht text-2xl */
    font-weight: 700;
    line-height: 1.2;
}

/* ⚡ Footer Persistence Fix */
#globalAppFooter {
    margin-top: auto; /* Schiebt den Footer nach unten, falls der Tab wenig Inhalt hat */
    border-top: 1px solid rgba(var(--brand-rgb), 0.1);
    width: 100%;
}

@media (min-width: 768px) {
    .tab-header-title {
        font-size: 1.875rem; /* Entspricht md:text-3xl */
    }
}

/* Elite Selection Trigger Styling */
.review-select-trigger {
    cursor: pointer;
    transition: all 0.3s var(--spring-smooth);
}

.review-select-trigger:active {
    transform: scale(0.95);
}

/* Custom Scrollbar für Selection Modal */
#selectionList::-webkit-scrollbar {
    width: 4px;
}
#selectionList::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-rgb), 0.1);
    border-radius: 10px;
}

/* Verhindert, dass das Modal zu groß wird auf kleinen Screens */
@media (max-height: 700px) {
    #selectionList {
        max-height: 300px;
    }
}

/* Mood Scroll Area für das Rezensionsmodal */
.mood-scroll-area {
    max-height: 165px; /* Entspricht ca. 4 Reihen */
    overflow-y: auto;
    padding: 4px;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--brand-rgb), 0.1) transparent;
}

.mood-scroll-area::-webkit-scrollbar {
    width: 4px;
}

.mood-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-rgb), 0.1);
    border-radius: 10px;
}

/* === ELITE SELECTION MODAL REFINEMENTS === */
#selectionList {
    scrollbar-width: thin;
    scrollbar-color: rgba(var(--brand-rgb), 0.2) transparent;
    padding-right: 4px; /* Platz für die Scrollbar */
}

#selectionList::-webkit-scrollbar {
    width: 5px;
}

#selectionList::-webkit-scrollbar-track {
    background: transparent;
}

#selectionList::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-rgb), 0.1);
    border-radius: 10px;
}

#selectionList::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--brand-rgb), 0.2);
}

/* Animation für das Erscheinen der Items (Elite Staggering) */
#selectionList button {
    animation: slideInUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    will-change: transform, opacity;
}

@keyframes slideInUp {
    from { 
        transform: translateY(15px) scale(0.95); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0) scale(1); 
        opacity: 1; 
    }
}

/* Staggered Animation Delays für die ersten 6 Items */
#selectionList button:nth-child(1) { animation-delay: 0.05s; }
#selectionList button:nth-child(2) { animation-delay: 0.1s; }
#selectionList button:nth-child(3) { animation-delay: 0.15s; }
#selectionList button:nth-child(4) { animation-delay: 0.2s; }
#selectionList button:nth-child(5) { animation-delay: 0.25s; }
#selectionList button:nth-child(6) { animation-delay: 0.3s; }

/* === ELITE RANGE SLIDER SYSTEM === */
/* Senior-Fix: Custom Styling für den Schieberegler ohne !important */

/* Basis-Reset für alle Browser */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
}

/* Die Linie (Track) */
input[type="range"]::-webkit-slider-runnable-track {
    background: rgba(var(--brand-rgb), 0.15);
    height: 6px;
    border-radius: 3px;
    transition: background 0.3s ease;
}

input[type="range"]::-moz-range-track {
    background: rgba(var(--brand-rgb), 0.15);
    height: 6px;
    border-radius: 3px;
}

/* Der Griff (Thumb) */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    margin-top: -5px; /* Zentriert den Griff auf der Linie */
    background-color: rgb(var(--brand-rgb));
    height: 16px;
    width: 16px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(var(--brand-rgb), 0.3);
    transition: transform 0.2s var(--spring-bounce), box-shadow 0.2s ease;
}

input[type="range"]::-moz-range-thumb {
    border: none;
    background-color: rgb(var(--brand-rgb));
    height: 16px;
    width: 16px;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(var(--brand-rgb), 0.3);
}

/* Hover & Active States */
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(var(--brand-rgb), 0.5);
}

/* Dark Mode spezifischer Glow */
.dark input[type="range"]::-webkit-slider-thumb {
    box-shadow: 0 0 12px rgba(var(--brand-rgb), 0.6);
}