/* Commercial Module - FULLY RESPONSIVE for 100% zoom */

/* Main Commercial Layout - Safer bottom margin for footer */
#commercial-module {
    height: calc(100vh - 140px);
    /* Increased buffer for system footer */
    display: flex;
    flex-direction: column;
}

/* Page Header - Super Compact */
#commercial-module .page-header {
    margin-bottom: 0.5rem !important;
    flex-shrink: 0;
}

#commercial-module .page-title h1 {
    font-size: 1.25rem !important;
    margin-bottom: 0px !important;
}

#commercial-module .page-subtitle {
    font-size: 0.7rem !important;
}

/* NCF Section - Minimal */
.ncf-selector {
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.ncf-selector h3 {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.ncf-selector select,
.ncf-selector .form-control {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    height: auto;
}

/* Search Box - Compact */
.search-box {
    position: relative;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.search-box input {
    padding: 0.5rem 0.75rem 0.5rem 2.5rem !important;
    font-size: 0.8125rem;
    height: auto;
}

.search-box i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Products Grid - Responsive Height */
.products-grid {
    display: grid;
    /* Smaller cards to fit more */
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.5rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding-right: 4px;
    /* Space for scrollbar */
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
    transform: translateY(-2px);
}

.product-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.25rem;
    font-size: 1rem;
    flex-shrink: 0;
}

.product-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.125rem;
    line-height: 1.1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-price {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #34d399;
    margin-top: auto;
}

/* Cart Panel - Fixed Height with Flex */
.cart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem;
    /* Ensure it fills parent height but respects layout */
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.cart-title {
    font-size: 0.875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cart-badge {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 700;
}

.cart-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    min-height: 0;
}

.cart-empty i {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    opacity: 0.3;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 0.5rem;
    min-height: 0;
    padding-right: 2px;
}

.cart-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

/* Delete button inside cart item */
.cart-item i.fa-trash {
    color: #ef4444;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.cart-item i.fa-trash:hover {
    opacity: 1;
}

.cart-totals {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
}

.cart-total-row.main {
    font-size: 0.9375rem;
    font-weight: 700;
    color: white;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.cart-total-row.main .amount {
    color: #34d399;
    font-size: 1.125rem;
}

/* Payment Method */
.cart-totals .form-group {
    margin-bottom: 0.5rem;
}

.cart-totals .form-group label {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    display: block;
}

.cart-totals select {
    padding: 0.375rem 0.625rem;
    font-size: 0.75rem;
    height: auto;
}

/* Facturar Button - Always Visible */
.facturar-btn {
    background: linear-gradient(135deg, #8b5cf6, #a855f7);
    color: white;
    padding: 0.625rem;
    border-radius: 0.5rem;
    border: none;
    width: 100%;
    font-size: 0.8125rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
    transition: all 0.25s;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.facturar-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(139, 92, 246, 0.5);
}

.facturar-btn i {
    font-size: 0.9375rem;
}

/* Scrollbar Styling - Ultra Subtle */
#product-results::-webkit-scrollbar,
.products-grid::-webkit-scrollbar {
    width: 3px;
}

#product-results::-webkit-scrollbar-track,
.products-grid::-webkit-scrollbar-track {
    background: transparent;
}

#product-results::-webkit-scrollbar-thumb,
.products-grid::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.15);
    border-radius: 3px;
}

#product-results::-webkit-scrollbar-thumb:hover,
.products-grid::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.35);
}

/* Firefox */
#product-results,
.products-grid {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.15) transparent;
}

/* Cart items scroll - same subtle style */
.cart-items::-webkit-scrollbar {
    width: 3px;
}

.cart-items::-webkit-scrollbar-track {
    background: transparent;
}

.cart-items::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.15);
    border-radius: 3px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.35);
}

.cart-items {
    scrollbar-width: thin;
    scrollbar-color: rgba(139, 92, 246, 0.15) transparent;
}