/* ===== DARK ACADEMIA DESIGN SYSTEM ===== */
:root {
    /* Farbschema */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-paper: #2d281a;
    --bg-card: #242017;
    
    /* Akzentfarben */
    --accent-gold: #c9a66b;
    --accent-burgundy: #8b4513;
    --accent-olive: #556b2f;
    --accent-slate: #708090;
    
    /* Textfarben */
    --text-primary: #f5f5dc;
    --text-secondary: #d4c9a9;
    --text-muted: #a89f8a;
    
    /* Border & Schatten */
    --border-color: #3d3524;
    --shadow-dark: rgba(0, 0, 0, 0.5);
    --shadow-light: rgba(201, 166, 107, 0.1);
    
    /* Animationen */
    --transition-slow: 0.5s ease;
    --transition-fast: 0.3s ease;
}

/* ===== BASIS-STILE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.dark-academia {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Crimson Text', serif;
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(43, 36, 21, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(139, 69, 19, 0.05) 0%, transparent 20%);
    position: relative;
    overflow-x: hidden;
}

/* Kerzen-Animation */
.candle-animation {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    pointer-events: none;
}

.candle {
    width: 20px;
    height: 60px;
    background: linear-gradient(to right, #8b4513, #a0522d, #8b4513);
    border-radius: 10px 10px 0 0;
    position: relative;
}

.flame {
    width: 15px;
    height: 30px;
    background: linear-gradient(to bottom, #ff9a00, #ff5e00, transparent 70%);
    border-radius: 50% 50% 20% 20%;
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    animation: flicker 2s infinite alternate;
    box-shadow: 0 0 20px #ff5e00;
}

@keyframes flicker {
    0%, 100% { transform: translateX(-50%) scale(1); }
    25% { transform: translateX(-50%) scale(1.1) translateX(2px); }
    50% { transform: translateX(-50%) scale(0.9) translateX(-1px); }
    75% { transform: translateX(-50%) scale(1.05) translateX(1px); }
}

/* ===== NAVIGATION ===== */
.library-nav {
    background: linear-gradient(to bottom, var(--bg-paper), var(--bg-secondary));
    border-bottom: 2px solid var(--border-color);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px var(--shadow-dark);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo i {
    font-size: 2rem;
    color: var(--accent-gold);
    filter: drop-shadow(0 0 5px rgba(201, 166, 107, 0.3));
}

.logo h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--accent-gold), #e6d5a8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.logo span {
    color: var(--text-secondary);
    -webkit-text-fill-color: var(--text-secondary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-gold);
    background: rgba(201, 166, 107, 0.1);
    border-bottom: 2px solid var(--accent-gold);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(36, 32, 23, 0.8);
    border-radius: 20px;
    cursor: pointer;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.user-menu:hover {
    background: rgba(201, 166, 107, 0.1);
    border-color: var(--accent-gold);
}

.user-menu i {
    color: var(--accent-gold);
    font-size: 1.2rem;
}

/* ===== BUTTONS ===== */
.btn-primary, .btn-secondary {
    background: none;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-burgundy), #a0522d);
    color: var(--text-primary);
    border: 1px solid var(--accent-burgundy);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #a0522d, var(--accent-burgundy));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
}

.btn-secondary:hover {
    background: rgba(201, 166, 107, 0.1);
    transform: translateY(-2px);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 15, 0.95);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-paper);
    padding: 2rem;
    border-radius: 8px;
    border: 2px solid var(--accent-burgundy);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 0 40px rgba(139, 69, 19, 0.3);
}

.close-modal {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.close-modal:hover {
    color: var(--accent-gold);
}

.modal-content h2 {
    color: var(--accent-gold);
    margin-bottom: 1.5rem;
    font-family: 'Cinzel', serif;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.account-form {
    margin-bottom: 2rem;
}

.account-form input {
    width: 100%;
    padding: 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.account-form input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--shadow-light);
}

.info-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.progress-display {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid var(--accent-olive);
}

.progress-display h3 {
    color: var(--accent-gold);
    margin-bottom: 0.5rem;
}

/* ===== HAUPTINHALT ===== */
.library-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Willkommensbereich */
.welcome-section {
    margin-bottom: 2rem;
}

.welcome-card {
    background: linear-gradient(135deg, var(--bg-paper), var(--bg-card));
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-dark);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--accent-burgundy), var(--accent-gold));
}

.welcome-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.welcome-header h2 {
    font-family: 'Cinzel', serif;
    color: var(--accent-gold);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-display {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

.quote {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 3px solid var(--accent-olive);
}

.daily-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
}

.stat i {
    color: var(--accent-gold);
}

.stat strong {
    color: var(--text-primary);
    font-size: 1.2rem;
}

/* Sektion-Header */
.section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-header i {
    color: var(--accent-gold);
    font-size: 1.2rem;
}

.section-header h2 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* Täglicher Gedanke */
.daily-thought {
    margin-bottom: 3rem;
}

.thought-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform var(--transition-fast);
}

.thought-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--shadow-dark);
}

.thought-content {
    flex: 1;
}

#dailyThoughtText {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 0.5rem;
}

.thought-meta {
    display: flex;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== BÜCHERREGAL ===== */
.bookshelf-section {
    margin-bottom: 3rem;
}

.bookshelf {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.shelf {
    margin-bottom: 2rem;
}

.shelf:last-child {
    margin-bottom: 0;
}

.shelf-label {
    font-family: 'Cinzel', serif;
    color: var(--accent-gold);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 3px solid var(--accent-burgundy);
}

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

.book {
    display: flex;
    text-decoration: none;
    transition: transform var(--transition-fast);
    height: 280px;
}

.book:hover {
    transform: translateY(-5px) scale(1.02);
}

.book-spine {
    width: 20px;
    background: linear-gradient(to right, #8b0000, #b22222);
    border-radius: 2px 0 0 2px;
    margin-right: -10px;
    z-index: 1;
}

.book[data-color="red"] .book-spine {
    background: linear-gradient(to right, #8b0000, #b22222);
}

.book[data-color="blue"] .book-spine {
    background: linear-gradient(to right, #1e3a8a, #3b82f6);
}

.book[data-color="green"] .book-spine {
    background: linear-gradient(to right, #14532d, #22c55e);
}

.book[data-color="purple"] .book-spine {
    background: linear-gradient(to right, #581c87, #a855f7);
}

.book[data-color="gold"] .book-spine {
    background: linear-gradient(to right, #854d0e, #eab308);
}

.book[data-color="teal"] .book-spine {
    background: linear-gradient(to right, #0f766e, #14b8a6);
}

.book[data-color="brown"] .book-spine {
    background: linear-gradient(to right, #78350f, #d97706);
}

.book[data-color="navy"] .book-spine {
    background: linear-gradient(to right, #1e3a8a, #3b82f6);
}

.book-cover {
    flex: 1;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-paper));
    border-radius: 0 4px 4px 0;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-left: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 95%, rgba(201, 166, 107, 0.1) 100%);
}

.book-cover h3 {
    color: var(--accent-gold);
    font-family: 'Cinzel', serif;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.book-cover p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.book-stats {
    margin-top: auto;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

/* ===== LERNKARTEN - KORRIGIERT ===== */
.flashcards-section {
    margin-bottom: 3rem;
}

.flashcard-container {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 2rem;
    border: 1px solid var(--border-color);
}

/* WICHTIGE KORREKTUR: Flexbox für Karte */
.flashcard {
    width: 100%;
    min-height: 300px; /* Ändere zu min-height */
    perspective: 1500px;
    margin-bottom: 2rem;
    cursor: pointer;
    position: relative;
    display: flex; /* Füge Flexbox hinzu */
    align-items: center;
    justify-content: center;
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Bessere Animation */
    transform-style: preserve-3d;
    top: 0;
    left: 0;
    box-sizing: border-box;
    overflow: hidden; /* Verhindert Überlauf */
}

.flashcard-front {
    background: linear-gradient(135deg, var(--bg-paper), var(--bg-card));
    border: 2px solid var(--accent-burgundy);
    z-index: 2;
}

.flashcard-back {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-paper));
    border: 2px solid var(--accent-olive);
    transform: rotateY(180deg);
    z-index: 1;
}

/* Korrekte Flip-Animation */
.flashcard.flipped .flashcard-front {
    transform: rotateY(180deg);
}

.flashcard.flipped .flashcard-back {
    transform: rotateY(0deg);
}

.card-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--accent-burgundy);
    color: var(--text-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-family: 'Cinzel', serif;
    z-index: 3;
}

.flashcard-front h3 {
    font-size: 1.4rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.hint {
    margin-top: auto;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    padding-top: 1rem;
}

.flashcard-back h3 {
    color: var(--accent-olive);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.flashcard-back p {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.card-details {
    background: rgba(36, 32, 23, 0.5);
    padding: 1rem;
    border-radius: 4px;
    border-left: 3px solid var(--accent-gold);
    margin-top: auto;
    font-size: 0.95rem;
}

.flashcard-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.card-progress {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-burgundy), var(--accent-gold));
    width: 5%;
    transition: width 0.3s ease;
}

/* ===== STATISTIKEN ===== */
.weekly-stats {
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: transform var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-gold);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, var(--accent-burgundy), var(--accent-gold));
}

.stat-icon {
    font-size: 2.5rem;
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.stat-card h3 {
    color: var(--text-secondary);
    font-family: 'Cinzel', serif;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-gold);
    margin: 0.5rem 0;
}

.stat-change {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.stat-change i {
    color: #22c55e;
}

.progress-circle {
    width: 60px;
    height: 60px;
    margin: 1rem auto 0;
    border-radius: 50%;
    background: var(--border-color);
    position: relative;
}

.circle-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(var(--accent-gold) 0%, var(--accent-gold) 0%, transparent 0%, transparent 100%);
    transition: background 0.5s ease;
}

/* ===== FOOTER ===== */
.library-footer {
    background: linear-gradient(to top, var(--bg-paper), var(--bg-secondary));
    border-top: 2px solid var(--border-color);
    padding: 3rem 2rem 2rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-logo {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-logo i {
    font-size: 2rem;
    color: var(--accent-gold);
}

.footer-logo h3 {
    font-family: 'Cinzel', serif;
    font-size: 1.5rem;
    color: var(--accent-gold);
}

.footer-logo span {
    color: var(--text-secondary);
}

.motto {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-gold);
}

.footer-info {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.copyright {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }
    
    .welcome-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .daily-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .thought-card {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .books {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .book {
        height: 250px;
    }
    
    .flashcard {
        min-height: 250px;
    }
    
    .flashcard-front h3 {
        font-size: 1.2rem;
    }
    
    .flashcard-back h3 {
        font-size: 1.1rem;
    }
    
    .flashcard-back p {
        font-size: 1rem;
    }
    
    .flashcard-controls {
        flex-direction: column;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-links {
        align-items: center;
    }
}

@media (max-width: 480px) {
    .library-main {
        padding: 1rem;
    }
    
    .books {
        grid-template-columns: 1fr;
    }
    
    .flashcard-front,
    .flashcard-back {
        padding: 1.5rem;
    }
    
    .flashcard-front h3 {
        font-size: 1.1rem;
    }
    
    .flashcard-back h3 {
        font-size: 1rem;
    }
}