/* public/css/styles.css */
:root {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --header-bg: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body.dark {
    --bg-body: #1f2937;
    --bg-card: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border: #4b5563;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e3a5f;
    --header-bg: #111827;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    transition: var(--transition);
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
.header {
    background: var(--header-bg);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    position: sticky;
    top: 1rem;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(var(--header-bg-rgb, 255, 255, 255), 0.9);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Botones */
.theme-toggle, .reload-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 1.2rem;
    border-radius: 2rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary);
    transition: var(--transition);
}

.theme-toggle:hover, .reload-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Filtros */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
}

.search-box {
    flex: 2;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.brand-filter select {
    padding: 0.7rem 1rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
    min-width: 200px;
}

.brand-filter select:focus {
    border-color: var(--accent);
}

/* Stats */
.stats {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
    padding: 0.5rem;
    background: var(--accent-light);
    border-radius: 2rem;
}

/* Grid de productos */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.product-card {
    background: var(--bg-card);
    border-radius: 1rem;
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
}

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

.product-img {
    height: 200px;
    background: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

body.dark .product-img {
    background: linear-gradient(135deg, #334155, #1e293b);
}

.product-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.product-card:hover .product-img img {
    transform: scale(1.05);
}

.product-img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 3rem;
}

.product-info {
    padding: 1rem;
}

.brand {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0.5rem 0;
    line-height: 1.4;
    min-height: 2.8rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.sku {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: monospace;
    margin: 0.25rem 0;
}

.price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0.5rem 0;
}

.no-price {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Paginación */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 2rem 0;
}

.page-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
}

.page-btn:hover:not(.active):not(.disabled) {
    background: var(--border);
}

.page-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
}

.loading p {
    margin-top: 1rem;
    color: var(--text-muted);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 1rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1rem;
}

.modal-product-img {
    width: 200px;
    height: 200px;
    object-fit: contain;
    margin: 0 auto 1rem;
    display: block;
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container { padding: 1rem; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .filters { flex-direction: column; align-items: stretch; }
    .search-box input, .brand-filter select { width: 100%; }
    .header { position: relative; top: 0; }
}

@media (max-width: 480px) {
    .products-grid { grid-template-columns: 1fr; }
    .header-top { flex-direction: column; }
}

/* Animaciones */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-card {
    animation: fadeIn 0.5s ease;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--border);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}