/* Reset y Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colores Principal */
    --primary-bg: #0a0b0d;
    --secondary-bg: #1a1d23;
    --card-bg: #252830;
    --accent-bg: #2d3139;
    
    /* Colores de texto */
    --text-primary: #ffffff;
    --text-secondary: #b8bcc8;
    --text-muted: #6c7293;
    
    /* Colores de estado */
    --status-redactado: #3b82f6;
    --status-leido-en-planta: #f59e0b;
    --status-proceso: #8b5cf6;
    --status-despachado: #10b981;
    --status-entregado: #22c55e;
    --status-cancelado: #ef4444;
    
    /* Colores de acento */
    --accent-orange: #ff6b35;
    --accent-gold: #ffd700;
    --accent-red: #dc2626;
    
    /* Sombras */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(255, 107, 53, 0.3);
    
    /* Transiciones */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Estilos Base */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, #1a1d23 100%);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--secondary-bg) 0%, var(--card-bg) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1600px;
    margin: 0 auto;
    gap: 2rem;
}

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

.logo-section .logo-img {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--accent-orange);
}

.logo-section .title-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.logo-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-orange) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 400;
}

/* Header Stats */
.header-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-orange);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-orange);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.refresh-btn {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #ff8c42 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.refresh-btn i {
    animation: rotate 2s linear infinite paused;
}

.refresh-btn:hover i {
    animation-play-state: running;
}

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

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-redactado);
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: var(--status-entregado);
}

.status-dot.error {
    background: var(--status-cancelado);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Filters */
.filters-section {
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filters-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group select {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 120px;
    transition: var(--transition);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.search-group {
    position: relative;
    flex: 1;
    max-width: 300px;
    margin-left: auto;
}

.search-group input {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: var(--transition);
}

.search-group input:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.search-group i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Main Content */
.main-content {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.section-header i {
    color: var(--accent-orange);
}

.section-counter {
    background: var(--accent-orange);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Pedidos Grid */
.pedidos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1.5rem;
}

/* Pedido Card */
.pedido-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.pedido-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--status-redactado);
    transition: var(--transition);
}

.pedido-card.redactado::before { background: var(--status-redactado); }
.pedido-card.leido_en_planta::before { background: var(--status-leido-en-planta); }
.pedido-card.en_proceso::before { background: var(--status-proceso); }
.pedido-card.despachado::before { background: var(--status-despachado); }
.pedido-card.entregado::before { background: var(--status-entregado); }

.pedido-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-orange);
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.pedido-numero {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-orange);
}

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

.pedido-estado {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pedido-estado.redactado {
    background: rgba(59, 130, 246, 0.2);
    color: var(--status-redactado);
    border: 1px solid var(--status-redactado);
}

.pedido-estado.leido_en_planta {
    background: rgba(245, 158, 11, 0.2);
    color: var(--status-leido-en-planta);
    border: 1px solid var(--status-leido-en-planta);
}

.pedido-estado.en_proceso {
    background: rgba(139, 92, 246, 0.2);
    color: var(--status-proceso);
    border: 1px solid var(--status-proceso);
}

.pedido-estado.despachado {
    background: rgba(16, 185, 129, 0.2);
    color: var(--status-despachado);
    border: 1px solid var(--status-despachado);
}

.pedido-estado.entregado {
    background: rgba(34, 197, 94, 0.2);
    color: var(--status-entregado);
    border: 1px solid var(--status-entregado);
}

.pedido-cliente {
    margin-bottom: 1rem;
}

.cliente-nombre {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.cliente-telefono {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pedido-items {
    margin-bottom: 1rem;
}

.pedido-items h4 {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.item {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pedido-total {
    display: flex;
    justify-content: between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.total-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.total-amount {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-orange);
    margin-left: auto;
}

.pedido-pago {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-left: 1rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--card-bg);
    border-radius: 16px;
    width: 95%;
    max-width: 1400px;  /* Aumentado para aprovechar mejor el espacio */
    max-height: 95vh;   /* Aumentado a 95vh para desktop */
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-shrink: 0;
}

.btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #ff8c42 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 107, 53, 0.3);
    border-top: 3px solid var(--accent-orange);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Action Bar */
.action-bar {
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-create-order {
    background: linear-gradient(135deg, var(--accent-orange) 0%, #ff8c42 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
}

.btn-create-order:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-catalog {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
}

.btn-catalog:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

/* Modal Large */
.modal-large {
    max-width: 900px;
    width: 95%;
}

/* Modal Medium */
.modal-medium {
    max-width: 600px;
    width: 95%;
}

/* Modal Description */
.modal-description {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.6;
}

.modal-description i {
    color: var(--accent-orange);
    font-size: 1rem;
    flex-shrink: 0;
}

/* Domiciliarios List */
.domiciliarios-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.no-domiciliarios {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Domiciliario Option */
.domiciliario-option {
    background: rgba(255, 255, 255, 0.02);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.domiciliario-option:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-orange);
    box-shadow: var(--shadow-md);
}

.domiciliario-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.domiciliario-nombre {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.domiciliario-nombre i {
    color: var(--accent-orange);
    font-size: 1.125rem;
}

.domiciliario-phone {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.select-icon {
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition);
}

.domiciliario-option:hover .select-icon {
    color: var(--accent-orange);
    transform: translateX(4px);
}

/* Form Styles */
.form-step {
    display: block;
}

.form-step.hidden {
    display: none;
}

.form-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-section h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h4 i {
    color: var(--accent-orange);
}

.form-help {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.25rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group-full {
    grid-column: span 2;
}

.form-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: var(--transition);
    font-family: inherit;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
    font-family: 'Courier New', monospace;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 1.5rem;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Products List */
.products-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.no-products {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

.product-row {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: var(--transition);
}

.product-row:hover {
    border-color: rgba(255, 107, 53, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

.product-row-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr 1.5fr;
    gap: 0.75rem;
    align-items: end;
}

.product-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

.product-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

.product-field input,
.product-field select {
    width: 100%;
}

.product-subtotal {
    background: rgba(255, 107, 53, 0.1);
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    font-size: 0.875rem;
}

.btn-remove-product {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.btn-remove-product:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: translateY(-2px);
}

.btn-remove-product i {
    font-size: 1rem;
}

/* Order Summary */
.order-summary {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.1) 0%, rgba(255, 140, 66, 0.05) 100%);
    border-color: rgba(255, 107, 53, 0.2);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.summary-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.total-row {
    padding-top: 1rem;
    margin-top: 0.5rem;
    border-top: 2px solid var(--accent-orange);
}

.total-row .summary-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.total-row .summary-value {
    font-size: 1.5rem;
    color: var(--accent-orange);
}

/* Product Autocomplete */
.product-autocomplete {
    position: relative;
}

/* Detail Sections in Modal */
.detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

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

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-item span {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-detail {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.item-number {
    width: 32px;
    height: 32px;
    background: var(--accent-orange);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.item-quantity {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.item-prices {
    text-align: right;
}

.item-unit-price {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-subtotal {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent-orange);
}

.total-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid var(--accent-orange);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.total-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-orange);
}

.notes-content {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.status-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.status-option {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

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

.status-option.active {
    font-weight: 600;
}

/* Cliente Info Styles */
.pedido-cliente {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cliente-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cliente-info i {
    color: var(--accent-orange);
    font-size: 1.125rem;
}

.pedido-tiempo {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Item Summary Styles */
.item-summary {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    font-size: 0.875rem;
}

.item-cantidad {
    color: var(--accent-orange);
    font-weight: 600;
}

.item-nombre {
    color: var(--text-secondary);
}

.more-items {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Pedido Footer */
.pedido-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pedido-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-orange);
}

.pedido-pago {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.pedido-pago i {
    font-size: 0.875rem;
}

/* Pedido ID Styles */
.pedido-id {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.pedido-id i {
    font-size: 1.125rem;
}

.pedido-status {
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Badge Manual */
.badge-manual {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 0.25rem;
}

/* Cliente Dirección */
.cliente-direccion {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.cliente-direccion i {
    font-size: 0.75rem;
    color: var(--accent-orange);
}

/* Filetiador Info */
.pedido-filetiador {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pedido-filetiador i {
    color: #3b82f6;
    font-size: 1rem;
}

.pedido-filetiador strong {
    color: #3b82f6;
    font-weight: 600;
}

/* Item Porcionado Badge (para modal) */
.item-porcionado-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.15) 0%, rgba(255, 140, 66, 0.1) 100%);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 6px;
    color: var(--accent-orange);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.item-porcionado-badge i {
    font-size: 0.875rem;
}

/* Item Porcionado (para tarjeta - versión pequeña) */
.item-porcionado {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
}

/* Pedido Notas */
.pedido-notas {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.pedido-notas i {
    color: var(--accent-orange);
    font-size: 0.875rem;
    margin-top: 0.125rem;
    flex-shrink: 0;
}

/* Pedido Actions */
.pedido-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-edit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    font-size: 0.875rem;
    transition: var(--transition);
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

/* No Orders Message */
.no-orders {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-stats {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem 1rem;
    }

    .stat-number {
        font-size: 1.5rem;
    }

    .action-bar {
        padding: 1rem;
    }

    .filters-container {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .search-group {
        margin-left: 0;
        max-width: none;
    }

    .main-content {
        padding: 1rem;
    }

    .pedidos-grid {
        grid-template-columns: 1fr;
    }

    /* Modal ajustes para tablet */
    .modal-large {
        width: 98%;
        max-height: 95vh;
    }

    .modal-body {
        max-height: 70vh;
        padding: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group-full {
        grid-column: span 1;
    }

    /* Productos en móvil - diseño vertical */
    .product-row-fields {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .status-selector {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Responsive - Móviles */
@media (max-width: 480px) {
    /* Header móvil */
    .header {
        padding: 0.75rem;
    }

    .logo-section .logo-img {
        width: 60px;
        height: 60px;
    }

    .logo-section h1 {
        font-size: 1.125rem;
    }

    .subtitle {
        font-size: 0.75rem;
    }

    .header-stats {
        gap: 0.25rem;
    }

    .stat-card {
        padding: 0.5rem 0.75rem;
        min-width: 0;
        flex: 1;
    }

    .stat-number {
        font-size: 1.25rem;
    }

    .stat-label {
        font-size: 0.625rem;
    }

    .refresh-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }

    .status-indicator {
        font-size: 0.75rem;
    }

    /* Action bar móvil */
    .action-bar {
        padding: 0.75rem;
    }

    .btn-create-order,
    .btn-catalog {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    /* Filters móvil */
    .filters-section {
        padding: 0.75rem;
    }

    .filter-group {
        width: 100%;
    }

    /* Pedidos grid móvil */
    .pedido-card {
        padding: 1rem;
    }

    .pedido-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .pedido-estado {
        align-self: flex-start;
    }

    .pedido-cliente {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .pedido-footer {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    /* Modal móvil optimizado */
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal-large {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
        margin: 0;
    }

    .modal-header {
        padding: 1rem;
        position: sticky;
        top: 0;
        background: var(--card-bg);
        z-index: 10;
    }

    .modal-header h3 {
        font-size: 1rem;
    }

    .modal-body {
        padding: 1rem;
        max-height: calc(95vh - 120px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
        padding: 1rem;
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        z-index: 10;
    }

    /* Formulario móvil */
    .form-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .form-section h4 {
        font-size: 1rem;
    }

    .form-help {
        font-size: 0.8125rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .form-group {
        gap: 0.375rem;
    }

    .form-group label {
        font-size: 0.8125rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.625rem;
        font-size: 0.875rem;
        /* Mejoras para iOS */
        -webkit-appearance: none;
        appearance: none;
        border-radius: 8px;
    }

    .form-textarea {
        font-size: 0.8125rem;
        min-height: 150px;
    }

    /* Productos en móvil - ajustes adicionales */
    .product-row {
        padding: 0.875rem;
    }

    .product-field label {
        font-size: 0.6875rem;
    }

    .product-field input,
    .product-field select {
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    .product-subtotal {
        padding: 0.625rem;
        font-size: 0.875rem;
    }

    /* Botones móvil */
    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        padding: 1rem;
        margin: 0 -1rem -1rem -1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .form-actions button {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
        justify-content: center;
    }

    .btn-sm {
        width: 100%;
        padding: 0.75rem 1rem;
        justify-content: center;
    }

    /* Order Summary móvil */
    .order-summary {
        padding: 1rem;
    }

    .summary-row {
        padding: 0.625rem 0;
    }

    .summary-label {
        font-size: 0.8125rem;
    }

    .summary-value {
        font-size: 0.875rem;
    }

    .total-row .summary-label {
        font-size: 0.9375rem;
    }

    .total-row .summary-value {
        font-size: 1.25rem;
    }

    /* Modal detalles móvil */
    .detail-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }

    .detail-header h4 {
        font-size: 0.9375rem;
    }

    .status-badge {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .item-detail {
        padding: 0.75rem;
        flex-wrap: wrap;
    }

    .item-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .item-name {
        font-size: 0.875rem;
    }

    .item-quantity {
        font-size: 0.8125rem;
    }

    .item-subtotal {
        font-size: 0.9375rem;
    }

    .status-selector {
        grid-template-columns: 1fr;
        gap: 0.625rem;
    }

    .status-option {
        padding: 0.875rem;
        font-size: 0.8125rem;
    }

    /* Mejoras de touch para móvil */
    button,
    select,
    input,
    textarea {
        /* Área táctil mínima de 44x44px (recomendación de Apple) */
        min-height: 44px;
        touch-action: manipulation;
    }

    /* Evitar zoom en inputs en iOS */
    input[type="text"],
    input[type="tel"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Mejorar scrolling en iOS */
    .modal-body,
    .products-list {
        -webkit-overflow-scrolling: touch;
    }

    /* Ocultar scrollbar en móvil pero mantener funcionalidad */
    .modal-body::-webkit-scrollbar {
        width: 0;
        display: none;
    }
}

/* Móviles muy pequeños (iPhone SE, etc.) */
@media (max-width: 360px) {
    .logo-section h1 {
        font-size: 1rem;
    }

    .stat-card {
        padding: 0.375rem 0.5rem;
    }

    .stat-number {
        font-size: 1.125rem;
    }

    .stat-label {
        font-size: 0.5625rem;
    }

    .form-section {
        padding: 0.75rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 0.5rem;
    }

    /* Productos en móvil pequeño - diseño vertical */
    .product-row-fields {
        grid-template-columns: 1fr;
    }
}

/* Landscape móvil */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-large {
        max-height: 98vh;
    }

    .modal-body {
        max-height: calc(98vh - 140px);
    }

    .header-stats {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
}