/**
 * Quick Order Popup CSS
 * Version: 7.7.0 - Optimized Spacing & Clean Design
 */

:root {
    --primary-color: #2563eb;
    --success-color: #28a745;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Modal Header - Reduced Padding
   ============================================ */
.quick-order-modal .modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #3b82f6 100%);
    border-bottom: none;
    padding: 0.875rem 1.25rem;
}

.quick-order-modal .modal-title {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.quick-order-modal .modal-title i {
    font-size: 1.125rem;
}

.quick-order-modal .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

/* ============================================
   Selected Products Section - Reduced Padding
   ============================================ */
/* ============================================
   Selected Products Section - Fixed Serial & Input
   ============================================ */
.selected-products-section {
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-bottom: 1px solid var(--gray-300);
}

.selected-products-title {
    color: #1e40af;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.selected-products-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 220px;
    overflow-y: auto;
}

/* Selected Product Item - Fixed Serial Position */
/* Selected Product Item - Position relative for serial */
.selected-product-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.5rem 0.5rem 0.8rem;
    background: white;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    position: relative;
    transition: all 0.2s;
    overflow: visible;
    margin-top: 8px;
}

/* Fixed Serial Number - Inside the box */
.selected-product-serial {
    position: absolute;
    top: -8px;
    left: 0px;
    width: 20px;
    height: 20px;
    background: #2563eb;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Product image - adjust margin */
.selected-product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 0.3rem;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.selected-product-image {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 0.3rem;
    border: 1px solid #e5e7eb;
    flex-shrink: 0;
    margin-left: 0.25rem;
}

.selected-product-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.selected-product-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.1rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-product-price {
    font-size: 0.7rem;
    color: #28a745;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

/* Quantity Controls */
.selected-product-controls {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex-shrink: 0;
}

.quantity-control-small {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    background: #f3f4f6;
    border-radius: 0.3rem;
    padding: 0.1rem;
    border: 1px solid #e5e7eb;
}

.qty-btn-small {
    width: 22px;
    height: 22px;
    border: none;
    background: white;
    border-radius: 0.3rem;
    color: #6b7280;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn-small:hover {
    background: #2563eb;
    color: white;
}

.qty-input-small {
    width: 15!important;;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 0.7rem;
    font-weight: 600;
    color: #1f2937;
    padding: 0;
}

/* Remove Button */
.remove-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: #ef4444;
    color: white;
    border-radius: 0.3rem;
    font-size: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.remove-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* ============================================
   Form Section - Reduced Input Height
   ============================================ */
.form-section {
    padding: 0.6rem 0.75rem;
    background: #f3f4f6;
}

.form-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #2563eb;
}

.form-group.row {
    margin-bottom: 0.6rem;
    background: white;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
}

.form-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0;
}

/* Input Field - Reduced Height */
.form-control-pro {
    width: 100%;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    color: #1f2937;
    background-color: white;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    transition: all 0.2s;
    height: auto;
    line-height: 1.3;
}

.form-control-pro:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-control-pro.error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

/* Textarea - Keep reasonable height */
textarea.form-control-pro {
    resize: vertical;
    min-height: 50px;
    padding: 0.35rem 0.6rem;
}

.error-message {
    color: #ef4444;
    font-size: 0.6rem;
    margin-top: 0.2rem;
    display: none;
}

/* ============================================
   Submit Button
   ============================================ */
.submit-section {
    margin-top: 0.6rem;
}

.submit-btn-pro {
    width: 100%;
    padding: 0.6rem;
    background: linear-gradient(135deg, #28a745 0%, #34d399 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-btn-pro:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

.total-amount {
    background: white;
    color: #28a745;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    font-weight: 700;
    font-size: 0.75rem;
    margin-left: 0.3rem;
}

/* ============================================
   Shipping Zones Section
   ============================================ */
.shipping-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf5 100%);
    padding: 0.6rem 0.75rem;
    margin: 0;
    border-top: 1px solid #e0e6ed;
    border-bottom: 1px solid #e0e6ed;
}

.shipping-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 0.6rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid #ffc107;
    display: inline-block;
}

.shipping-zone-card {
    cursor: pointer;
    margin-bottom: 0.0rem;
    transition: all 0.2s ease;
}

.zone-card-inner {
    background: white;
    border-radius: 0.5rem;
    padding: 0.6rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.zone-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.1rem 0;
    padding-right: 30px;
}

.zone-cost {
    margin-top: 0.4rem;
    padding-top: 0.3rem;
    border-top: 1px dashed #e5e7eb;
}

.cost-amount {
    font-size: 0.9rem;
    font-weight: 700;
    display: inline-block;
}

/* ============================================
   Price Summary Section
   ============================================ */
.price-summary-section {
    padding: 0.6rem 0.75rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
}

.price-label {
    font-size: 0.75rem;
    color: #6b7280;
}

.price-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: #1f2937;
}

.total-row {
    border-top: 1px solid #e5e7eb;
    margin-top: 0.2rem;
    padding-top: 0.4rem;
}

.total-row .price-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #1f2937;
}

.total-row .price-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #28a745;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .selected-product-item {
        flex-wrap: wrap;
        padding: 0.35rem 0.45rem;
    }
    
    .selected-product-info {
        width: calc(100% - 100px);
    }
    
    .selected-product-controls {
        width: auto;
        justify-content: flex-end;
        margin-top: 0;
    }
    
    .selected-product-name {
        font-size: 0.65rem;
    }
    
    .selected-product-price {
        font-size: 0.65rem;
    }
    
    .form-group.row {
        flex-direction: column;
        text-align: left;
    }
    
    .form-label {
        margin-bottom: 0.25rem;
    }
    
    /* Fix serial on mobile */
    .selected-product-serial {
        top: -6px;
        left: 0px;
        width: 18px;
        height: 18px;
        font-size: 0.55rem;
    }
    
    .selected-product-image {
        margin-left: 0.15rem;
    }
}

@media (max-width: 480px) {
    .selected-product-image {
        width: 35px;
        height: 35px;
    }
    
    .selected-product-name {
        font-size: 0.8rem;
    }
    
    .qty-btn-small {
        width: 20px;
        height: 20px;
    }
    
    .qty-input-small {
        width: 22px;
        font-size: 0.6rem;
    }
    
    .remove-btn {
        width: 22px;
        height: 22px;
    }
    
    /* Input smaller on mobile */
    .form-control-pro {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
}

/* ============================================
   Price Summary Section - Reduced Padding
   ============================================ */
.price-summary-section {
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
}

.price-label {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.price-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
}

.total-row {
    border-top: 1px solid var(--gray-200);
    margin-top: 0.25rem;
    padding-top: 0.5rem;
}

.total-row .price-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.total-row .price-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--success-color);
}

.shipping-charge {
    color: var(--success-color);
    font-weight: 600;
}

.shipping-charge i {
    margin-right: 0.25rem;
}

/* ============================================
   Shipping Zones Section - Compact
   ============================================ */
.shipping-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8edf5 100%);
    padding: 0.75rem 1rem;
    margin: 0;
    border-top: 1px solid #e0e6ed;
    border-bottom: 1px solid #e0e6ed;
}

.shipping-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #ffc107;
    display: inline-block;
}

.shipping-title i {
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

/* Shipping Zone Card - Compact */
.shipping-zone-card {
    cursor: pointer;
    margin-bottom: 0.0rem;
    transition: all 0.2s ease;
}

.zone-card-inner {
    background: white;
    border-radius: var-radius);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    position: relative;
}

.shipping-zone-card:hover .zone-card-inner {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: #ffc107;
}

.shipping-zone-card.selected .zone-card-inner {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff9e6 0%, #ffffff 100%);
    box-shadow: var(--shadow);
}

/* Zone Icon - Smaller */
.zone-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zone-icon i {
    font-size: 14px;
    color: var(--gray-500);
    transition: all 0.2s ease;
}

.shipping-zone-card.selected .zone-icon {
    background: #ffc107;
}

.shipping-zone-card.selected .zone-icon i {
    color: white;
}

/* Zone Info - Compact */
.zone-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0 0 0.125rem 0;
    padding-right: 35px;
}

.zone-cost {
    margin-top: 0.5rem;
    padding-top: 0.375rem;
    border-top: 1px dashed var(--gray-200);
}

.cost-amount {
    font-size: 1rem;
    font-weight: 700;
    display: inline-block;
}

.paid-delivery .cost-amount {
    color: var(--success-color);
}

.paid-delivery .cost-amount::before {
    content: "৳";
    font-size: 0.75rem;
    margin-right: 1px;
}

.free-delivery .cost-amount {
    color: var(--success-color);
}

.free-delivery .cost-amount::before {
    content: "🎁 ";
    font-size: 0.75rem;
}

/* Zone Radio - Smaller */
.zone-select {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.zone-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
}

.zone-radio:checked {
    border-color: #ffc107;
    background-color: #ffc107;
}

.zone-radio:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

.zone-radio:hover {
    border-color: #ffc107;
}

/* ============================================
   Form Section - Compact
   ============================================ */
.form-section {
    padding: 0.75rem 1rem;
    background: var(--gray-100);
}

.form-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.form-group.row {
    margin-bottom: 0.75rem;
    background: white;
    padding: 0.625rem;
    border-radius: var-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    transition: all 0.2s;
}

.form-group.row:hover {
    box-shadow: var(--shadow);
}

.form-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0;
}

.form-label.required::after {
    content: "*";
    color: var(--danger-color);
    margin-left: 0.25rem;
}

.form-control-pro {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-800);
    background-color: white;
    border: 1px solid var(--gray-300);
    border-radius: var-radius-sm);
    transition: all 0.2s;
}

.form-control-pro:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-control-pro.error {
    border-color: var(--danger-color);
    background-color: #fef2f2;
}

textarea.form-control-pro {
    resize: vertical;
    min-height: 60px;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.6875rem;
    margin-top: 0.25rem;
    display: none;
}

/* ============================================
   Submit Button - Compact
   ============================================ */
.submit-section {
    margin-top: 0.75rem;
}

.submit-btn-pro {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%);
    color: white;
    border: none;
    border-radius: var-radius);
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}

.submit-btn-pro:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.submit-btn-pro:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.total-amount {
    background: white;
    color: var(--success-color);
    padding: 0.25rem 0.625rem;
    border-radius: var-radius-sm);
    font-weight: 700;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

/* ============================================
   Variation Radio Buttons - Compact
   ============================================ */
.variations select {
    display: none !important;
}

.variation-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.variation-radio-option {
    display: inline-block;
}

.variation-radio-input {
    display: none;
}

.variation-radio-label {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var-radius-sm);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
    text-align: center;
}

.variation-radio-label:hover {
    border-color: #ffc107;
    background: #fff9e6;
}

.variation-radio-input:checked + .variation-radio-label {
    border-color: var(--success-color);
    background: #e8f5e9;
    color: #155724;
    font-weight: 600;
}

.variation-price {
    display: block;
    margin-top: 0.125rem;
    color: var(--success-color);
    font-weight: 700;
    font-size: 0.6875rem;
}

.variation-name {
    display: block;
    font-size: 0.6875rem;
}

/* ============================================
   Multi Product Message
   ============================================ */
.multiple-product-alert {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69b 100%);
    border: none;
    border-radius: 0;
    margin: 0;
    padding: 0.625rem 1rem;
    color: #856404;
    font-size: 0.75rem;
}

.multiple-product-alert i {
    font-size: 0.875rem;
    margin-right: 0.5rem;
}

.multiple-product-alert .btn-close {
    font-size: 0.625rem;
    filter: brightness(0.5);
}

/* ============================================
   Loading Overlay
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    display: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .quick-order-modal .modal-dialog {
        margin: 0.5rem;
    }
    
    .selected-product-item {
        flex-wrap: wrap;
    }
    
    .selected-product-controls {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.25rem;
    }
    
    .zone-name {
        font-size: 0.8125rem;
    }
    
    .cost-amount {
        font-size: 0.875rem;
    }
    
    .form-group.row {
        flex-direction: column;
        text-align: left;
    }
    
    .form-label {
        margin-bottom: 0.375rem;
    }
}

@media (max-width: 576px) {
    .variation-radio-group {
        gap: 0.375rem;
    }
    
    .variation-radio-label {
        padding: 0.25rem 0.5rem;
        font-size: 0.6875rem;
    }
    
    .total-row .price-value {
        font-size: 1rem;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */
.selected-products-list::-webkit-scrollbar {
    width: 4px;
}

.selected-products-list::-webkit-scrollbar-track {
    background: var(--gray-200);
    border-radius: 4px;
}

.selected-products-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.shipping-zone-card {
    animation: fadeInUp 0.2s ease forwards;
}




@media (max-width: 768px) {
    /* Modal Header - Mobile */  
    .quick-order-modal .modal-title {
        font-size: 0.9rem;
    }
    
    .quick-order-modal .modal-title i {
        font-size: 0.8rem;
    }
}

.shipping-zone-card:nth-child(1) { animation-delay: 0.03s; }
.shipping-zone-card:nth-child(2) { animation-delay: 0.06s; }
.shipping-zone-card:nth-child(3) { animation-delay: 0.09s; }
.shipping-zone-card:nth-child(4) { animation-delay: 0.12s; }