/* Estilos personalizados para Emprendedores Artesanales */

/* Normalización de proporción y desbordes */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

img, video, svg {
    max-width: 100%;
    height: auto;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --accent-color: #60a5fa;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1e3a8a;
    --light-color: #f0f9ff;
}

/* Personalización de Bootstrap */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--dark-color);
    border-color: var(--dark-color);
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

/* Estilos generales */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Ajuste global de tamaños de texto para mejor proporción */
h1, .h1 { font-size: clamp(1.6rem, 2.6vw, 2.4rem); }
h2, .h2 { font-size: clamp(1.4rem, 2.2vw, 2rem); }
h3, .h3 { font-size: clamp(1.2rem, 1.9vw, 1.6rem); }
h4, .h4 { font-size: clamp(1.1rem, 1.6vw, 1.4rem); }
h5, .h5 { font-size: clamp(1rem, 1.3vw, 1.2rem); }
h6, .h6 { font-size: clamp(0.95rem, 1.1vw, 1.05rem); }

.display-1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.display-2 { font-size: clamp(1.9rem, 4vw, 3rem); }
.display-3 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
.display-4 { font-size: clamp(1.7rem, 3vw, 2.4rem); }
.display-5 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); }
.display-6 { font-size: clamp(1.5rem, 2.4vw, 2rem); }

.lead { font-size: clamp(1rem, 1.4vw, 1.2rem); }

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 500px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9) 0%, rgba(59, 130, 246, 0.8) 100%);
    z-index: 1;
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-section img {
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Cards mejoradas */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 15px;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

/* Iconos de características */
.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    transition: all 0.3s ease;
}

.feature-icon:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.3);
}

/* Productos */
.product-card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.product-image {
    height: 250px;
    object-fit: contain;
    object-position: center center;
    background: #f8fafc;
    transition: none;
}

.product-card:hover .product-image {
    transform: none;
}

.product-card .product-summary {
    display: -webkit-box;
    min-height: 4.5em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.product-card .card-title {
    display: -webkit-box;
    min-height: 2.6em;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: flex-end;
    padding: 1rem;
}

.product-card:hover .product-overlay {
    opacity: 1;
}

/* Calificaciones */
.rating {
    color: #FFD700;
}

.rating .fa-star {
    font-size: 0.9rem;
}

/* Badges de precio */
.price-badge {
    background: linear-gradient(45deg, var(--success-color), #32CD32);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-weight: bold;
    display: inline-block;
}

/* Formularios mejorados */
.form-control {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(139, 69, 19, 0.25);
}

.btn {
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

/* Navegación */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
}

/* Dashboard */
.dashboard-card {
    background: linear-gradient(135deg, #fff 0%, var(--light-color) 100%);
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.08);
}

.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* Modal mejorado */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 20px 60px rgba(37, 99, 235, 0.15);
}

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

/* Alertas personalizadas */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Paginación */
.pagination .page-link {
    border-radius: 50%;
    margin: 0 0.2rem;
    border: none;
    color: var(--primary-color);
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Footer */
footer {
    background: linear-gradient(135deg, var(--dark-color) 0%, #1e40af 100%);
}

.social-links a {
    transition: color 0.3s ease;
}

.social-links .social-icon-static {
    color: #ffffff;
    display: inline-block;
    cursor: default;
}

.social-links a:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

/* Búsqueda */
.search-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    padding-right: 3rem;
}

.search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: none;
    color: var(--primary-color);
}

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

.fade-in-up {
    animation: fadeInUp 0.6s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-section {
        text-align: center;
        padding: 3rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .feature-icon {
        width: 60px;
        height: 60px;
    }
    
    .product-image {
        height: 200px;
    }
}

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
}

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

/* Utilidades */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(37, 99, 235, 0.3);
}

.box-shadow {
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.1);
}

.gradient-bg {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* Efectos adicionales para el nuevo esquema azul */
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--dark-color) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.3);
}

.feature-icon {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
}

/* Mejorar el contraste de los enlaces */
a {
    color: var(--primary-color);
    transition: all 0.3s ease;
}

a:hover {
    color: var(--dark-color);
}

/* Efectos de cristal para cards */
.card {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(37, 99, 235, 0.1);
}

/* Navegación con efecto glassmorphism */
.navbar-dark {
    background: rgba(30, 58, 138, 0.95) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(37, 99, 235, 0.2);
}

/* Botones con efectos mejorados */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

/* Mejora visual para formularios */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
    background-color: rgba(240, 249, 255, 0.5);
}

/* Animación de pulso para elementos importantes */
@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.btn-primary:focus {
    animation: pulse-blue 1.5s infinite;
}

/* WhatsApp gradient button (catalog + home) */
.btn-whatsapp-gradient {
    background: linear-gradient(45deg, #25d366, #128c7e);
    color: #ffffff;
    border: none;
    border-radius: 20px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.btn-whatsapp-gradient:hover,
.btn-whatsapp-gradient:focus {
    background: linear-gradient(45deg, #128c7e, #075e54);
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.35);
}

/* Botón de cierre de sesión disponible en los encabezados administrativos. */
.admin-topbar-logout {
    position: relative;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #d6deea;
    border-radius: 12px;
    background: #ffffff;
    color: #1f3655;
    font-size: 1.45rem;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(31, 54, 85, 0.12);
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    z-index: 20;
}

.admin-topbar-logout:hover,
.admin-topbar-logout:focus-visible {
    background: #1f3655;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 7px 16px rgba(31, 54, 85, 0.22);
}

.admin-topbar-logout::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    width: max-content;
    padding: 7px 11px;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.2;
    box-shadow: 0 5px 16px rgba(15, 23, 42, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 10050;
}

.admin-topbar-logout:hover::after,
.admin-topbar-logout:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/*
 * Ancho uniforme del menú lateral del panel administrativo.
 * Las páginas antiguas declaran 280px en estilos internos; estas reglas
 * centralizadas liberan más espacio para tablas y formularios.
 */
@media (min-width: 769px) {
    .admin-sidebar:not(.collapsed) {
        width: 240px !important;
    }

    .admin-content:not(.expanded) {
        margin-left: 240px !important;
    }
}
