/* ===== COMPONENTES REUTILIZABLES ===== */

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    font-size: 0.875rem;
    line-height: 1.2;
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary-color) 18%, transparent);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card-gradient {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-tertiary));
}

.surface-card {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--border-color) 88%, white 12%);
    border-radius: calc(var(--radius-lg) + 0.15rem);
    box-shadow:
        0 18px 36px rgba(15, 23, 42, 0.08),
        0 1px 0 rgba(255, 255, 255, 0.06) inset;
}

[data-theme="dark"] .surface-card {
    background:
        linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 96%, white 4%), var(--bg-card));
    box-shadow:
        0 22px 40px rgba(2, 6, 23, 0.26),
        0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.section-card {
    padding: clamp(1.4rem, 2vw, 1.9rem);
    border-radius: calc(var(--radius-xl) + 0.1rem);
}

.page-hero {
    position: relative;
    overflow: hidden;
}

.page-hero::after {
    content: "";
    position: absolute;
    inset: auto -3rem -5rem auto;
    width: 14rem;
    height: 14rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-color) 16%, transparent);
    filter: blur(22px);
    pointer-events: none;
}

.page-hero h1,
.section-card h2 {
    letter-spacing: -0.03em;
}

.page-hero-dark::after {
    background: rgba(255, 255, 255, 0.12);
}

.lift-hover-card {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

@media (hover: hover) {
    .lift-hover-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-xl);
    }
}

.content-carousel-shell,
.home-carousel-shell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 1rem;
}

.content-carousel-nav,
.home-carousel-nav {
    align-self: center;
    width: 3rem;
    min-width: 3rem;
    height: 3rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), opacity var(--transition-fast);
}

.content-carousel-nav:hover:not(:disabled),
.home-carousel-nav:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.content-carousel-nav:disabled,
.home-carousel-nav:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Grids */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary { background: var(--primary-color); color: white; }
.badge-success { background: #10b981; color: white; }
.badge-warning { background: #f59e0b; color: white; }
.badge-danger { background: #ef4444; color: white; }

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input,
.input-group select,
.input-group textarea {
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
    min-height: 48px;
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.input-group textarea {
    min-height: 110px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--spacing-lg);
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all var(--transition-fast);
    position: relative;
}

.tab:hover {
    color: var(--primary-color);
}

.tab.active {
    color: var(--primary-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: var(--spacing-xl);
}

.pagination-shell {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.page-item {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-item:hover,
.page-item.active {
    background: var(--primary-color);
    color: white;
}

.pagination-button {
    min-width: 2.75rem;
    min-height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    box-shadow: var(--shadow-md);
}

.pagination-button:hover:not(:disabled),
.pagination-button.active {
    color: white;
    background: var(--primary-color);
    border-color: color-mix(in srgb, var(--primary-color) 68%, var(--border-color));
}

.pagination-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 0 var(--spacing-sm);
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .content-carousel-shell,
    .home-carousel-shell {
        grid-template-columns: 1fr;
    }

    .content-carousel-nav,
    .home-carousel-nav {
        width: 100%;
        border-radius: var(--radius-lg);
    }
}

/* Página de error */
.error-page {
    text-align: center;
    padding: var(--spacing-xl);
}

.error-page i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.error-page h2 {
    margin-bottom: var(--spacing-sm);
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: var(--spacing-lg);
}

/* Search results */
.search-result-item {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.search-result-item:hover {
    background: var(--bg-tertiary);
}

.search-result-item i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.search-result-item strong {
    display: block;
    color: var(--text-primary);
}

.search-result-item p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 4px 0;
}

.search-result-item small {
    font-size: 0.75rem;
    color: var(--primary-color);
}

.search-no-results {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-muted);
}
