/* ============================================
   BIBLIOTECH PRO - SISTEMA DE DISEÑO PREMIUM
   Autor: Xavier Aerox
   Versión: 2.0 - Edición Profesional
   ============================================ */

:root {
    /* Premium Color Palette - Inspirado en diseño moderno */
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --primary-subtle: rgba(99, 102, 241, 0.1);

    --accent: #F472B6;
    --accent-dark: #EC4899;
    --accent-light: #F9A8D4;

    --secondary: #8B5CF6;
    --tertiary: #06B6D4;

    /* Backgrounds */
    --bg-body: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-sidebar: linear-gradient(180deg, #1E1B4B 0%, #0F172A 100%);
    --bg-secondary: #F1F5F9;
    --bg-elevated: #FFFFFF;

    /* Text Colors */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --text-light: #F8FAFC;
    --text-inverse: #FFFFFF;

    /* Border */
    --border: #E2E8F0;
    --border-light: #F1F5F9;

    /* Status Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;

    /* Shadows - Layered for depth */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-accent: linear-gradient(135deg, #F472B6 0%, #EC4899 100%);
    --gradient-hero: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --gradient-dark: linear-gradient(180deg, #1E1B4B 0%, #0F172A 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, hsla(240, 91%, 65%, 0.1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(189, 100%, 56%, 0.1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(355, 100%, 93%, 0.1) 0px, transparent 50%);

    /* Typography Scale */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Playfair Display', serif;

    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 1.875rem;
    --text-4xl: 2.25rem;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-popover: 600;
    --z-tooltip: 700;
    --z-toast: 800;
}

/* === DARK MODE === */
body.dark-mode {
    --bg-body: #0F172A;
    --bg-card: #1E293B;
    --bg-secondary: #334155;
    --bg-elevated: #1E293B;
    --bg-sidebar: linear-gradient(180deg, #0F172A 0%, #020617 100%);

    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #64748B;
    --text-light: #F8FAFC;

    --border: #334155;
    --border-light: #1E293B;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* === RESET & BASE === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    background-image: var(--gradient-mesh);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* === LOADING SCREEN === */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-logo {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    animation: pulse 2s ease-in-out infinite;
}

.loading-text {
    font-size: var(--text-2xl);
    font-weight: 700;
    margin-bottom: var(--space-6);
    letter-spacing: -0.02em;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: white;
    border-radius: var(--radius-full);
    animation: loading-progress 1.5s ease-in-out infinite;
}

@keyframes loading-progress {
    0% {
        width: 0%;
        margin-left: 0;
    }

    50% {
        width: 70%;
        margin-left: 15%;
    }

    100% {
        width: 0%;
        margin-left: 100%;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

/* === LOGIN VIEW === */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: var(--space-4);
    position: relative;
    overflow: hidden;
}

/* Floating particles */
.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    animation: float-particle 15s infinite;
}

.particle:nth-child(1) {
    left: 10%;
    animation-delay: 0s;
    animation-duration: 12s;
}

.particle:nth-child(2) {
    left: 30%;
    animation-delay: 2s;
    animation-duration: 18s;
}

.particle:nth-child(3) {
    left: 50%;
    animation-delay: 4s;
    animation-duration: 15s;
}

.particle:nth-child(4) {
    left: 70%;
    animation-delay: 1s;
    animation-duration: 20s;
}

.particle:nth-child(5) {
    left: 90%;
    animation-delay: 3s;
    animation-duration: 14s;
}

@keyframes float-particle {

    0%,
    100% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

.login-card {
    background: var(--bg-card);
    padding: var(--space-10);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 420px;
    text-align: center;
    position: relative;
    z-index: 10;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-6);
    font-size: var(--text-3xl);
    color: white;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.3);
}

.login-card h1 {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    letter-spacing: -0.02em;
}

.pro-badge {
    display: inline-block;
    background: var(--gradient-accent);
    color: white;
    font-size: var(--text-xs);
    font-weight: 700;
    padding: 0.2em 0.6em;
    border-radius: var(--radius-sm);
    vertical-align: super;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-8);
}

/* Form Elements */
.form-group {
    text-align: left;
    margin-bottom: var(--space-5);
}

.form-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition-base);
}

.form-input:hover {
    border-color: var(--primary-light);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px var(--primary-subtle);
}

.form-help {
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.password-wrapper {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2);
    transition: color var(--transition-fast);
}

.password-toggle:hover {
    color: var(--primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 4px 14px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-login {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--text-lg);
    margin-top: var(--space-4);
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-full);
}

.btn-icon:hover {
    background: var(--bg-card);
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-hero {
    background: white;
    color: var(--primary);
    font-weight: 700;
    padding: var(--space-4) var(--space-8);
    box-shadow: var(--shadow-lg);
}

.btn-hero:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.login-error {
    color: var(--danger);
    font-size: var(--text-sm);
    margin-top: var(--space-4);
    padding: var(--space-3);
    background: var(--danger-light);
    border-radius: var(--radius-md);
    display: none;
}

.login-error:not(:empty) {
    display: block;
}

.login-footer {
    margin-top: var(--space-8);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--text-xs);
}

.login-footer .version {
    margin-top: var(--space-2);
    opacity: 0.7;
}

/* === DASHBOARD LAYOUT === */
.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* === SIDEBAR === */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: radial-gradient(ellipse at top, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.sidebar-brand {
    padding: var(--space-6);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    position: relative;
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: var(--text-xl);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.brand-pro {
    font-size: var(--text-xs);
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
}

.nav-section {
    margin-bottom: var(--space-6);
}

.nav-section-title {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: var(--transition-base);
    margin-bottom: var(--space-1);
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary-subtle);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, transparent 100%);
    color: white;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-item i {
    font-size: var(--text-lg);
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 0.1em 0.5em;
    border-radius: var(--radius-full);
    min-width: 20px;
    text-align: center;
}

.nav-new {
    margin-left: auto;
    background: var(--gradient-accent);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2em 0.5em;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-version {
    text-align: center;
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.3);
    margin-top: var(--space-3);
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-body);
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-6) var(--space-8);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.page-title {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-top: var(--space-1);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.header-actions {
    display: flex;
    gap: var(--space-2);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
}

.user-role {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-sm);
}

/* === SECTIONS === */
.section {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-8);
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    margin-top: var(--space-8);
}

.section-header:first-child {
    margin-top: 0;
}

.section-header h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.section-badge {
    background: var(--warning-light);
    color: var(--warning);
    font-size: var(--text-xs);
    font-weight: 600;
    padding: 0.2em 0.6em;
    border-radius: var(--radius-sm);
}

/* === FILTERS === */
.filters-container {
    background: var(--bg-card);
    padding: var(--space-6);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-6);
    display: flex;
    gap: var(--space-4);
    align-items: flex-end;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.search-wrapper {
    flex: 2;
    min-width: 250px;
}

.category-filter-wrapper {
    flex: 1;
    min-width: 200px;
}

.input-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.search-input-group {
    position: relative;
}

.search-input-group>i {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-field {
    padding-left: var(--space-10) !important;
    margin-bottom: 0 !important;
}

.filter-options {
    display: flex;
    align-items: center;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-left: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    user-select: none;
}

/* === STATS BAR === */
.stats-bar {
    display: flex;
    gap: var(--space-6);
    margin-bottom: var(--space-4);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-muted);
}

.stat-item i {
    color: var(--primary);
}

/* === CARD GRID === */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-6);
}

/* === BOOK CARDS === */
.book-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-slow);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid var(--border);
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-light);
}

.book-card.unavailable {
    opacity: 0.7;
}

.book-card.unavailable::after {
    content: 'No disponible';
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    background: var(--danger);
    color: white;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.book-cover-wrapper {
    position: relative;
    overflow: hidden;
    height: 320px;
}

.book-cover-placeholder {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 4rem;
    position: relative;
}

.book-cover-real {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-info {
    padding: var(--space-5);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.book-title {
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-meta {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-4);
    flex: 1;
}

.book-meta div {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-1);
}

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* === TABLES === */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-secondary);
}

.data-table th {
    padding: var(--space-4);
    text-align: left;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.text-center {
    text-align: center !important;
}

/* === RECOMMENDATIONS HERO === */
.recommendations-hero {
    padding: var(--space-10);
    border-radius: var(--radius-2xl);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-8);
    position: relative;
    overflow: hidden;
}

.hero-content {
    flex: 1;
}

.hero-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    margin-bottom: var(--space-4);
}

.hero-content h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.hero-content p {
    opacity: 0.9;
    max-width: 400px;
}

/* === LOADING === */
.loading-container {
    text-align: center;
    padding: var(--space-12);
}

.ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
}

.ai-icon {
    color: var(--primary);
    animation: pulse 2s infinite;
}

.ai-animation {
    display: flex;
    gap: var(--space-2);
}

.ai-animation span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.ai-animation span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-animation span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* === UTILITIES === */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === ACTIVE READING WIDGET === */
.active-reading-widget {
    margin: var(--space-4);
    padding: var(--space-4);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-xl);
}

/* === PANEL CARDS === */
.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* === LOAD MORE === */
.load-more-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-8) 0;
}

.load-more-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    color: var(--text-secondary);
    padding: var(--space-4) var(--space-8);
    border-radius: var(--radius-full);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.load-more-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
    }

    .sidebar-brand .brand-text,
    .nav-item span,
    .nav-section-title,
    .sidebar-version,
    .nav-new {
        display: none;
    }

    .sidebar-brand {
        justify-content: center;
    }

    .nav-item {
        justify-content: center;
        padding: var(--space-4);
    }

    .nav-badge {
        position: absolute;
        top: var(--space-1);
        right: var(--space-1);
        min-width: auto;
        padding: 0.1em 0.3em;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        padding: var(--space-2);
    }

    .sidebar-nav {
        display: flex;
        gap: var(--space-2);
        padding: 0;
        overflow-x: auto;
    }

    .nav-section {
        display: flex;
        gap: var(--space-2);
        margin-bottom: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .section {
        padding: var(--space-4);
    }

    .header-bar {
        padding: var(--space-4);
        flex-wrap: wrap;
        gap: var(--space-4);
    }

    .filters-container {
        flex-direction: column;
    }

    .search-wrapper,
    .category-filter-wrapper {
        width: 100%;
    }

    .recommendations-hero {
        flex-direction: column;
        text-align: center;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }
}

/* === PRINT === */
@media print {

    .sidebar,
    #toast-container,
    .filters-container,
    .btn {
        display: none !important;
    }

    .main-content {
        width: 100%;
    }

    .book-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* === ACCESIBILIDAD === */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--text-muted) var(--bg-secondary);
}

/* ============================================
   OPTIMIZACIONES DE RENDIMIENTO CSS v2.1
   ============================================ */

/* GPU Acceleration hints para animaciones */
.book-card,
.login-card,
.nav-item,
.btn {
    will-change: transform;
}

/* Containment para mejor rendering */
.book-card {
    contain: content;
}

.section {
    contain: layout style;
}

/* Optimización de filtros costosos solo cuando se necesitan */
.glass-panel {
    backface-visibility: hidden;
    transform: translateZ(0);
}

/* Prevenir layout shifts */
.book-cover-wrapper {
    aspect-ratio: 2 / 3;
}

/* Lazy loading de imágenes - reservar espacio */
img[loading="lazy"] {
    background: var(--bg-secondary);
}

/* Optimizar animaciones en scroll */
@supports (content-visibility: auto) {
    .section.hidden {
        content-visibility: hidden;
    }
}