/* public/styles.css — VERSIÓN CON SISTEMA DE GRUPOS Y NUEVOS NIVELES DE COLABORACIÓN */

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

html {
    /* sin overflow-x hidden — position:fixed del nav no necesita este hack */
}

body {
    font-family: var(--font-body, 'Barlow', 'Segoe UI', sans-serif);
    background: var(--bg-page, #0F172A);
    min-height: 100vh;
    color: var(--text-primary, #0F172A);
    line-height: 1.6;
    /* NO overflow-x:hidden aquí — en iOS Safari rompe position:fixed */
}

.main-navigation {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    padding: 0;
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 60px;
}

/* ✅ ELIMINADO - Estilos duplicados, ya están en navigation.css */

.nav-links {
    display: flex;
    gap: 0;
}

.nav-link {
    display: inline-block;
    padding: 18px 25px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    position: relative;
}

.nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
    border-bottom-color: #3498db;
}

.nav-link.active {
    color: white;
    background: rgba(255,255,255,0.15);
    border-bottom-color: #e74c3c;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== HEADER UNIFICADO ===== */
.header-unified {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.header-unified h1 {
    font-size: 1.8rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    opacity: 0.9;
}

.header-unified #stats-inline {
    font-weight: 400;
    opacity: 0.8;
    font-size: 0.9em;
}

.welcome-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
}

.welcome-title #stats-inline {
    font-weight: 400;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.75);
}

/* MANTENER COMPATIBILIDAD CON ESTILOS ANTERIORES */
.header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.stats-mini {
    text-align: center;
    color: white;
    margin-bottom: 25px;
    font-size: 0.95rem;
    opacity: 0.85;
    font-weight: 500;
}

.search-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
}

.search-section h3 {
    margin-bottom: 25px;
    color: #333;
    font-size: 1.3rem;
    font-weight: 600;
}

/* ===== LAYOUT HORIZONTAL EN UNA SOLA FILA ===== */
.search-section-compact {
    margin-bottom: 20px;
    scroll-margin-top: 70px; /* compensa nav fija en scroll-into-view (iOS) */
}

/* Toggle filtros: solo visible en móvil */
.btn-filters-toggle {
    display: none;
}

.search-single-row {
    display: flex;
    align-items: stretch;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    flex-wrap: nowrap;
    min-height: 60px;
}

.search-input-container {
    flex: 2.2;
    min-width: 260px;
    display: flex;
    align-items: center;
}

.search-input-hero {
    padding: 14px 18px;
    font-size: 1.15rem;
    border: 2px solid #e3f2fd;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
    transition: all 0.3s ease;
    font-weight: 500;
    width: 100%;
    height: 100%;
}

.search-input-hero:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.2);
}

.search-input-hero::placeholder {
    color: #90a4ae;
    font-weight: 400;
}

.filters-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1.5;
    min-width: 180px;
}

.filters-row-top,
.filters-row-bottom {
    display: flex;
    gap: 8px;
}

.filters-row-top select,
.filters-row-bottom select {
    padding: 8px 10px;
    font-size: 0.8rem;
    border: 1px solid #cfd8dc;
    border-radius: 5px;
    background: white;
    transition: all 0.2s ease;
    font-weight: 500;
    flex: 1;
    min-width: 80px;
}

.filters-row-top select:focus,
.filters-row-bottom select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.descuento-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff3cd;
    padding: 12px 20px;
    border-radius: 10px;
    border: 2px solid #ffeaa7;
    white-space: nowrap;
    min-height: 50px;
    min-width: 120px;
    flex: 0.8;
}

.descuento-group label {
    font-size: 1.4rem;
    margin: 0;
}

.descuento-group input {
    width: 65px;
    padding: 10px 12px;
    font-size: 1.2rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    text-align: center;
    font-weight: 700;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.descuento-group span {
    font-weight: bold;
    color: #856404;
    font-size: 1.2rem;
}

.descuento-group.descuento-activo {
    background: #d4e5a9;
    border-color: #c3d82c;
    box-shadow: 0 2px 8px rgba(195, 216, 44, 0.3);
}

.iva-group {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #d1ecf1;
    padding: 6px 10px;
    border-radius: 5px;
    border: 1px solid #bee5eb;
    white-space: nowrap;
    flex: 0.4;
}

.iva-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #0c5460;
    margin: 0;
}

.buttons-group {
    display: flex;
    gap: 6px;
    white-space: nowrap;
    flex: 0.6;
}

.buttons-group .btn {
    padding: 8px 12px;
    border-radius: 5px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-transform: uppercase;
    flex: 1;
}

.btn-primary {
    background: linear-gradient(135deg, #2196f3, #1976d2);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, #6c757d, #545b62);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #545b62, #495057);
    transform: translateY(-1px);
}

/* MANTENER COMPATIBILIDAD CON GRID ANTERIOR */
.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr 1fr;
    gap: 15px;
    align-items: end;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

input, select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent, #D97706);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

input:hover, select:hover {
    border-color: #c1c9d4;
}

.btn {
    padding: 12px 25px;
    min-height: 44px;
    border: none;
    border-radius: var(--radius, 8px);
    font-size: 0.9rem;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    letter-spacing: 0.6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 5px;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent, #D97706);
    color: white;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover, #B45309);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.btn-secondary {
    background: var(--text-secondary, #475569);
    color: white;
    box-shadow: 0 2px 8px rgba(71, 85, 105, 0.3);
}

.btn-secondary:hover {
    background: #334155;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.4);
}

.descuento-global {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.descuento-global label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #856404;
    font-size: 0.9rem;
}

.descuento-global-input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #ffc107;
    border-radius: 6px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    background: white;
    margin: 0 auto;
}

.descuento-global-input:focus {
    outline: none;
    border-color: #ff8c00;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.2);
}

.descuento-activo {
    background: linear-gradient(135deg, #d4edda, #b8e6c1);
    border-color: #28a745;
    animation: pulse-success 2s infinite;
}

.descuento-activo label {
    color: #155724;
}

.descuento-activo .descuento-global-input {
    border-color: #28a745;
}

@keyframes pulse-success {
    0% { box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3); }
    50% { box-shadow: 0 6px 25px rgba(40, 167, 69, 0.5); }
    100% { box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3); }
}

.iva-toggle {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 2px solid #2196f3;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.iva-toggle label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #1565c0;
    font-size: 0.9rem;
}

.iva-checkbox {
    width: 20px;
    height: 20px;
    accent-color: #2196f3;
    cursor: pointer;
}

.iva-label {
    font-weight: bold;
    color: #1565c0;
    font-size: 0.9rem;
}

.iva-incluido {
    font-size: 0.7rem;
    color: #1565c0;
    font-weight: 500;
    margin-left: 3px;
    display: inline-block;
}

.welcome-message {
    text-align: center;
    padding: 80px 40px;
    color: white;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.05));
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2);
    border-left: 3px solid var(--accent, #D97706);
}

.welcome-message h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.welcome-message p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

.search-hint {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 15px 25px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
}

.search-hint .search-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.9;
    color: var(--accent, #D97706);
    stroke-width: 2;
}

.search-hint span {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 25px;
}

/* Hacer que el mensaje de bienvenida ocupe todo el ancho */
.products-grid > .welcome-message {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
}

/* Alternativa: cuando está solo en el grid */
.products-grid .welcome-message {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: none !important;
}

.product-card {
    background: var(--bg-card, #FFFFFF);
    border-radius: var(--radius, 8px);
    border-top: 3px solid var(--accent, #D97706);
    padding: 20px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
    border-left: 1px solid var(--border, #E2E8F0);
    border-right: 1px solid var(--border, #E2E8F0);
    border-bottom: 1px solid var(--border, #E2E8F0);
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217,119,6,0.18), 0 2px 8px rgba(0,0,0,0.12);
}

.product-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(217,119,6,0.12);
}

.product-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
}

.product-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 6px;
    line-height: 1.3;
}

.product-code-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.product-code {
    background: linear-gradient(135deg, #e9ecef, #f8f9fa);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    border: 1px solid #dee2e6;
}

.btn-ficha-tecnica-small {
    display: inline-block;
    padding: 4px 8px;
    background: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    opacity: 0.8;
}

.btn-ficha-tecnica-small:hover {
    background: #5a6268;
    opacity: 1;
    text-decoration: none;
    color: white;
    transform: translateY(-1px);
}

.product-details {
    margin-bottom: 18px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.detail-row span:first-child {
    font-weight: 600;
    color: #555;
}

.detail-row span:last-child {
    color: #777;
}

.manufacturer-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.valentine {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: #1976d2;
    border: 1px solid #2196f3;
}

.cin {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    color: #7b1fa2;
    border: 1px solid #9c27b0;
}

/* ✅ NUEVO - Badge para OFO */
.ofo {
    background: linear-gradient(135deg, #e8f5e8, #c8e6c8);
    color: #2e7d32;
    border: 1px solid #4caf50;
}

.loading {
    text-align: center;
    padding: 60px;
    color: white;
}

.loading h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.no-results {
    text-align: center;
    padding: 60px;
    color: #666;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #555;
}

.opciones-curado {
    margin-top: 18px;
}

.opciones-curado h4 {
    color: #333;
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 600;
}

.opcion-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.opcion-item:hover {
    border-color: var(--accent, #D97706);
    background: rgba(217, 119, 6, 0.04);
    transform: translateX(4px);
}

.opcion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.opcion-tipo {
    font-weight: 700;
    color: #333;
    font-size: 1rem;
}

.precio-principal {
    text-align: right;
}

.precio-original {
    text-decoration: line-through;
    color: #6c757d;
    font-size: 0.9rem;
    display: block;
}

.precio-final {
    font-weight: 700;
    color: #dc3545;
    font-size: 1.3rem;
}

.descuento-badge {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-top: 3px;
    display: inline-block;
    animation: badge-glow 2s infinite;
}

@keyframes badge-glow {
    0% { box-shadow: 0 0 5px rgba(40, 167, 69, 0.3); }
    50% { box-shadow: 0 0 15px rgba(40, 167, 69, 0.6); }
    100% { box-shadow: 0 0 5px rgba(40, 167, 69, 0.3); }
}

.opcion-detalles {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

.version-rapida {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    border-color: #ffc107;
}

.version-rapida:hover {
    background: linear-gradient(135deg, #fff8db, #ffdd59);
    border-color: #ffb300;
}

.descuento-section {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.descuento-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.descuento-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.descuento-input {
    width: 70px;
    padding: 8px 12px;
    border: 2px solid #28a745;
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    background: white;
}

.descuento-input:focus {
    outline: none;
    border-color: #20c997;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

.componentes-desglose {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.componente-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.componente-item:hover {
    border-color: var(--accent, #D97706);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.1);
}

.componente-info {
    flex: 1;
}

.componente-codigo {
    font-weight: 600;
    color: #495057;
}

.componente-detalles {
    color: #6c757d;
    font-size: 0.8rem;
}

.componente-descuento {
    display: flex;
    align-items: center;
    gap: 8px;
}

.componente-descuento-input {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid #28a745;
    border-radius: 4px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.componente-precios {
    text-align: right;
    min-width: 80px;
}

.pagination {
    text-align: center;
    margin: 40px 0;
}

.pagination button {
    margin: 0 5px;
    padding: 10px 18px;
    border: 2px solid var(--accent, #D97706);
    background: white;
    color: var(--accent, #D97706);
    border-radius: var(--radius, 8px);
    cursor: pointer;
    font-family: var(--font-display, 'Barlow Condensed', sans-serif);
    font-weight: 600;
    transition: all 0.2s ease;
}

.pagination button:hover {
    background: var(--accent, #D97706);
    color: white;
    transform: translateY(-1px);
}

.pagination button.active {
    background: var(--accent, #D97706);
    color: white;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

.pagination button:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    border-color: #e9ecef;
    transform: none;
}

.ficha-tecnica-link {
    margin-top: 15px;
    text-align: center;
}

.btn-ficha-tecnica {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-ficha-tecnica:hover {
    background: linear-gradient(135deg, #218838, #1aa589);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(40, 167, 69, 0.4);
    text-decoration: none;
    color: white;
}

.btn-ficha-tecnica:active {
    transform: translateY(0);
}

.opcion-item.kit-color {
    border-left: 4px solid #17a2b8;
    background: linear-gradient(135deg, #f8fdff, #e6f7ff);
}

.opcion-item.kit-color:hover {
    border-color: #17a2b8;
    background: linear-gradient(135deg, #e6f7ff, #cceeff);
}

.color-badge {
    background: linear-gradient(135deg, #17a2b8, #138496);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: 10px;
}

.color-especial {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    animation: pulse-special 2s infinite;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

@keyframes pulse-special {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.filtros-producto {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 15px;
}

.selectores-duales {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.selector-grupo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 120px;
}

.selector-grupo label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.selector-grupo select {
    padding: 8px 12px;
    border: 2px solid var(--accent, #D97706);
    border-radius: var(--radius, 8px);
    background: white;
    color: var(--text-primary, #0F172A);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.selector-grupo select:hover {
    border-color: var(--accent-hover, #B45309);
}

.selector-grupo select:focus {
    outline: none;
    border-color: var(--accent, #D97706);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.2);
}

/* ✅ NUEVO - Estilos para sistema de colaboradores y nuevos niveles de permisos */

/* Estilos para modales de colaboradores */
.modal-collaborators {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: none;
}

.modal-content-collaborators {
    background: white;
    margin: 5% auto;
    border-radius: var(--radius-lg, 12px);
    width: 90%;
    max-width: 800px;
    max-height: 85dvh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header-collaborators {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    background: var(--bg-surface, #1E293B);
    color: white;
}

.modal-header-collaborators h3 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close-collaborators {
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    background: none;
    border: none;
    color: white;
    padding: 5px 10px;
}

.modal-close-collaborators:hover {
    opacity: 1;
    transform: scale(1.1);
}

.modal-body-collaborators {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
}

.add-collaborator-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}

.add-collaborator-form {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.input-group-collaborator {
    flex: 1;
    min-width: 200px;
}

.input-group-collaborator label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.user-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 0.9rem;
}

.user-search-results {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.user-search-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.user-search-item:hover {
    background: #f8f9fa;
}

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

.collaborators-list {
    margin-top: 20px;
}

.collaborator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.collaborator-item:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.collaborator-info h4 {
    margin: 0;
    color: #333;
    font-size: 1rem;
}

.collaborator-info p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.8rem;
}

.collaborator-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.permission-select {
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.8rem;
    background: white;
}

/* ✅ NUEVO - Estilos para nuevos niveles de permisos */
.permission-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
    text-align: center;
    min-width: 80px;
    display: inline-block;
}

.permission-owner {
    background: var(--bg-surface, #1E293B);
}

.permission-colaborador {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.permission-ver-editar {
    background: linear-gradient(135deg, #ffc107, #ff8c00);
    color: #856404;
}

.permission-solo-ver {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.permission-group-admin {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

/* ✅ NUEVO - Badges para grupos de usuarios */
.group-badge {
   padding: 2px 6px;
   border-radius: 4px;
   font-size: 0.55rem;
   font-weight: 600;
   color: white;
   margin-top: 2px;
   display: inline-block;
}

.group-comerciales {
   background: linear-gradient(135deg, #007bff, #0056b3);
}

.group-prescripcion {
   background: linear-gradient(135deg, #28a745, #1e7e34);
}

.group-superadmin {
   background: linear-gradient(135deg, #dc3545, #bd2130);
}

.group-unknown {
   background: linear-gradient(135deg, #6c757d, #495057);
}

/* ✅ NUEVO - Estilos para información de grupo en mis-proyectos */
.group-info-enhanced {
   background: var(--bg-surface, #1E293B);
   color: white;
   padding: 15px 20px;
   border-radius: var(--radius, 8px);
   margin-bottom: 20px;
   text-align: center;
   border-left: 4px solid var(--accent, #D97706);
}

.group-title {
   font-size: 1.2rem;
   font-weight: 700;
   margin-bottom: 5px;
}

.group-permissions {
   font-size: 0.9rem;
   opacity: 0.9;
}

/* ✅ NUEVO - Estilos para botones de acción en colaboradores */
.btn-small {
   padding: 6px 12px;
   font-size: 0.75rem;
   border-radius: 4px;
   border: none;
   cursor: pointer;
   transition: all 0.3s ease;
   font-weight: 600;
   text-transform: uppercase;
   letter-spacing: 0.5px;
}

.btn-danger-small {
   background: linear-gradient(135deg, #dc3545, #c82333);
   color: white;
}

.btn-danger-small:hover {
   background: linear-gradient(135deg, #c82333, #a71e2a);
   transform: translateY(-1px);
}

.btn-info-small {
   background: linear-gradient(135deg, #17a2b8, #138496);
   color: white;
}

.btn-info-small:hover {
   background: linear-gradient(135deg, #138496, #0f6674);
   transform: translateY(-1px);
}

/* ✅ NUEVO - Estilos para estadísticas de colaboración */
.collaboration-stats {
   display: grid;
   grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
   gap: 15px;
   margin-bottom: 20px;
}

.stat-card {
   background: var(--bg-surface, #1E293B);
   color: white;
   padding: 20px;
   border-radius: var(--radius, 8px);
   border-top: 3px solid var(--accent, #D97706);
   text-align: center;
   transition: transform 0.2s ease;
}

.stat-card:hover {
   transform: translateY(-2px);
}

.stat-number {
   font-size: 2rem;
   font-weight: bold;
   margin-bottom: 5px;
}

.stat-label {
   font-size: 0.9rem;
   opacity: 0.9;
}

/* ✅ NUEVO - Estilos para proyectos con información de colaboración extendida */
.project-collaborators-section {
   background: #f8f9fa;
   padding: 15px;
   border-radius: 8px;
   margin-top: 15px;
}

.project-search {
   margin-bottom: 15px;
}

.project-search input {
   width: 100%;
   padding: 10px;
   border: 1px solid #ddd;
   border-radius: 6px;
}

.project-item {
   background: white;
   padding: 15px;
   border: 1px solid #ddd;
   border-radius: 6px;
   margin-bottom: 10px;
   transition: all 0.3s ease;
}

.project-item:hover {
   box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.project-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 10px;
}

.project-name {
   font-weight: 600;
   color: #333;
}

.project-number {
   font-size: 0.9rem;
   color: #666;
}

.project-collaborators {
   font-size: 0.8rem;
   color: #666;
   margin-top: 5px;
}

.project-owner {
   font-size: 0.8rem;
   color: #666;
   margin-bottom: 10px;
   font-style: italic;
}

/* ✅ MODIFICADO - Estilos para cuadro de consumo con botones fijos */
.cuadro-actions-fixed {
   position: fixed;
   top: 60px;
   left: 0;
   right: 0;
   background: rgba(255, 255, 255, 0.95);
   backdrop-filter: blur(10px);
   border-bottom: 2px solid #e9ecef;
   padding: 15px 20px;
   z-index: 999;
   transform: translateY(-100%);
   transition: transform 0.3s ease;
   box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.cuadro-actions-fixed.visible {
   transform: translateY(0);
}

.cuadro-actions-fixed .cuadro-actions {
   max-width: 1400px;
   margin: 0 auto;
   background: transparent;
   box-shadow: none;
   padding: 0;
   margin-bottom: 0;
}

/* ✅ NUEVO - Estilos para descuento global mejorado */
.descuento-global-section {
   background: linear-gradient(135deg, #fff3cd, #ffeaa7);
   border: 2px solid #ffc107;
   border-radius: 12px;
   padding: 20px;
   margin-bottom: 20px;
   text-align: center;
   transition: all 0.3s ease;
}

.descuento-global-section.active {
   background: linear-gradient(135deg, #d4edda, #b8e6c1);
   border-color: #28a745;
   animation: pulse-success 2s infinite;
}

.descuento-global-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   margin-bottom: 15px;
}

.descuento-global-title {
   font-size: 1.1rem;
   font-weight: 700;
   color: #856404;
   margin: 0;
}

.descuento-global-section.active .descuento-global-title {
   color: #155724;
}

.descuento-global-controls {
   display: flex;
   align-items: center;
   justify-content: center;
   gap: 15px;
   flex-wrap: wrap;
}

.descuento-global-input {
   width: 100px;
   padding: 10px 15px;
   border: 2px solid #ffc107;
   border-radius: 8px;
   text-align: center;
   font-size: 1.2rem;
   font-weight: bold;
   background: white;
}

.descuento-global-section.active .descuento-global-input {
   border-color: #28a745;
}

.btn-restablecer {
   background: #6c757d;
   color: white;
   border: none;
   padding: 10px 20px;
   border-radius: 8px;
   font-size: 0.9rem;
   font-weight: 600;
   cursor: pointer;
   transition: all 0.3s ease;
}

.btn-restablecer:hover {
   background: #5a6268;
   transform: translateY(-1px);
}

/* ✅ ELIMINADO - Estilos de navegación movidos completamente a navigation.css para evitar conflictos */

/* ✅ ELIMINADO - Estilos de logout movidos a navigation.css para consistencia total */

/* ✅ NUEVO - Dropdown para Admin */
.nav-dropdown {
   position: relative;
   display: inline-block;
}

.dropdown-toggle::after {
   content: " ▼";
   font-size: 0.7rem;
   margin-left: 5px;
}

.dropdown-menu {
   position: absolute;
   top: 100%;
   right: 0;
   background: white;
   min-width: 200px;
   box-shadow: 0 8px 25px rgba(0,0,0,0.15);
   border-radius: 8px;
   overflow: hidden;
   opacity: 0;
   visibility: hidden;
   transform: translateY(-10px);
   transition: all 0.3s ease;
   z-index: 1001;
}

.dropdown-menu.show {
   opacity: 1;
   visibility: visible;
   transform: translateY(0);
}

.dropdown-item {
   display: block;
   padding: 12px 20px;
   color: #333;
   text-decoration: none;
   font-size: 0.9rem;
   font-weight: 500;
   transition: all 0.3s ease;
   border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover {
   background: #f8f9fa;
   color: #2c3e50;
   text-decoration: none;
}

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

.dropdown-divider {
   height: 0;
   margin: 8px 0;
   overflow: hidden;
   border-top: 1px solid #e9ecef;
}

/* ✅ NUEVO - Estilos para modales de cambio de producto */
.modal-header.cambio-modo {
   background: linear-gradient(135deg, #ffc107, #ff8c00) !important;
   color: #856404 !important;
}

/* ✅ NUEVO - Animaciones para mensajes de notificación */
@keyframes slideIn {
   from {
       transform: translateX(100%);
       opacity: 0;
   }
   to {
       transform: translateX(0);
       opacity: 1;
   }
}

.notification-message {
   animation: slideIn 0.3s ease-out;
}

/* ✅ NUEVO - Estilos para indicadores de revisión automática */
.revision-indicator {
   background: linear-gradient(135deg, #ffc107, #ff8c00);
   color: #856404;
   padding: 8px 12px;
   border-radius: 20px;
   font-size: 0.75rem;
   font-weight: 600;
   display: inline-block;
   margin-left: 10px;
   animation: pulse-revision 2s infinite;
}

@keyframes pulse-revision {
   0% { box-shadow: 0 0 5px rgba(255, 193, 7, 0.3); }
   50% { box-shadow: 0 0 15px rgba(255, 193, 7, 0.6); }
   100% { box-shadow: 0 0 5px rgba(255, 193, 7, 0.3); }
}

/* ✅ NUEVO - Estilos para estados de permisos en proyecto */
.permission-indicator {
   display: inline-block;
   padding: 4px 8px;
   border-radius: 12px;
   font-size: 0.7rem;
   font-weight: 600;
   text-transform: uppercase;
   margin-left: 10px;
}

.permission-owner-indicator {
   background: var(--bg-surface, #1E293B);
   color: white;
}

.permission-colaborador-indicator {
   background: #28a745;
   color: white;
}

.permission-ver-editar-indicator {
   background: #ffc107;
   color: #856404;
}

.permission-solo-ver-indicator {
   background: #6c757d;
   color: white;
}

/* ✅ NUEVO - Estilos responsivos mejorados para colaboradores */
@media (max-width: 768px) {
   .add-collaborator-form {
       flex-direction: column;
   }

   .input-group-collaborator {
       min-width: 100%;
   }

   .collaborator-item {
       flex-direction: column;
       align-items: start;
       gap: 10px;
   }

   .collaborator-actions {
       width: 100%;
       justify-content: space-between;
   }

   .collaboration-stats {
       grid-template-columns: 1fr;
   }

   .modal-content-collaborators {
       width: 95%;
       margin: 2% auto;
       max-height: 95vh;
   }

   .cuadro-actions-fixed {
       top: auto;
       position: relative;
       transform: none;
       border-bottom: none;
       border-top: 2px solid #e9ecef;
   }

   .descuento-global-controls {
       flex-direction: column;
       gap: 10px;
   }

   .nav-container {
       flex-direction: column;
       padding: 15px 20px;
       min-height: auto;
   }
   
   /* ✅ ELIMINADO - Estilos móviles duplicados, ya están en navigation.css */
   
   .nav-links {
       width: 100%;
       justify-content: center;
       flex-wrap: wrap;
       gap: 5px;
   }
   
   .nav-link {
       padding: 12px 15px;
       font-size: 0.8rem;
   }
   
   .dropdown-menu {
       position: fixed;
       top: auto;
       right: 20px;
       left: 20px;
       width: auto;
   }
}

@media (max-width: 1200px) {
   .search-grid {
       grid-template-columns: 2fr 1fr 1fr 1fr;
       gap: 15px;
   }
   
   .products-grid {
       grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
   }
}

@media (max-width: 768px) {
   .nav-container {
       flex-direction: column;
       height: auto;
       padding: 15px 20px;
   }
   
   /* ✅ ELIMINADO - Estilos móviles duplicados, ya están en navigation.css */
   
   .nav-links {
       width: 100%;
       justify-content: center;
   }
   
   .nav-link {
       padding: 12px 20px;
       font-size: 0.9rem;
   }
   
   .search-grid {
       grid-template-columns: 1fr;
       gap: 15px;
   }
   
   .header h1 {
       font-size: 2rem;
   }
   
   .products-grid {
       grid-template-columns: 1fr;
   }
   
   .descuento-global-input {
       width: 60px;
   }

   .selectores-duales {
       flex-direction: column;
       gap: 10px;
   }

   .selector-grupo {
       min-width: 100%;
   }
   
   .product-header {
       flex-direction: column;
       align-items: start;
       gap: 10px;
   }
   
   .opcion-header {
       flex-direction: column;
       align-items: start;
       gap: 8px;
   }
   
   .componente-item {
       flex-direction: column;
       align-items: start;
       gap: 8px;
   }
}

@media (max-width: 480px) {
   .container {
       padding: 15px;
   }
   
   .search-section {
       padding: 20px;
   }
   
   .product-card {
       padding: 20px;
   }
   
   .btn {
       padding: 10px 20px;
       font-size: 0.9rem;
   }

   .permission-badge {
       font-size: 0.6rem;
       padding: 3px 6px;
       min-width: 70px;
   }

   .group-badge {
       font-size: 0.5rem;
       padding: 1px 4px;
   }

   .btn-small {
       font-size: 0.7rem;
       padding: 4px 8px;
   }
}

/* ===== BÚSQUEDA MOBILE — Tarifa ===== */
@media (max-width: 768px) {
    .welcome-message {
        padding: 40px 20px;
    }

    .welcome-title {
        font-size: 1.25rem;
        line-height: 1.4;
    }

    .search-hint {
        padding: 12px 16px;
    }

    .search-hint span {
        font-size: 0.88rem;
    }

    /* ── Layout móvil: grid de 2 filas ── */
    .search-single-row {
        display: grid;
        grid-template-columns: 1fr auto auto auto;
        grid-template-rows: auto auto auto;
        gap: 8px;
        padding: 12px;
        min-height: unset;
        align-items: center;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
        border-radius: 12px;
    }

    /* Fila 1: input ocupa col 1-3, toggle en col 4 */
    .search-input-container {
        grid-column: 1 / 4;
        grid-row: 1;
        min-width: 0;
    }

    /* Botón filtros: col 4, fila 1 */
    .buttons-group {
        grid-column: 4;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        gap: 5px;
        align-items: stretch;
    }

    .buttons-group .btn {
        padding: 9px 10px;
        font-size: 0.75rem;
        white-space: nowrap;
    }

    /* Toggle filtros: visible en móvil, dentro de buttons-group */
    .btn-filters-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 8px 10px;
        background: var(--bg-surface, #1E293B);
        color: rgba(255,255,255,0.85);
        border: 1px solid rgba(217,119,6,0.5);
        border-radius: 6px;
        font-size: 0.72rem;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        font-family: var(--font-body, sans-serif);
        transition: background 0.2s;
    }

    .btn-filters-toggle.active {
        background: rgba(217,119,6,0.25);
        border-color: var(--accent, #D97706);
        color: white;
    }

    /* Fila 2: DTO (col1) + IVA (col2) — compactos */
    .descuento-group {
        grid-column: 1 / 3;
        grid-row: 2;
        flex: none;
        padding: 8px 12px;
        gap: 6px;
        width: auto;
    }

    .descuento-group label { font-size: 0.85rem; }
    .descuento-group input { width: 48px; font-size: 0.9rem; padding: 6px; }
    .descuento-group span { font-size: 0.9rem; }

    .iva-group {
        grid-column: 3 / 5;
        grid-row: 2;
        flex: none;
        width: auto;
        padding: 8px 10px;
        gap: 6px;
    }

    /* Fila 3: filtros — ocultos por defecto, visibles con .filters-open */
    .filters-grid {
        grid-column: 1 / 5;
        grid-row: 3;
        display: none;
        flex-direction: column;
        gap: 6px;
        width: 100%;
    }

    .search-single-row.filters-open .filters-grid {
        display: flex;
    }

    .filters-row-top,
    .filters-row-bottom {
        gap: 6px;
    }

    .filters-row-top select,
    .filters-row-bottom select {
        min-width: 0;
        font-size: 0.82rem;
        padding: 8px 6px;
    }

    .search-input-hero {
        font-size: 1rem;
        padding: 12px 14px;
        height: 46px;
        border-radius: 8px;
        border: 2px solid var(--accent, #D97706);
        box-shadow: 0 2px 10px rgba(217, 119, 6, 0.15);
    }

    .search-input-hero:focus {
        border-color: var(--accent, #D97706);
        box-shadow: 0 4px 20px rgba(217, 119, 6, 0.3);
    }
}

/* ✅ NUEVO - Estilos para tooltips de permisos */
.permission-tooltip {
   position: relative;
   cursor: help;
}

.permission-tooltip::before {
   content: attr(data-tooltip);
   position: absolute;
   bottom: 125%;
   left: 50%;
   transform: translateX(-50%);
   background: rgba(0, 0, 0, 0.8);
   color: white;
   padding: 8px 12px;
   border-radius: 6px;
   font-size: 0.8rem;
   white-space: nowrap;
   opacity: 0;
   visibility: hidden;
   transition: all 0.3s ease;
   z-index: 1000;
}

.permission-tooltip:hover::before {
   opacity: 1;
   visibility: visible;
}

/* ✅ NUEVO - Estilos para indicadores de estado de proyecto */
.project-status-indicator {
   display: inline-block;
   width: 8px;
   height: 8px;
   border-radius: 50%;
   margin-right: 8px;
}

.status-owner {
   background: var(--accent, #D97706);
}

.status-collaborator {
   background: #28a745;
}

.status-editor {
   background: #ffc107;
}

.status-viewer {
   background: #6c757d;
}

/* ✅ NUEVO - Estilos para mensajes de éxito/error personalizados */
.toast-message {
   position: fixed;
   top: 20px;
   right: 20px;
   padding: 15px 20px;
   border-radius: 8px;
   color: white;
   font-weight: 600;
   z-index: 1000;
   max-width: 350px;
   animation: slideIn 0.3s ease-out;
   box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.toast-success {
   background: linear-gradient(135deg, #28a745, #20c997);
}

.toast-warning {
   background: linear-gradient(135deg, #ffc107, #ff8c00);
   color: #856404;
}

.toast-info {
   background: linear-gradient(135deg, #17a2b8, #138496);
}

.toast-error {
   background: linear-gradient(135deg, #dc3545, #c82333);
}

/* ✅ NUEVO - Estilos para loading states mejorados */
.loading-spinner {
   display: inline-block;
   width: 20px;
   height: 20px;
   border: 3px solid rgba(255,255,255,.3);
   border-radius: 50%;
   border-top-color: #fff;
   animation: spin 1s ease-in-out infinite;
}

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

.loading-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background: rgba(0,0,0,0.5);
   display: flex;
   justify-content: center;
   align-items: center;
   z-index: 9999;
}

.loading-content {
   background: white;
   padding: 30px;
   border-radius: 15px;
   text-align: center;
   box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* ✅ NUEVO - Estilos para badges de versión */
.version-badge {
   background: linear-gradient(135deg, #6c757d, #495057);
   color: white;
   padding: 2px 6px;
   border-radius: 4px;
   font-size: 0.6rem;
   font-weight: 600;
   margin-left: 5px;
}

.version-new {
   background: linear-gradient(135deg, #28a745, #20c997);
}

.version-auto {
   background: linear-gradient(135deg, #ffc107, #ff8c00);
   color: #856404;
}

/* ✅ MEJORADO - Estilos finales para compatibilidad */
.main-navigation {
   background: linear-gradient(135deg, #2c3e50, #34495e);
   padding: 0;
   box-shadow: 0 2px 15px rgba(0,0,0,0.2);
   position: sticky;
   top: 0;
   z-index: 1000;
}

.nav-container {
   max-width: 1400px;
   margin: 0 auto;
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 0 20px;
   min-height: 60px;
}

/* Fin de estilos CSS */