/**
 * Fichas de Estudo - Main Stylesheet
 * Desenvolvido por B20 Conteúdo Digital
 * https://www.b20.com.br
 */

/* ===== CSS Variables ===== */
:root {
    /* Serene Study Palette - Focused & Professional */
    --primary-color: #4361ee;
    /* Indigo Blue - Promotes focus */
    --primary-hover: #3a56d4;
    --primary-light: #eef2ff;
    --secondary-color: #2b2d42;
    /* Deep Slate - Grounding */
    --accent-color: #4895ef;
    /* Soft Blue */
    --surface-color: #ffffff;
    --text-color: #2b2d42;

    /* Derived Colors */
    --bg-color: #f8fafc;
    /* Very light cool grey for eye comfort */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --success-color: #10b981;
    /* Emerald */
    --danger-color: #ef4444;
    /* Soft Red */
    --warning-color: #f59e0b;
    /* Amber */

    /* Spacing */
    --spacing-unit: 8px;
    --border-radius: 6px;
    /* Precise educational look */
    --border-radius-sm: 4px;
    --border-radius-lg: 10px;

    /* Transitions */
    --transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    --transition-fast: all 0.1s ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(15, 17, 17, 0.15);
    --shadow-md: 0 4px 8px rgba(15, 17, 17, 0.15);
    --shadow-lg: 0 12px 24px rgba(15, 17, 17, 0.2);
    --shadow-neumorphic: 8px 8px 16px rgba(0, 0, 0, 0.1), -8px -8px 16px rgba(255, 255, 255, 0.8);
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-color: #0f172a;
    /* Deep Slate Blue */
    --surface-color: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --primary-light: rgba(67, 97, 238, 0.1);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    /* Reduced base font size */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding-top: 60px;
    padding-bottom: 70px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: calc(var(--spacing-unit) * 2);
    color: var(--secondary-color);
}

[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-color);
}

h1 {
    font-size: 1.75rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

h4 {
    font-size: 1.1rem;
}

p {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

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

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== Header ===== */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    /* Slightly thinner header */
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 calc(var(--spacing-unit) * 2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.header-logo {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1.5);
}

.header-logo i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.app-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.header-logo h1 {
    font-size: 1.25rem;
    margin: 0;
    color: var(--secondary-color);
}

[data-theme="dark"] .header-logo h1 {
    color: var(--text-color);
}

.desktop-nav {
    display: none;
}

.header-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: calc(var(--spacing-unit) * 1);
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 3);
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-height: 44px;
    min-width: 44px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--accent-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #C82333;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.9rem;
    padding: calc(var(--spacing-unit) * 1);
    transition: var(--transition-fast);
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===== Main Content ===== */
.main-content {
    min-height: calc(100vh - 130px);
}

.container {
    max-width: 100%;
    padding: calc(var(--spacing-unit) * 2);
    margin: 0 auto;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Welcome Banner ===== */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: calc(var(--spacing-unit) * 2.5) calc(var(--spacing-unit) * 3);
    border-radius: var(--border-radius-lg);
    margin-bottom: calc(var(--spacing-unit) * 3);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 250px;
    height: 250px;
    background: var(--accent-color);
    filter: blur(80px);
    opacity: 0.2;
    pointer-events: none;
}

.welcome-banner h2 {
    color: white;
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.welcome-banner p {
    margin: 0;
    opacity: 0.9;
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.stat-card {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-neumorphic);
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--secondary-color);
    line-height: 1;
}

[data-theme="dark"] .stat-value {
    color: var(--text-color);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Quick Actions ===== */
.quick-actions {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.quick-actions h3 {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
}

.action-btn {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: calc(var(--spacing-unit) * 1);
    cursor: pointer;
    transition: var(--transition);
    min-height: 100px;
}

.action-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.action-btn i {
    font-size: 2rem;
    color: var(--primary-color);
}

.action-btn span {
    font-weight: 500;
    color: var(--text-color);
}

/* ===== Recent Activity ===== */
.recent-activity {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 1.5);
}

.activity-item {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius-sm);
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.activity-content {
    flex: 1;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 4px;
}

.activity-time {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Section Header ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.section-description {
    color: var(--text-muted);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

/* ===== Filters Bar ===== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.search-box {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: calc(var(--spacing-unit) * 2);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 5);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    background: var(--surface-color);
    color: var(--text-color);
    transition: var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    padding: calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 2);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition-fast);
    min-width: 150px;
}

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

/* ===== Cards Grid ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
}

.card-item {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 2);
    box-shadow: var(--shadow-neumorphic);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.card-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: var(--transition);
}

.card-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-item:hover::before {
    transform: scaleY(1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.card-category {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-actions {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
}

.card-actions .btn-icon {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.card-front-preview {
    font-weight: 500;
    margin-bottom: calc(var(--spacing-unit) * 1);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-back-preview {
    font-size: 0.9rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    padding-top: calc(var(--spacing-unit) * 1.5);
}

.card-difficulty {
    display: flex;
    gap: 4px;
}

.difficulty-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color);
}

.difficulty-dot.active {
    background: var(--primary-color);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: calc(var(--spacing-unit) * 6) calc(var(--spacing-unit) * 2);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.empty-state h3 {
    color: var(--text-muted);
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: calc(var(--spacing-unit) * 3);
}

/* ===== Study Mode ===== */
.study-setup {
    max-width: 800px;
    margin: 0 auto;
}

.study-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
    margin-top: calc(var(--spacing-unit) * 3);
}

.option-card {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 3);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-neumorphic);
    text-align: center;
    transition: var(--transition);
}

.option-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.option-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.option-card h3 {
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.option-count {
    display: block;
    color: var(--text-muted);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.option-card .filter-select {
    width: 100%;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.study-mode {
    max-width: 600px;
    margin: 0 auto;
}

.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.study-progress {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--secondary-color);
}

[data-theme="dark"] .study-progress {
    color: var(--text-color);
}

.study-timer {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* ===== Flashcard ===== */
.flashcard {
    perspective: 1000px;
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.flashcard-inner {
    position: relative;
    width: 100%;
    min-height: 400px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    min-height: 400px;
    backface-visibility: hidden;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--spacing-unit) * 4);
}

[data-theme="dark"] .flashcard-front,
[data-theme="dark"] .flashcard-back {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.card-content {
    font-size: 1.25rem;
    text-align: center;
    line-height: 1.8;
}

.study-controls {
    display: flex;
    justify-content: center;
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.difficulty-buttons {
    display: flex;
    gap: calc(var(--spacing-unit) * 2);
    justify-content: center;
}

.btn-difficulty {
    flex: 1;
    max-width: 150px;
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 1);
    padding: calc(var(--spacing-unit) * 2);
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-easy {
    background: var(--success-color);
    color: white;
}

.btn-easy:hover {
    background: #218838;
    transform: translateY(-2px);
}

.btn-medium {
    background: var(--warning-color);
    color: var(--secondary-color);
}

.btn-medium:hover {
    background: #E0A800;
    transform: translateY(-2px);
}

.btn-hard {
    background: var(--danger-color);
    color: white;
}

.btn-hard:hover {
    background: #C82333;
    transform: translateY(-2px);
}

/* ===== Study Complete ===== */
.study-complete {
    text-align: center;
    padding: calc(var(--spacing-unit) * 6) calc(var(--spacing-unit) * 2);
}

.study-complete i {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.session-stats {
    display: flex;
    justify-content: center;
    gap: calc(var(--spacing-unit) * 4);
    margin: calc(var(--spacing-unit) * 4) 0;
}

.session-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.session-stat .stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.session-stat .stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===== Library ===== */
.library-categories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: calc(var(--spacing-unit) * 2);
}

.library-card {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 3);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-neumorphic);
    text-align: center;
    transition: var(--transition);
}

.library-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.library-icon {
    font-size: 3rem;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.library-card h3 {
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.library-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.library-count {
    display: block;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

/* ===== Stats Section ===== */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: calc(var(--spacing-unit) * 3);
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.overview-card {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 3);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-neumorphic);
}

.overview-card h3 {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: calc(var(--spacing-unit) * 1.5) 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-row:last-child {
    border-bottom: none;
}

.streak-display {
    text-align: center;
    padding: calc(var(--spacing-unit) * 3) 0;
}

.streak-display i {
    font-size: 3rem;
    color: var(--primary-color);
}

.streak-number {
    display: block;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: calc(var(--spacing-unit) * 1) 0;
}

.streak-label {
    color: var(--text-muted);
}

.goal-progress {
    margin-top: calc(var(--spacing-unit) * 2);
}

.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin: calc(var(--spacing-unit) * 1) 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-hover));
    transition: width 0.3s ease;
}

.categories-stats,
.recent-sessions {
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.categories-list,
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit) * 2);
}

.category-stat-item,
.session-item {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ===== Library Detail ===== */
.library-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.library-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.library-item-preview {
    background: var(--bg-color);
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.lib-front {
    color: var(--primary-color);
    margin-bottom: 4px;
    font-weight: 500;
}

.lib-back {
    color: var(--text-muted);
}

/* ===== Bottom Nav (Mobile Only) ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--surface-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 calc(var(--spacing-unit) * 1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    transition: var(--transition-fast);
    flex: 1;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-item.active i {
    transform: scale(1.15);
}

.nav-item-fab {
    background: var(--primary-color);
    color: var(--secondary-color) !important;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-top: -30px;
    box-shadow: var(--shadow-md);
    border: 4px solid var(--bg-color);
}

.nav-item-fab i {
    font-size: 1.5rem;
}

.nav-item-fab span {
    display: none;
}

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: calc(var(--spacing-unit) * 2);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    max-width: 500px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    border: 1px solid var(--border-color);
}

.modal-large {
    max-width: 700px;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--surface-color);
    z-index: 10;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-body {
    padding: calc(var(--spacing-unit) * 3);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: calc(var(--spacing-unit) * 2);
    padding: calc(var(--spacing-unit) * 2) calc(var(--spacing-unit) * 3);
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background: var(--surface-color);
    z-index: 10;
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.form-group label {
    display: block;
    margin-bottom: calc(var(--spacing-unit) * 1);
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: calc(var(--spacing-unit) * 1.5);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* ===== Settings ===== */
.settings-section {
    margin-bottom: calc(var(--spacing-unit) * 4);
    padding-bottom: calc(var(--spacing-unit) * 3);
    border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h4 {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.settings-description {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: calc(var(--spacing-unit) * 2);
}

/* ===== AI Chat ===== */
.ai-chat {
    min-height: 300px;
    max-height: 400px;
    overflow-y: auto;
    padding: calc(var(--spacing-unit) * 2);
    background: var(--bg-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.ai-message {
    margin-bottom: calc(var(--spacing-unit) * 2);
    display: flex;
    gap: calc(var(--spacing-unit) * 1.5);
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ai-message.user .ai-avatar {
    background: var(--accent-color);
}

.ai-bubble {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 1.5);
    border-radius: var(--border-radius-sm);
    max-width: 70%;
    box-shadow: var(--shadow-sm);
}

.ai-message.user .ai-bubble {
    background: var(--primary-light);
}

.ai-input-form {
    display: flex;
    gap: calc(var(--spacing-unit) * 1);
}

.ai-input-form input {
    flex: 1;
}

/* ===== FAQ ===== */
.faq-section {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 6) calc(var(--spacing-unit) * 2);
    margin-top: calc(var(--spacing-unit) * 6);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 4);
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: calc(var(--spacing-unit) * 2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: calc(var(--spacing-unit) * 2);
    background: var(--bg-color);
    border: none;
    text-align: left;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition-fast);
    color: var(--text-color);
}

.faq-question:hover {
    background: var(--primary-light);
}

.faq-icon {
    font-size: 1.5rem;
    color: var(--primary-color);
    transition: var(--transition-fast);
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 calc(var(--spacing-unit) * 2);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer:not([hidden]) {
    padding: calc(var(--spacing-unit) * 2);
    max-height: 500px;
}

.faq-answer p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ===== Footer ===== */
.app-footer {
    background: var(--surface-color);
    padding: calc(var(--spacing-unit) * 4) calc(var(--spacing-unit) * 2);
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: calc(var(--spacing-unit) * 6);
}

.app-footer p {
    margin-bottom: calc(var(--spacing-unit) * 1);
    color: var(--text-muted);
}

.b20-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.b20-link:hover {
    text-decoration: underline;
    transform: scale(1.05);
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--secondary-color);
    color: white;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    opacity: 0;
    transition: var(--transition);
    z-index: 3000;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}



/* ===== Utility Classes ===== */
.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.text-small {
    font-size: 0.8rem;
}

.font-bold {
    font-weight: 700;
}

.mb-1 {
    margin-bottom: 4px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-3 {
    margin-bottom: 16px;
}

.mt-1 {
    margin-top: 4px;
}

.mt-2 {
    margin-top: 8px;
}

.mt-3 {
    margin-top: 16px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.text-center {
    text-align: center;
}

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

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.mb-2 {
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.mb-3 {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.mt-0 {
    margin-top: 0;
}

.mt-1 {
    margin-top: calc(var(--spacing-unit) * 1);
}

.mt-2 {
    margin-top: calc(var(--spacing-unit) * 2);
}

.mt-3 {
    margin-top: calc(var(--spacing-unit) * 3);
}