/* ===== CATÁLOGO PRINCIPAL ===== */
.catalog-main {
    min-height: 100vh;
    background: transparent;
}

.category-section {
    margin-bottom: var(--space-xl);
    position: relative;
    background: linear-gradient(135deg, #FFFFFF 0%, #FAF7F2 100%);
    padding: var(--space-lg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(230, 57, 70, 0.05);
}

.category-header {
    background: linear-gradient(to right, var(--bg-white), var(--bg-light));
    padding: 2rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    border-left: 6px solid var(--primary);
    box-shadow: var(--shadow-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.category-header::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary);
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, -30%);
}

.category-title {
    font-size: 2rem;
    color: var(--text-dark);
    margin: 0;
    font-weight: 700;
    position: relative;
    z-index: 2;
}

.category-description {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

/* ===== GRID DE PRODUCTOS ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    background: transparent;
    padding: 1rem;
}

.product-card-modern {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    border: 1px solid var(--border-light);
    position: relative;
    animation: fadeInUp 0.5s ease forwards;
}

.product-card-modern:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.product-card-modern:nth-child(1) { animation-delay: 0.1s; }
.product-card-modern:nth-child(2) { animation-delay: 0.2s; }
.product-card-modern:nth-child(3) { animation-delay: 0.3s; }
.product-card-modern:nth-child(4) { animation-delay: 0.4s; }

.product-image {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--border-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-lighter);
}

.product-image i {
    font-size: 3rem;
    opacity: 0.5;
}

.product-info {
    padding: var(--space-md);
}

.product-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-dark);
    line-height: 1.4;
}

.product-category {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: var(--space-sm);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.product-footer-modern {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-md);
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.product-stock {
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-light);
    color: var(--text-light);
}

.product-stock.low {
    background: #FFF3CD;
    color: #856404;
}

.product-stock.out {
    background: #F8D7DA;
    color: #721C24;
}

/* ===== HISTORIAL DE COMPRAS ===== */
.historial-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(230, 57, 70, 0.2);
}

.historial-title {
    color: white;
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.historial-subtitle {
    opacity: 0.9;
    font-size: 1.1rem;
}

.historial-content {
    max-width: 800px;
    margin: 0 auto;
    background: #FFFFFF;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

/* Estados del historial */
.historial-loading,
.historial-not-logged,
.historial-empty {
    text-align: center;
    padding: var(--space-xl);
}

.historial-loading i {
    font-size: 2rem;
    margin-bottom: var(--space-md);
    color: var(--primary);
}

.empty-state {
    padding: var(--space-xl);
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-lighter);
    margin-bottom: var(--space-md);
}

.empty-state h3 {
    margin-bottom: var(--space-sm);
    color: var(--text-dark);
}

.empty-state p {
    color: var(--text-light);
    margin-bottom: var(--space-lg);
}

/* ===== LISTA DE PEDIDOS ===== */
.pedidos-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.pedido-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAF7F2 100%);
    border: 1px solid rgba(230, 57, 70, 0.1);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.pedido-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.pedido-info h4 {
    margin-bottom: 0.25rem;
    color: var(--text-dark);
}

.pedido-fecha {
    color: var(--text-light);
    font-size: 0.9rem;
}

.pedido-estado {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.estado-completado {
    background: #D1FAE5;
    color: #065F46;
}

.estado-pendiente {
    background: #FEF3C7;
    color: #92400E;
}

.estado-cancelado {
    background: #FEE2E2;
    color: #991B1B;
}

.pedido-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-align: right;
}

.pedido-items {
    margin-top: var(--space-md);
}

.pedido-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.pedido-item:last-child {
    border-bottom: none;
}

.item-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex: 1;
}

.item-cantidad {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.item-nombre {
    font-weight: 500;
    color: var(--text-dark);
}

.item-precio {
    color: var(--text-light);
    font-size: 0.9rem;
}

.item-subtotal {
    font-weight: 600;
    color: var(--text-dark);
}

/* ===== VISTA PERFIL ===== */
.profile-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
}

.profile-title {
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.profile-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.profile-content {
    max-width: 600px;
    margin: 0 auto;
}

.coming-soon {
    text-align: center;
    padding: var(--space-xl);
    background: var(--bg-light);
    border-radius: var(--radius-lg);
}

.coming-soon i {
    font-size: 4rem;
    color: var(--text-lighter);
    margin-bottom: var(--space-md);
}

.coming-soon h3 {
    margin-bottom: var(--space-sm);
    color: var(--text-dark);
}

.coming-soon p {
    color: var(--text-light);
    margin-bottom: var(--space-lg);
}

/* ===== 🔧 PANTALLA DE BIENVENIDA ADMIN ===== */
.admin-welcome {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.welcome-card {
    background: white;
    border-radius: 20px;
    padding: 50px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    max-width: 500px;
    width: 100%;
    border: 1px solid var(--border-light);
    animation: fadeInUp 0.6s ease;
}

.welcome-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 2.5rem;
    color: white;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.3);
}

.welcome-card h2 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 2.2rem;
    font-weight: 700;
}

.welcome-card p {
    color: var(--text-light);
    margin-bottom: 35px;
    font-size: 1.2rem;
    line-height: 1.6;
}

.btn-admin-enter {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.btn-admin-enter:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(79, 70, 229, 0.4);
}

.btn-admin-enter:active {
    transform: translateY(-1px);
}

.welcome-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-light);
}

.welcome-stat {
    text-align: center;
    padding: 15px;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ===== 🔧 PANEL COMPLETO DE ADMIN ===== */
.admin-panel-full {
    animation: fadeIn 0.5s ease;
}

.admin-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: transparent;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-light);
}

.admin-title-section h2 {
    color: var(--text-dark);
    margin-bottom: 5px;
    font-size: 2rem;
}

.admin-subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

/* 🔧 ESTADÍSTICAS - ESTRUCTURA CORREGIDA */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #FFFFFF 0%, #FFF8F0 100%);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 4px solid var(--primary);
    border: 1px solid rgba(230, 57, 70, 0.1);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
}

.stat-info h3 {
    font-size: 2rem;
    margin-bottom: 5px;
    color: var(--text-dark);
}

.stat-info p {
    color: var(--text-light);
    margin: 0;
}

/* 🔧 PESTAÑAS DEL ADMIN */
.admin-tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    gap: 10px;
}

.admin-tab {
    flex: 1;
    padding: 15px 20px;
    text-align: center;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.admin-tab.active {
    background: var(--primary);
    color: white;
}

.admin-tab:hover:not(.active) {
    background: var(--primary-light);
    color: var(--primary);
}

/* 🔧 CONTENIDO DE LAS PESTAÑAS */
.admin-tab-content {
    background: linear-gradient(135deg, #FFFFFF 0%, #FAF7F2 100%);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid rgba(230, 57, 70, 0.1);
}

.tab-pane {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-pane.active {
    display: block;
}

/* 🔧 TABLAS DEL ADMIN */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

.admin-table th {
    background: var(--primary-light);
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-light);
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

/* 🔧 FORMULARIOS DEL ADMIN */
.admin-product-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* 🔧 BOTONES DE ACCIÓN */
.btn-action {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-edit {
    background: #e3f2fd;
    color: #1976d2;
}

.btn-edit:hover {
    background: #bbdefb;
}

.btn-delete {
    background: #ffebee;
    color: #d32f2f;
}

.btn-delete:hover {
    background: #ffcdd2;
}

/* 🔧 SECCIONES ESPECÍFICAS DEL ADMIN */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

.tab-header h3 {
    color: var(--text-dark);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.products-table-container,
.orders-table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

/* ===== ANIMACIONES ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    /* Welcome Admin Responsive */
    .admin-welcome {
        padding: 20px 15px;
    }
    
    .welcome-card {
        background: linear-gradient(135deg, #FFFFFF 0%, #FAF7F2 100%);
        border-radius: 20px;
        padding: 50px 40px;
        text-align: center;
        box-shadow: 0 20px 60px rgba(0,0,0,0.1);
        border: 1px solid rgba(230, 57, 70, 0.1);
    }
    
    .welcome-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .welcome-card h2 {
        font-size: 1.8rem;
    }
    
    .btn-admin-enter {
        padding: 15px 30px;
        font-size: 1rem;
    }
    
    .welcome-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    /* Panel Admin Responsive */
    .admin-container {
        padding: 15px;
    }
    
    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
    }
    
    .admin-tabs {
        flex-direction: column;
    }
    
    .admin-tab-content {
        padding: 20px;
    }
    
    .tab-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .admin-container {
        padding: 10px;
    }
    
    .admin-title-section h2 {
        font-size: 1.5rem;
    }
    
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .admin-tab-content {
        padding: 15px;
    }
}

/* Responsive General para otras vistas */
@media (max-width: 768px) {
    .pedido-header {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: start;
    }
    
    .pedido-total {
        text-align: left;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .pedido-item {
        flex-direction: column;
        align-items: start;
        gap: var(--space-sm);
    }
    
    .item-info {
        width: 100%;
    }
}
/* 🔧 SOLUCIÓN DEFINITIVA - FORZAR CENTRADO DESDE EL CSS */
#adminWelcome {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 0 auto !important;
}

.welcome-card {
    text-align: center !important;
    margin: 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 500px !important;
}

.btn-admin-enter {
    text-align: center !important;
    margin: 20px auto !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: auto !important;
    min-width: 200px !important;
    float: none !important;
}

.welcome-stats {
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 15px !important;
    margin: 0 auto !important;
    width: 100% !important;
}

.welcome-stat {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    float: none !important;
}

/* 🔧 RESET COMPLETO PARA FORZAR CENTRADO */
#viewAdmin .main-container {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

#viewAdmin .view-content {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
}

/* 🔧 ANULAR CUALQUIER text-align: left */
#adminWelcome * {
    text-align: center !important;
    float: none !important;
}
