/* Flexbox Layout Styles */
#app {
    min-height: 100vh;
}

/* Sidebar Container */
.sidebar-container {
    width: 280px;
    min-width: 280px;
    background: #2c3e50;
    color: white;
    transition: all 0.3s ease;
    overflow-y: auto;
    height: 100%;
}

.sidebar-container.sidebar-hidden {
    transform: translateX(-100%);
    width: 0;
    min-width: 0;
    /* Removemos margin-left negativo que causaba desplazamiento excesivo */
}

/* Desktop sidebar behavior */
@media (min-width: 768px) {
    .sidebar-container.sidebar-hidden {
        transform: translateX(-100%);
        width: 0;
        min-width: 0;
    }
}

/* Main Content Container */
.main-content-container {
    flex: 1;
    min-width: 0;
    transition: all 0.3s ease;
    background: #f8f9fa;
    /* Removemos width fijo para que flexbox maneje el ancho */
}

.main-content-container.sidebar-hidden {
    margin-left: 0;
    /* Flexbox automáticamente expandirá el contenido */
}

/* Full width content when no sidebar */
.main-content-container.w-100 {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
}

/* Home button styling for non-admin users */
.btn-outline-primary {
    border-color: #3498db;
    color: #3498db;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

/* Currency Input Styling */
.currency-input {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    text-align: right;
    padding-right: 0.75rem;
}

.currency-input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

.currency-input::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Currency Display Styling */
.currency-display {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #28a745;
}

.currency-display.negative {
    color: #dc3545;
}

.currency-display.zero {
    color: #6c757d;
}

/* Product Modal Styling */
#productQuickViewModal .modal-lg {
    max-width: 800px;
}

#productQuickViewModal .modal-body {
    padding: 1.5rem;
}

#productQuickViewModal .img-fluid {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border: 3px solid #f8f9fa;
}

#productQuickViewModal .btn-outline-secondary {
    transition: all 0.2s ease;
    font-weight: 600;
}

#productQuickViewModal .btn-outline-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#productQuickViewModal .btn-outline-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.3);
}

#productQuickViewModal .btn-outline-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(25,135,84,0.3);
}

#productQuickViewModal #quantityInput {
    border: 2px solid #dee2e6;
    background-color: #f8f9fa;
}

#productQuickViewModal #quantityInput:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.25);
}

/* Sidebar Styling */
.sidebar {
    height: 100%;
}

.sidebar .nav-link {
    color: #ecf0f1;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.25rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link:hover {
    background: #34495e;
    color: white;
}

.sidebar .nav-link.active {
    background: #3498db;
    color: white;
}

.sidebar small.text-muted {
    color: #bdc3c7 !important;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Main Content */
.main-content {
    height: 100%;
    overflow-y: auto;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar-container {
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        width: 280px;
        min-width: 280px;
        transition: transform 0.3s ease;
    }
    
    .sidebar-container:not(.sidebar-hidden) {
        transform: translateX(0);
    }
    
    /* Sidebar overlay for mobile */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content-container {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Mobile modal adjustments */
    #productQuickViewModal .modal-lg {
        max-width: 95vw;
        margin: 0.5rem;
    }
    
    #productQuickViewModal .row {
        flex-direction: column;
    }
    
    #productQuickViewModal .col-md-4,
    #productQuickViewModal .col-md-8 {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* Custom Numeric Keypad Styles */
    .numeric-keypad {
        display: block !important;
        background-color: #f8f9fa !important;
        border-radius: 10px !important;
        padding: 12px !important;
        border: 1px solid #dee2e6 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1) !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    .keypad-row {
        display: flex !important;
        justify-content: space-between !important;
        margin-bottom: 8px !important;
        gap: 6px !important;
    }
    
    .keypad-row:last-child {
        margin-bottom: 0 !important;
    }
    
    .keypad-btn {
        flex: 1 !important;
        height: 45px !important;
        border: 1px solid #ccc !important;
        border-radius: 6px !important;
        background-color: white !important;
        color: #333 !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.2) !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .keypad-btn:hover {
        background-color: #f8f9fa !important;
        border-color: #adb5bd !important;
    }
    
    .keypad-btn:active {
        transform: translateY(1px) !important;
        box-shadow: inset 0 1px 2px rgba(0,0,0,0.3) !important;
    }
    
    .keypad-number {
        background-color: white !important;
        color: #333 !important;
    }
    
    .keypad-clear {
        background-color: #dc3545 !important;
        color: white !important;
        border-color: #dc3545 !important;
        font-size: 0.8rem !important;
    }
    
    .keypad-clear:hover {
        background-color: #c82333 !important;
        border-color: #bd2130 !important;
    }
    
    .keypad-confirm {
        background-color: #28a745 !important;
        color: white !important;
        border-color: #28a745 !important;
        font-size: 0.8rem !important;
    }
    
    .keypad-confirm:hover {
        background-color: #218838 !important;
        border-color: #1e7e34 !important;
    }
    
    /* Variant selection mobile improvements */
    #variantSelect {
        font-size: 1rem !important;
        height: 45px !important;
        border-radius: 6px !important;
        z-index: 1050 !important;
        position: relative !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
        font-weight: 600 !important;
        margin-bottom: 0.5rem !important;
        z-index: 1 !important;
        position: relative !important;
    }
    
    /* Ensure variant selection is visible */
    .modal-body .form-select {
        width: 100% !important;
        display: block !important;
    }
    
    /* Fix dropdown positioning */
    .form-select:focus {
        z-index: 1060 !important;
        position: relative !important;
    }
    
    /* Ensure dropdown appears below */
    .modal-body {
        overflow: visible !important;
        z-index: 1050 !important;
    }
    
    .modal-content {
        overflow: visible !important;
    }
    
    /* Force dropdown to appear below */
    .modal.show .modal-dialog {
        z-index: 1060 !important;
    }
    
    .modal.show .modal-content {
        z-index: 1061 !important;
    }
    
    /* Specific fix for select dropdown */
    select.form-select {
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
    }
    
    /* Ensure proper stacking context */
    .modal-body > .row {
        position: relative !important;
        z-index: 1 !important;
    }
    
    /* Custom dropdown styles for mobile */
    .custom-select-container {
        position: relative !important;
        width: 100% !important;
    }
    
    .custom-select {
        width: 100% !important;
        height: 45px !important;
        border: 1px solid #ced4da !important;
        border-radius: 6px !important;
        background-color: white !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 12px !important;
        cursor: pointer !important;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out !important;
    }
    
    .custom-select:hover {
        border-color: #86b7fe !important;
    }
    
    .custom-select-text {
        flex: 1 !important;
        font-size: 1rem !important;
        color: #212529 !important;
    }
    
    .custom-select-arrow {
        color: #6c757d !important;
        transition: transform 0.15s ease-in-out !important;
    }
    
    .custom-select-options {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: 0 !important;
        background-color: white !important;
        border: 1px solid #ced4da !important;
        border-top: none !important;
        border-radius: 0 0 6px 6px !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
        z-index: 1000 !important;
        max-height: 200px !important;
        overflow-y: auto !important;
    }
    
    .custom-select-option {
        padding: 12px !important;
        cursor: pointer !important;
        border-bottom: 1px solid #f8f9fa !important;
        transition: background-color 0.15s ease-in-out !important;
    }
    
    .custom-select-option:last-child {
        border-bottom: none !important;
    }
    
    .custom-select-option:hover {
        background-color: #f8f9fa !important;
    }
    
    .custom-select-option.active {
        background-color: #e7f1ff !important;
        color: #0d6efd !important;
        font-weight: 600 !important;
    }
}

/* Desktop Numeric Keypad Styles */
.numeric-keypad {
    display: block;
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    margin: 0;
}

.keypad-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 8px;
}

.keypad-row:last-child {
    margin-bottom: 0;
}

.keypad-btn {
    flex: 1;
    height: 50px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: white;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    padding: 0;
    margin: 0;
}

.keypad-btn:hover {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.keypad-btn:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

.keypad-number {
    background-color: white;
    color: #333;
}

.keypad-clear {
    background-color: #dc3545;
    color: white;
    border-color: #dc3545;
}

.keypad-clear:hover {
    background-color: #c82333;
    border-color: #bd2130;
}

.keypad-confirm {
    background-color: #28a745;
    color: white;
    border-color: #28a745;
}

.keypad-confirm:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

@media (max-width: 768px) {
    /* Mobile product grid improvements */
    .products-container {
        height: 400px !important;
        padding: 10px;
    }
    
    /* Light background for product cards in mobile */
    .products-container .product-card {
        background-color: #ffffff !important;
        border: 1px solid #e9ecef !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }
    
    /* Dark text colors for white background cards */
    .products-container .product-card .card-title {
        color: #212529 !important;
    }
    
    .products-container .product-card .card-text {
        color: #495057 !important;
    }
    
    .products-container .product-card .text-info {
        color: #0dcaf0 !important;
    }
    
    .products-container .product-card .text-muted {
        color: #6c757d !important;
    }
    
    .products-container .product-card .text-danger {
        color: #dc3545 !important;
    }
    
    .products-container .product-card {
        height: 140px;
        margin-bottom: 10px;
    }
    
    .products-container .product-card img {
        height: 80px !important;
        object-fit: cover;
    }
    
    .products-container .product-card .card-body {
        padding: 0.5rem;
    }
    
    .products-container .product-card .card-title {
        font-size: 0.8rem !important;
        line-height: 1.1 !important;
        margin-bottom: 0.25rem;
    }
    
    .products-container .product-card .card-text {
        font-size: 0.85rem !important;
        margin-bottom: 0.25rem;
    }
    
    .products-container .product-card small {
        font-size: 0.7rem !important;
    }
    
    /* Mobile quantity input */
    #quantityInput {
        height: 50px !important;
        font-size: 1.8rem !important;
        border-radius: 8px;
    }
    
    /* Mobile search and filters */
    .input-group .form-control {
        font-size: 1rem;
        height: 45px;
    }
    
    .input-group .btn {
        height: 45px;
    }
    
    .form-select {
        font-size: 1rem;
        height: 45px;
    }
    
    /* Mobile table responsiveness */
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Mobile button adjustments */
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Mobile form adjustments */
    .form-control,
    .form-select {
        font-size: 0.875rem;
    }
    
    /* Mobile card adjustments */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Mobile modal adjustments */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 0.5rem;
    }
    
    /* Mobile form adjustments */
    .form-label {
        font-size: 0.875rem;
        font-weight: 600;
    }
    
    /* Mobile button group adjustments */
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Mobile avatar adjustments */
    .avatar-sm {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
    
    /* Mobile badge adjustments */
    .badge {
        font-size: 0.75rem;
    }
    
    /* Mobile pagination adjustments */
    .pagination {
        font-size: 0.875rem;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.75rem;
    }
}

/* Dark Theme Colors */
.sidebar {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

.sidebar .nav-link:hover {
    background: rgba(52, 152, 219, 0.2);
    border-left: 3px solid #3498db;
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}
