/* ============================================
   BIBLIOTECH PRO - COMPONENTES PREMIUM
   Estilos específicos para componentes UI
   ============================================ */

/* === PANEL CARDS === */
.panel-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: var(--space-6);
    border: 1px solid var(--border);
    transition: all var(--transition-slow);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.panel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-slow);
}

.panel-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
}

.panel-card:hover::before {
    transform: scaleX(1);
}

.panel-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.panel-card-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.panel-card-title i {
    color: var(--primary);
}

/* === PAGINATION === */
.load-more-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-8) 0;
    margin-top: var(--space-4);
    position: relative;
}

.load-more-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    max-width: 400px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.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: all var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-family: inherit;
}

.load-more-btn:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), 0 4px 14px rgba(99, 102, 241, 0.25);
}

.load-more-btn:active {
    transform: translateY(-1px);
}

.load-more-btn i {
    transition: transform var(--transition-base);
}

.load-more-btn:hover i {
    transform: rotate(180deg);
}

/* === TOAST NOTIFICATIONS === */
.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 300px;
    max-width: 450px;
    animation: toast-slide-in 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--primary);
    animation: toast-progress 5s linear forwards;
}

@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.8);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-progress {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

.toast-icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.toast-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-success .toast-icon {
    color: var(--success);
}

.toast.toast-success::before {
    background: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast.toast-error .toast-icon {
    color: var(--danger);
}

.toast.toast-error::before {
    background: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-warning .toast-icon {
    color: var(--warning);
}

.toast.toast-warning::before {
    background: var(--warning);
}

.toast.toast-info {
    border-left-color: var(--info);
}

.toast.toast-info .toast-icon {
    color: var(--info);
}

.toast.toast-info::before {
    background: var(--info);
}

/* === MODAL DIALOGS === */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: modal-fade-in 0.2s ease-out;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    animation: modal-scale-in 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes modal-scale-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

/* === EMPTY STATES === */
.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state-title {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    max-width: 300px;
    margin: 0 auto;
}

/* === STAT CARDS === */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    transition: all var(--transition-slow);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-2xl);
    color: white;
}

.stat-icon.primary {
    background: var(--gradient-primary);
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--warning) 0%, #D97706 100%);
}

.stat-icon.danger {
    background: linear-gradient(135deg, var(--danger) 0%, #DC2626 100%);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: var(--space-1);
}

.stat-label {
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === PROGRESS BARS === */
.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.3),
            transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* === AVATARS === */
.avatar {
    border-radius: var(--radius-full);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--gradient-primary);
    color: white;
}

.avatar-xs {
    width: 24px;
    height: 24px;
    font-size: var(--text-xs);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: var(--text-base);
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: var(--text-xl);
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: var(--text-2xl);
}

/* === TAGS/CHIPS === */
.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.tag:hover {
    background: var(--primary-subtle);
    color: var(--primary);
}

.tag-primary {
    background: var(--primary-subtle);
    color: var(--primary);
}

.tag-success {
    background: var(--success-light);
    color: var(--success);
}

.tag-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.tag-danger {
    background: var(--danger-light);
    color: var(--danger);
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-secondary) 25%,
            rgba(255, 255, 255, 0.1) 50%,
            var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
    width: 70%;
}

.skeleton-avatar {
    border-radius: var(--radius-full);
}

.skeleton-card {
    height: 200px;
    border-radius: var(--radius-xl);
}

/* === FORM VALIDATION === */
.form-input.is-valid {
    border-color: var(--success);
}

.form-input.is-valid:focus {
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.form-input.is-invalid {
    border-color: var(--danger);
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.form-feedback {
    font-size: var(--text-xs);
    margin-top: var(--space-1);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.form-feedback.is-valid {
    color: var(--success);
}

.form-feedback.is-invalid {
    color: var(--danger);
}

/* === DIVIDERS === */
.divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* === COPY BUTTON === */
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: var(--text-xs);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.copy-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary);
    border-color: var(--primary);
}

.copy-btn.copied {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

/* =========================================
   PWA Components
   ========================================= */

#pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    max-width: 90%;
    animation: slide-up 0.5s ease-out;
}

.pwa-icon {
    font-size: 1.5rem;
}

.pwa-content {
    display: flex;
    flex-direction: column;
}

.pwa-title {
    font-weight: 700;
}

.pwa-subtitle {
    font-size: 0.8rem;
    opacity: 0.9;
}

#pwa-install-btn {
    background: white;
    color: #6366F1;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

#pwa-install-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

#pwa-dismiss-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

#pwa-dismiss-btn:hover {
    opacity: 1;
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translate(-50%, 20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}