/* =================================================================
   SISTEMA DE ESTILOS DE CORTE PROFESIONAL - PLATAFORMA E-COMMERCE
   ================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@400;500;600;700&family=Poppins:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&family=Open+Sans:wght@400;600;700&display=swap');

/* --- PALETAS DE COLORES PREDEFINIDAS --- */
:root, [data-theme="blue"] {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --accent-color: #3b82f6;
}

[data-theme="emerald"] {
    --primary-color: #059669;
    --primary-hover: #047857;
    --primary-light: #ecfdf5;
    --accent-color: #10b981;
}

[data-theme="orange"] {
    --primary-color: #ea580c;
    --primary-hover: #c2410c;
    --primary-light: #fff7ed;
    --accent-color: #f97316;
}

[data-theme="purple"] {
    --primary-color: #7c3aed;
    --primary-hover: #6d28d9;
    --primary-light: #f5f3ff;
    --accent-color: #8b5cf6;
}

/* --- TEMA CLARO (LIGHT MODE) POR DEFECTO --- */
:root {
    --base-font-size: 16px;
    --font-family: 'Inter', sans-serif;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-secondary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --grid-cols: 4;
}

/* --- MODO OSCURO (DARK MODE) --- */
body.dark-mode {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-header: #1e293b;
    --bg-secondary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
    --primary-light: rgba(37, 99, 235, 0.15);
}

/* --- RESETEO & ACCESIBILIDAD --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: var(--base-font-size);
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- TOP ACCESSIBILITY & CONTROLS BAR --- */
.top-bar {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 6px 20px;
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.top-bar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon-text {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}

.btn-icon-text:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-lang {
    font-weight: 600;
    padding: 2px 6px;
}
.btn-lang.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- HEADER & NAVBAR --- */
.main-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.search-box {
    flex: 1;
    max-width: 480px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 8px 16px 8px 38px;
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-btn-wrapper {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background-color: #ef4444;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- NAVBAR CATEGORIES & DENSITY TOOLBAR --- */
.nav-subbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
}

.nav-subbar-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    overflow-x: auto;
}

.category-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.chip {
    background-color: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.chip:hover, .chip.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.grid-density-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.grid-density-controls input[type="range"] {
    accent-color: var(--primary-color);
    cursor: pointer;
    width: 100px;
}

/* --- MAIN CONTAINER --- */
.main-content {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px;
}

/* --- HERO BANNER --- */
.hero-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    border-radius: var(--radius-lg);
    padding: 36px 32px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.hero-text h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-text p {
    opacity: 0.9;
    font-size: 1.05rem;
}

/* --- CATALOG PRODUCT GRID --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols, 4), minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(min(var(--grid-cols, 4), 3), minmax(0, 1fr));
    }
}
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(min(var(--grid-cols, 4), 2), minmax(0, 1fr));
    }
}
@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* --- PRODUCT CARD --- */
.product-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.product-img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background-color: var(--bg-secondary);
    overflow: hidden;
}

.product-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.product-info {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-category {
    font-size: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    line-height: 1.3;
}

.product-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-bottom {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border-color);
}

.price-box {
    display: flex;
    flex-direction: column;
}

.original-price {
    font-size: 0.8rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

.final-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background-color: var(--bg-secondary);
    border-color: var(--text-secondary);
}

/* --- SKELETON ANIMATIONS --- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border-color) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 1.5s infinite ease-in-out;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.skeleton-img { width: 100%; height: 160px; }
.skeleton-title { width: 70%; height: 20px; }
.skeleton-text { width: 90%; height: 14px; }
.skeleton-price { width: 40%; height: 24px; }

/* --- PAGINATION & INFINITE SCROLL --- */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 20px 0;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
}
.page-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#infinite-scroll-sentinel {
    height: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 10px;
}

/* --- MODALS & BACKDROP --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close-btn {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 24px;
}

/* --- FORMS & INPUTS --- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.help-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* --- TOAST NOTIFICATIONS --- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 280px;
    max-width: 380px;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: toast-slide-in 0.3s forwards;
}

.toast.success { border-left-color: #10b981; }
.toast.error { border-left-color: #ef4444; }
.toast.info { border-left-color: #3b82f6; }

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- ADMIN PANEL TABS & DASHBOARD --- */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    gap: 12px;
    overflow-x: auto;
}

.admin-tab-btn {
    padding: 10px 18px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
}

.admin-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.admin-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

/* --- TABLE STYLES --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.custom-table th, .custom-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.custom-table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- FOOTER --- */
.main-footer {
    background-color: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 40px 20px 20px;
    margin-top: auto;
}

.footer-container {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 32px;
    margin-bottom: 30px;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.footer-section p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.newsletter-form {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.newsletter-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}
