/**
 * Estilos globales - POS Limpieza
 */

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

:root {
    --primary-color: #0f766e;
    --primary-light: #14b8a6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --light-color: #f8fafc;
    --dark-color: #1e293b;
    --border-color: #e2e8f0;
    --border-radius: 0.5rem;
    --box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --box-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
    --transition: all 0.2s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: var(--dark-color);
    line-height: 1.5;
}

/* ==================== UTILIDADES ====================*/

.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0d9488 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
    font-weight: 600;
}

.btn-warning:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-lg {
    padding: 0.7rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    width: 100%;
}

.btn-block {
    display: block;
    width: 100%;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-control {
    width: 100%;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
}

.alert-error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.empty-message {
    text-align: center;
    color: var(--secondary-color);
    padding: 2rem;
    font-style: italic;
}

/* ==================== LOGIN ====================*/

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-box {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    padding: 2rem;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form .form-group {
    margin-bottom: 0;
}

/* ==================== POS PAGE ====================*/

.pos-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
}

.pos-header {
    background: linear-gradient(135deg, var(--dark-color) 0%, #334155 100%);
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow-lg);
    border-bottom: 3px solid var(--primary-color);
}

.pos-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.pos-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.pos-main {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1rem;
    padding: 1rem;
    flex: 1;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    min-height: 0;
    overflow: hidden;
}

.pos-products {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--box-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: 100%;
}

.products-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.products-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 0;
}

.products-count {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(15, 118, 110, 0.2);
}

.products-search {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    font-size: 0.95rem;
    pointer-events: none;
    z-index: 1;
}

.search-input {
    flex: 1;
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.4rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: var(--transition);
    background-color: white;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.search-input::placeholder {
    color: #94a3b8;
}

.filter-select {
    padding: 0.6rem 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    min-width: 160px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    background-color: white;
    font-weight: 500;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.products-grid {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0.5rem 0.5rem 0.25rem;
}

/* ==================== TABLA DE PRODUCTOS ==================== */

.products-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    font-size: 0.875rem;
}

.products-table thead {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, var(--dark-color), #334155);
    color: white;
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.products-table th {
    padding: 0.75rem 0.6rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--primary-color);
}

.products-table th:first-child {
    border-top-left-radius: 8px;
}

.products-table th:last-child {
    border-top-right-radius: 8px;
}

.products-table tbody tr {
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
}

.products-table tbody tr:hover {
    background: #f0f9ff;
}

.products-table tbody tr.row-empty {
    opacity: 0.55;
    background: #fafafa;
}

.products-table td {
    padding: 0.6rem;
    vertical-align: middle;
}

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

.text-center {
    text-align: center;
}

.col-name {
    max-width: 280px;
}

.product-name-cell {
    font-weight: 600;
    color: var(--dark-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 280px;
}

.badge-discount {
    display: inline-block;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    margin-top: 0.25rem;
    letter-spacing: 0.5px;
}

.type-badge {
    display: inline-block;
    background: rgba(15, 118, 110, 0.1);
    color: var(--primary-color);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.price-cell {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}

.price-main {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1rem;
    white-space: nowrap;
}

.price-old {
    font-size: 0.75rem;
    color: #94a3b8;
    text-decoration: line-through;
}

.price-discount {
    font-size: 0.65rem;
    color: #166534;
    font-weight: 600;
}

.stock-pill {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid transparent;
}

.stock-pill.stock-ok {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.stock-pill.stock-low {
    background: #fefce8;
    color: #854d0e;
    border-color: #fde68a;
}

.stock-pill.stock-empty {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.products-table .qty-control {
    display: inline-flex;
    width: 130px;
    margin: 0 auto;
}

.products-table .btn-add {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    white-space: nowrap;
}

.products-grid::-webkit-scrollbar {
    width: 8px;
}

.products-grid::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.products-grid::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.products-grid::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

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

.empty-state p {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    color: var(--dark-color);
}

.empty-state small {
    font-size: 0.85rem;
    color: var(--secondary-color);
}

.product-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.85rem;
    transition: var(--transition);
    background: white;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
}

.product-card:hover {
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.15);
    transform: translateY(-3px);
    border-color: var(--primary-light);
}

.product-badge-discount {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
    letter-spacing: 0.5px;
    z-index: 2;
}

.product-badge-empty {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--secondary-color);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    z-index: 2;
}

.product-header {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.product-type {
    font-size: 0.65rem;
    color: var(--primary-color);
    background-color: rgba(15, 118, 110, 0.1);
    text-transform: uppercase;
    margin: 0;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    width: fit-content;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.product-name {
    font-size: 0.95rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-weight: 600;
    color: var(--dark-color);
    line-height: 1.3;
    min-height: 2.5em;
}

.product-price-block {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.product-price {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
    line-height: 1;
}

.product-price-old {
    font-size: 0.85rem;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 500;
}

.product-discount-info {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    padding: 0.35rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    border: 1px dashed #86efac;
}

.product-stock {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    margin: 0;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid transparent;
}

.product-stock.stock-ok {
    background-color: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.product-stock.stock-low {
    background-color: #fefce8;
    color: #854d0e;
    border-color: #fde68a;
}

.product-stock.stock-empty {
    background-color: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

.stock-icon {
    font-weight: 800;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    margin-top: auto;
}

.qty-control {
    display: flex;
    align-items: stretch;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: var(--transition);
}

.qty-control:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.qty-btn {
    background: #f1f5f9;
    border: none;
    color: var(--dark-color);
    font-size: 1.1rem;
    font-weight: 700;
    width: 32px;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
    line-height: 1;
}

.qty-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.qty-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.qty-input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.25rem;
    border: none;
    font-size: 0.9rem;
    text-align: center;
    font-weight: 600;
    color: var(--dark-color);
    background: white;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    outline: none;
}

.qty-input.input-error {
    background-color: #fef2f2;
    color: #dc2626;
}

.qty-input:disabled {
    background-color: #f8fafc;
    color: #cbd5e1;
}

.btn-add {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.55rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: 0 2px 4px rgba(15, 118, 110, 0.2);
}

.btn-add:hover:not(:disabled) {
    background: linear-gradient(135deg, #0d9488, var(--primary-color));
    box-shadow: 0 4px 10px rgba(15, 118, 110, 0.35);
    transform: translateY(-1px);
}

.btn-add:active:not(:disabled) {
    transform: translateY(0);
}

.btn-add:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-add-icon {
    font-size: 1rem;
}

/* ==================== CARRITO ====================*/

.pos-cart {
    background: white;
    border-radius: var(--border-radius);
    padding: 0.75rem;
    box-shadow: var(--box-shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    height: 100%;
    min-height: 0;
    position: sticky;
    top: 0;
    overflow-y: auto;
}

.pos-cart h2 {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 700;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pos-cart h2::before {
    content: '🛒';
    font-size: 1.25rem;
}

.cart-items {
    flex: 1 1 auto;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    background-color: #f8fafc;
    min-height: 100px;
    max-height: 280px;
}

.cart-items::-webkit-scrollbar {
    width: 5px;
}

.cart-items::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

.cart-items::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.cart-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.5rem;
    background-color: white;
    border-radius: var(--border-radius);
    margin-bottom: 0.4rem;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    font-size: 0.8rem;
}

.cart-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.item-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.4rem;
}

.item-info h4 {
    font-size: 0.8rem;
    margin: 0;
    font-weight: 600;
    color: var(--dark-color);
    flex: 1;
    line-height: 1.2;
    word-break: break-word;
}

.item-info .item-total {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 0.85rem;
    white-space: nowrap;
}

.item-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    color: var(--secondary-color);
    gap: 0.3rem;
}

.item-price {
    display: flex;
    gap: 0.2rem;
    align-items: center;
}

.item-price span {
    text-decoration: line-through;
    color: #cbd5e1;
}

.item-discount {
    color: var(--success-color);
    font-weight: 600;
    font-size: 0.65rem;
}

.item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.3rem;
}

.item-actions {
    display: flex;
    gap: 0.3rem;
    align-items: center;
}

.qty-edit {
    width: 55px;
    padding: 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.75rem;
    text-align: center;
    transition: var(--transition);
}

.qty-edit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.1);
}

.cart-summary {
    border-top: 1px solid var(--border-color);
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
    padding: 0.6rem;
    border-radius: var(--border-radius);
    margin-top: 0.25rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

.summary-row:last-child {
    margin-bottom: 0;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
    margin-top: 0.5rem;
}

.summary-row strong {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.cart-actions {
    display: grid;
    gap: 0.5rem;
}

.payment-section {
    padding: 0.6rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
}

.payment-section label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.8rem;
}

.payment-section .form-control {
    margin-bottom: 0.6rem;
    border: 1px solid var(--border-color);
    padding: 0.4rem;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    width: 100%;
}

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

.change-display {
    margin-top: 0.5rem;
    padding: 0.6rem;
    background: linear-gradient(135deg, #dcfce7 0%, #ecfdf5 100%);
    border-radius: var(--border-radius);
    border: 1px solid var(--success-color);
}

.change-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.change-row strong {
    color: var(--success-color);
    font-size: 1.25rem;
    font-weight: 700;
}

/* ==================== ALERTA ====================*/

.alert-box {
    position: fixed;
    top: 20px;
    right: 20px;
    max-width: 450px;
    z-index: 1100;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(500px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-content {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    background-color: white;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    align-items: flex-start;
}

.alert-icon {
    font-size: 1.5rem;
    min-width: 24px;
    text-align: center;
}

.alert-content.error .alert-icon::before {
    content: '⚠️';
}

.alert-content.success .alert-icon::before {
    content: '✓';
    color: var(--success-color);
}

.alert-content.warning .alert-icon::before {
    content: '⚡';
}

.alert-content.info .alert-icon::before {
    content: 'ℹ️';
}

.alert-content.error {
    border-left: 4px solid var(--danger-color);
}

.alert-content.success {
    border-left: 4px solid var(--success-color);
}

.alert-content.warning {
    border-left: 4px solid var(--warning-color);
}

.alert-content.info {
    border-left: 4px solid var(--primary-color);
}

.alert-message {
    flex: 1;
}

.alert-message h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.alert-message p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary-color);
    padding: 0;
    min-width: auto;
    line-height: 1;
}

.alert-close:hover {
    color: var(--dark-color);
}

/* ==================== RESUMEN DEL DÍA ====================*/

.modal-summary {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.summary-header h2 {
    margin: 0 !important;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--secondary-color);
    line-height: 1;
    padding: 0 0.5rem;
}

.modal-close:hover {
    color: var(--danger-color);
}

.summary-date {
    color: var(--secondary-color);
    font-size: 0.95rem;
    margin: 0 0 1.25rem 0;
    text-transform: capitalize;
}

.summary-totals {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: linear-gradient(135deg, #f0f9ff, #f8fafc);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.summary-card.summary-card-highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border: none;
}

.summary-card .summary-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    color: var(--secondary-color);
}

.summary-card.summary-card-highlight .summary-label {
    color: rgba(255, 255, 255, 0.9);
}

.summary-card strong {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--dark-color);
}

.summary-card.summary-card-highlight strong {
    color: white;
}

.summary-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark-color);
    margin: 1.25rem 0 0.6rem 0;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-color);
}

.summary-payment-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.summary-payment-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.payment-method-name {
    font-weight: 600;
    color: var(--dark-color);
}

.payment-method-count {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.payment-method-total {
    color: var(--primary-color);
    font-size: 1rem;
}

.summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.summary-table th {
    background: #f8fafc;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
}

.summary-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}

.summary-table tbody tr:last-child td {
    border-bottom: none;
}

/* ==================== MODAL ====================*/

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

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    padding: 2.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
}

.modal-content.success {
    text-align: center;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 100%);
}

.modal-content.success p {
    margin: 1.25rem 0;
    font-size: 1.05rem;
    color: var(--secondary-color);
}

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

.modal-actions .btn {
    flex: 1;
}

/* ==================== ADMIN PAGE ====================*/

.admin-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    background-color: var(--dark-color);
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow);
}

.admin-container {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.admin-nav {
    background-color: white;
    border-bottom: 2px solid var(--border-color);
    padding: 0 1rem;
    display: flex;
    gap: 0;
}

.nav-btn {
    background: none;
    border: none;
    padding: 1rem;
    cursor: pointer;
    font-size: 1rem;
    color: var(--secondary-color);
    border-bottom: 3px solid transparent;
    transition: var(--transition);
}

.nav-btn:hover {
    color: var(--primary-color);
}

.nav-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.admin-main {
    padding: 1.5rem;
    flex: 1;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.admin-section h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.section-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.section-controls .search-input {
    flex: 1;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.admin-table thead {
    background-color: var(--light-color);
    font-weight: bold;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

.mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-top: 1.5rem;
    background-color: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.mini-table thead {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    font-weight: 600;
}

.mini-table th {
    padding: 0.75rem;
    text-align: left;
    border: none;
}

.mini-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.mini-table tbody tr:hover {
    background-color: #f8f9fa;
}

.mini-table tbody tr:last-child td {
    border-bottom: none;
}

/* Stock warning styles */
.stock-warning {
    background-color: #fff3cd;
}

.stock-warning:hover {
    background-color: #ffe69c;
}

.stock-urgent {
    background-color: #f8d7da;
}

.stock-urgent:hover {
    background-color: #f5c6cb;
}

.stock-critical {
    background-color: #f5c6cb;
}

.stock-critical:hover {
    background-color: #f1b0b7;
}

.stock-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.stock-badge.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.stock-badge.urgent {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #dc3545;
}

.stock-badge.critical {
    background-color: #f5c6cb;
    color: #721c24;
    border: 1px solid #c82333;
}

/* ==================== REPORTES ====================*/

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.report-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

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

.report-card h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-total {
    padding: 1.5rem;
    background-color: white;
    border-radius: var(--border-radius);
    text-align: center;
    margin-top: 1rem;
    border: 2px solid var(--primary-color);
}

.total-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin: 0 0 0.5rem 0;
}

.total-amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--success-color);
    margin: 0;
}

.report-date,
.report-range {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.report-date input,
.report-range input {
    flex: 1;
    min-width: 150px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

.report-date input:focus,
.report-range input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.report-date .btn,
.report-range .btn {
    white-space: nowrap;
    padding: 0.5rem 1rem;
}

/* ==================== RESPONSIVE ====================*/

/* Pantallas con poca altura - asegurar que se vea el botón de completar venta */
@media (min-width: 1025px) and (max-height: 800px) {
    .cart-items {
        max-height: 200px;
    }

    .payment-section {
        padding: 0.4rem;
    }

    .cart-summary {
        padding: 0.45rem;
    }

    .pos-cart {
        gap: 0.4rem;
    }
}

@media (min-width: 1025px) and (max-height: 650px) {
    .cart-items {
        max-height: 130px;
    }

    .pos-cart h2 {
        font-size: 1rem;
    }

    .summary-row strong {
        font-size: 1rem;
    }
}

@media (max-width: 1024px) {
    .pos-page {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .pos-container,
    .pos-main {
        overflow: visible;
        min-height: 0;
    }

    .pos-main {
        grid-template-columns: 1fr;
        gap: 1rem;
        height: auto;
        padding: 0.75rem;
    }

    .pos-products {
        height: auto;
        overflow: visible;
        max-height: none;
    }

    .products-grid {
        overflow: visible;
    }

    .pos-cart {
        position: static;
        max-height: none;
        overflow: visible;
        height: auto;
    }

    .cart-items {
        max-height: 350px;
    }

    .item-info {
        flex-direction: column;
        align-items: flex-start;
    }

    .item-info .item-total {
        align-self: flex-end;
    }
}

@media (max-width: 768px) {
    .pos-header {
        padding: 0.6rem 0.75rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .pos-header h1 {
        font-size: 1rem;
        flex: 1;
    }

    .header-right {
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .header-right span {
        display: none;
    }

    .header-right .btn {
        font-size: 0.7rem;
        padding: 0.3rem 0.55rem;
    }

    .pos-main {
        padding: 0.5rem;
        gap: 0.75rem;
    }

    .pos-products {
        padding: 0.75rem;
    }

    .pos-cart {
        padding: 0.75rem;
    }

    .products-header {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .products-title {
        font-size: 1rem;
    }

    .products-count {
        font-size: 0.7rem;
        padding: 0.25rem 0.6rem;
    }

    /* Tabla de productos en mobile - convertir a tarjetas */
    .products-table thead {
        display: none;
    }

    .products-table,
    .products-table tbody,
    .products-table tr,
    .products-table td {
        display: block;
        width: 100%;
    }

    .products-table tr {
        border: 1px solid var(--border-color);
        border-radius: 10px;
        padding: 0.75rem;
        margin-bottom: 0.6rem;
        background: white;
        box-shadow: var(--box-shadow);
    }

    .products-table tr:hover {
        background: white;
    }

    .products-table td {
        padding: 0.3rem 0;
        text-align: left !important;
        border: none;
    }

    .products-table td.col-name {
        max-width: none;
        font-size: 1rem;
    }

    .products-table td.text-right,
    .products-table td.text-center {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }

    .products-table td.text-right::before {
        content: 'Precio:';
        font-size: 0.75rem;
        color: var(--secondary-color);
        font-weight: 600;
    }

    .products-table td:nth-child(4)::before {
        content: 'Stock:';
        font-size: 0.75rem;
        color: var(--secondary-color);
        font-weight: 600;
    }

    .products-table .qty-control {
        width: 100%;
        max-width: 200px;
    }

    .products-table .btn-add {
        width: 100%;
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .product-name-cell {
        max-width: none;
        white-space: normal;
    }

    /* Carrito mobile */
    .cart-items {
        max-height: 280px;
    }

    .admin-section {
        padding: 0;
    }

    .admin-table {
        font-size: 0.875rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 0.5rem;
    }

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

@media (max-width: 480px) {
    .products-search {
        flex-direction: column;
    }

    .filter-select {
        min-width: auto;
        width: 100%;
    }

    .pos-header h1 {
        font-size: 0.9rem;
    }

    .header-right .btn {
        font-size: 0.65rem;
        padding: 0.25rem 0.5rem;
    }

    .summary-totals {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 1.25rem;
    }

    .summary-payment-item {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 0.25rem;
    }

    .section-controls {
        flex-direction: column;
    }
}