/* ==================== VARIABLES Y CONFIGURACIÓN GLOBAL ==================== */
:root {
    /* Colores para tema claro */
    --primary-light: #36388a;
    --secondary-light: #3f257e;
    --dark-light: #1e293b;
    --light-light: #f8fafc;
    --text-light: #222b38;
    --bg-light: #ffffff;
    --card-light: #ffffff;
    --border-light: #e2e8f0;
    --shadow-light: rgba(0, 0, 0, 0.1);
    
    /* Colores para tema oscuro */
    --primary-dark: #151b53;
    --secondary-dark: #451bc4;
    --dark-dark: #f1f5f9;
    --light-dark: #0f172a;
    --text-dark: #e2e8f0;
    --bg-dark: #1e293b;
    --card-dark: #334155;
    --border-dark: #475569;
    --shadow-dark: rgba(0, 0, 0, 0.3);
    
    /* Colores actuales (por defecto claro) */
    --primary: var(--primary-light);
    --secondary: var(--secondary-light);
    --dark: var(--dark-light);
    --light: var(--light-light);
    --text: var(--text-light);
    --bg: var(--bg-light);
    --card: var(--card-light);
    --border: var(--border-light);
    --shadow: var(--shadow-light);
}

/* Tema oscuro */
body.dark-mode {
    --primary: var(--primary-dark);
    --secondary: var(--secondary-dark);
    --dark: var(--dark-dark);
    --light: var(--light-dark);
    --text: var(--text-dark);
    --bg: var(--bg-dark);
    --card: var(--card-dark);
    --border: var(--border-dark);
    --shadow: var(--shadow-dark);
}

/* Estilos globales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Transiciones suaves para el cambio de tema */
body {
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==================== HEADER ==================== */
header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 30px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    flex-shrink: 0;
}

.logo i {
    font-size: 1.4rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Barra de búsqueda */
.search-container {
    position: relative;
    width: 300px;
    min-width: 250px;
}

.search-input {
    width: 100%;
    padding: 8px 40px 8px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.8);
}

.search-input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.3);
}

.search-button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.3);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.search-button:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-50%) scale(1.1);
}

/* Botón de cambio de tema */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}

.theme-toggle i {
    position: absolute;
    transition: all 0.3s ease;
    font-size: 18px;
}

.theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg);
}

.theme-icon-moon {
    opacity: 0;
    transform: rotate(-180deg);
}

/* En modo oscuro */
body.dark-mode .theme-icon-sun {
    opacity: 0;
    transform: rotate(180deg);
}

body.dark-mode .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg);
}

/* Menú horizontal de categorías */
.category-nav {
    flex: 1;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 4px;
    margin-left: 20px;
}

.category-nav::-webkit-scrollbar {
    height: 4px;
}

.category-nav::-webkit-scrollbar-track {
    background: transparent;
}

.category-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.category-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.category-nav ul {
    display: flex;
    list-style: none;
    gap: 8px;
    margin: 0;
    padding: 0;
    white-space: nowrap;
}

.category-link {
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    display: block;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.category-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.category-link.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ==================== HERO SECTION ==================== */
.hero {
    background: linear-gradient(rgba(30, 41, 59, 0.7), rgba(30, 41, 59, 0.7)), url('https://images.unsplash.com/photo-1505142468610-359e7d316be0?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80') center/cover;
    color: white;
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 30px;
}

.hero p {
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ==================== GALLERY ==================== */
.gallery {
    margin-bottom: 2rem;
}

.section-title {
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    color: var(--dark);
}

/* Grid de wallpapers */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 0 10px;
}

/* Tarjetas de wallpaper limpias */
.wallpaper-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--card);
    aspect-ratio: 9/16;
}

.wallpaper-card.desktop {
    aspect-ratio: 16/9;
}

.wallpaper-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px var(--shadow);
}

/* Imágenes dentro de las tarjetas */
.wallpaper-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.wallpaper-card:hover .wallpaper-img {
    transform: scale(1.05);
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
    max-width: 95vw;
    max-height: 95vh;
    position: relative;
}

.modal-img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 30px var(--shadow);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--text);
    font-size: 2.5rem;
    cursor: pointer;
    background: var(--card);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;
}

.modal-close:hover {
    background: var(--border);
    transform: scale(1.1);
}

.modal-actions {
    display: flex;
    justify-content: center;
    margin-top: 20px;
    gap: 15px;
}

.modal-btn {
    background: var(--primary);
    color: rgb(255, 255, 255);
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.modal-btn:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.modal-btn i {
    font-size: 1.1rem;
}

/* ==================== FOOTER ==================== */
footer {
    background: var(--dark);
    color: rgb(0, 0, 0);
    padding: 2rem 0 0.8rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.footer-column h3 {
    margin-bottom: 0.8rem;
    font-size: 1.1rem;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 0.4rem;
}

.footer-column a {
    color: #070707;
    text-decoration: none;
    transition: color 0.3s;
    font-size: 0.9rem;
}

.footer-column a:hover {
    color: rgb(255, 255, 255);
}

.social-links {
    display: flex;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.062);
    border-radius: 50%;
    color: rgb(255, 255, 255);
    transition: background 0.3s;
}

.social-links a:hover {
    background: var(--primary);
}

.copyright {
    text-align: center;
    padding-top: 1.2rem;
    border-top: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.85rem;
}

.footer-column form input {
    width: 100%;
    padding: 0.6rem;
    border-radius: 5px;
    border: none;
    margin-bottom: 0.5rem;
    background: var(--card);
    color: var(--text);
}

.footer-column form button {
    width: 100%;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
    font-size: 0.9rem;
}

.footer-column form button:hover {
    background: var(--secondary);
}

/* ==================== PAGINACIÓN ==================== */
.pagination-container {
    margin-top: 3rem;
    text-align: center;
    padding: 0 20px;
}

.pagination-info {
    margin-bottom: 1rem;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.page-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    box-shadow: 0 2px 4px var(--shadow);
}

.page-btn:hover:not(:disabled) {
    background: var(--light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow);
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.page-btn.navigation {
    font-weight: 600;
    padding: 0.5rem 0.8rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
}

.page-btn.navigation:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    transform: translateY(-2px);
}

.page-btn.navigation i {
    margin: 0;
}

.page-numbers {
    display: flex;
    gap: 0.3rem;
    margin: 0 0.5rem;
}

.page-number {
    padding: 0.4rem 0.8rem;
}

.page-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-weight: 600;
    padding: 0 0.5rem;
}

/* ==================== NOTIFICACIONES ==================== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
}

.notification.info {
    background: #2196F3;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ==================== ESTADOS ESPECIALES ==================== */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text);
    font-size: 1rem;
}

.no-results i {
    font-size: 3rem;
    color: var(--border);
    margin-bottom: 1rem;
    display: block;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-left {
        width: 100%;
        justify-content: center;
    }
    
    .search-container {
        width: 100%;
        max-width: 400px;
    }
    
    .header-right {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .category-nav {
        width: 100%;
        order: 2;
    }
    
    .theme-toggle {
        order: 1;
        align-self: center;
    }
}

@media (max-width: 768px) {
    header {
        padding: 0.6rem 0;
    }
    
    .header-content {
        padding: 0 15px;
    }
    
    .header-left {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo {
        width: 100%;
        justify-content: center;
    }
    
    .search-container {
        max-width: none;
    }
    
    .category-link {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .category-nav ul {
        gap: 6px;
    }
    
    .theme-toggle {
        width: 35px;
        height: 35px;
    }
    
    .theme-toggle i {
        font-size: 16px;
    }
    
    .wallpaper-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .modal-img {
        max-height: 65vh;
        border-radius: 4px;
    }
    
    .modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }
    
    .modal-actions {
        margin-top: 15px;
    }
    
    .modal-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .pagination-container {
        margin-top: 2rem;
        padding: 0 15px;
    }
    
    .pagination-info {
        font-size: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    .pagination-controls {
        gap: 0.3rem;
    }
    
    .page-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
        min-width: 35px;
        height: 35px;
    }
    
    .page-btn.navigation {
        padding: 0.4rem 0.6rem;
    }
}

@media (max-width: 480px) {
    .search-input {
        font-size: 12px;
        padding: 6px 35px 6px 12px;
    }
    
    .search-button {
        width: 25px;
        height: 25px;
        right: 3px;
    }
    
    .category-link {
        font-size: 12px;
        padding: 5px 10px;
    }
    
    .category-nav ul {
        gap: 4px;
    }
    
    .theme-toggle {
        width: 30px;
        height: 30px;
    }
    
    .theme-toggle i {
        font-size: 14px;
    }
    
    .wallpaper-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    .filter-btn {
        font-size: 0.8rem;
        padding: 0.3rem 1rem;
    }
    
    .page-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        min-width: 30px;
        height: 30px;
    }
    
    .page-btn.navigation {
        padding: 0.3rem 0.5rem;
    }
    
    .page-btn.navigation i {
        font-size: 0.8rem;
    }
    
    .page-numbers {
        gap: 0.15rem;
    }
    
    .page-dots {
        padding: 0 0.2rem;
        font-size: 0.75rem;
    }
}

/* ==================== ANIMACIONES ADICIONALES ==================== */
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Estados de carga */
.loading .wallpaper-grid {
    opacity: 0.6;
    pointer-events: none;
}

.wallpaper-grid {
    transition: opacity 0.3s ease;
}

.wallpaper-grid.updating {
    opacity: 0.7;
}