/* Custom Styles for Order Management Dashboard */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header Styles */
header {
    box-shadow: var(--box-shadow);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 0 !important; /* Reduce header padding */
}

.app-title {
    font-size: 1.3rem !important;
    font-weight: 600;
}

/* Card Styles */
.order-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.order-card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.order-card .card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    padding: 0.75rem 1rem; /* Reduce padding */
    border-bottom: none;
}

.order-card .card-header h5 {
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row; /* Keep title and trash on same line */
}

.order-card .card-header .order-number {
    font-size: 0.9rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.order-card .card-body {
    padding: 1rem; /* Reduce padding */
}

/* Product List Styles */
.product-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    background: #f8f9fa;
}

.product-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.product-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.1);
}

.product-item:last-child {
    margin-bottom: 0;
}

.product-item .product-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.product-item .product-name {
    font-weight: 600;
    color: var(--dark-color);
    flex-grow: 1;
}

.product-item .product-actions {
    display: flex;
    gap: 0.5rem;
}

.product-item .product-details {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.product-item .product-details .detail-label {
    font-weight: 500;
    color: var(--dark-color);
}

/* Totals Section */
.totals-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1rem;
}

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

.total-item {
    text-align: center;
    padding: 0.75rem;
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

.total-item .total-label {
    font-size: 0.8rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.total-item .total-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-color);
}

.total-item.total-price .total-value {
    color: var(--success-color);
}

.total-item.total-weight .total-value {
    color: var(--info-color);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
}

.btn-action {
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

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

.btn-complete:hover {
    background: linear-gradient(135deg, #157347 0%, #1aa179 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(25, 135, 84, 0.3);
}

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

.btn-delete:hover {
    background: linear-gradient(135deg, #b02a37 0%, #e8590c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

/* Modal Styles */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6610f2 100%);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Form Styles */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn-group .btn-check:checked + .btn {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Empty State */
#emptyState {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#emptyState i {
    opacity: 0.5;
}

/* Toast Styles */
.toast {
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.toast-header {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
    color: white;
    border-bottom: none;
}

.toast-header .btn-close {
    filter: invert(1);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Keep title and trash on same line */
    
    .product-item .product-details {
        display: none; /* Hide the detailed grid on mobile */
    }
    
    .product-item .product-name {
        font-size: 0.9rem;
        line-height: 1.3;
    }
    
    /* totals-grid already single column */
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn-action {
        width: 100%;
    }
    
    /* Keep minimum 2 columns for cards grid on mobile */
    .col-lg-6.col-xl-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .order-card .card-body {
        padding: 1rem;
    }
    
    .product-item {
        padding: 0.75rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    /* Ensure 2 columns even on very small screens */
    .col-lg-6.col-xl-4 {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0.25rem;
    }
    
    /* Make product names more compact on very small screens */
    .product-item .product-name {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    /* Reduce button sizes on mobile */
    .product-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-in {
    animation: slideIn 0.3s ease-out;
}

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

/* Utility Classes */
.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cursor-pointer {
    cursor: pointer;
}

.border-dashed {
    border-style: dashed !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6610f2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
}

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

/* Select2 Z-Index Fix for Bootstrap Modals */
.select2-container {
    z-index: 9999 !important;
}

.select2-dropdown {
    z-index: 9999 !important;
}

.select2-search--dropdown {
    z-index: 9999 !important;
}

.select2-results {
    z-index: 9999 !important;
}

/* Ensure Select2 dropdown appears above modal backdrop */
.modal {
    z-index: 1050;
}

.modal-backdrop {
    z-index: 1040;
}

.select2-container--open .select2-dropdown {
    z-index: 9999 !important;
}

/* Promotion Preview Styles */
.promotion-preview {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 0.75rem;
}

.promotion-preview .promotion-info {
    font-size: 0.875rem;
}

.promotion-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    margin-left: 0.5rem;
    border-radius: 0.25rem;
}

.eligible-item {
    border-left: 3px solid #0d6efd;
    padding-left: 0.5rem;
}

.free-item {
    border-left: 3px solid #198754;
    background-color: rgba(25, 135, 84, 0.1);
}

.excluded-item {
    border-left: 3px solid #6c757d;
    background-color: rgba(108, 117, 125, 0.1);
}

/* PIN Authentication Styles */
.pin-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.pin-dot {
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s ease;
}

.pin-dot.filled {
    background: #007bff;
    border-color: #007bff;
}

.pin-pad .btn {
    font-weight: bold;
    transition: all 0.2s ease;
}

.pin-pad .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.pin-pad .btn:active {
    transform: translateY(0);
}

/* App Overlay */
.app-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PIN Modal should be above overlay */
#pinModal {
    z-index: 1055 !important;
}

.app-overlay.hidden {
    display: none;
}

.overlay-content {
    max-width: 400px;
    padding: 40px;
}
