/**
 * Volume Calculator Styles - FIXED VERSION
 * Save as: assets/css/volume-calculator.css
 */

/* Calculate Volume Button */
.calculate-volume-btn {
    margin-top: 12px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    width: 100%;
}

.calculate-volume-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.calculate-volume-btn:active {
    transform: translateY(0);
}

/* Modal Overlay */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9998;
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

/* Volume Modal - FIXED: Removed duplicate display property */
.volume-modal {
    display: none; /* IMPORTANT: Hidden by default */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    overflow: hidden;
    flex-direction: column;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.volume-modal.active {
    display: flex; /* Only flex when active */
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

/* Category Tabs */
.category-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.category-tab:hover {
    background: #e5e7eb;
    color: #374151;
}

.category-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.category-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Items Container */
.items-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.item-row:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.item-row.has-quantity {
    background: #ecfdf5;
    border-color: #10b981;
}

.item-row.hidden {
    display: none;
}

.item-name {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
}

.item-row.has-quantity .item-name {
    color: #059669;
    font-weight: 600;
}

/* Item Controls */
.item-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #d1d5db;
    background: white;
    color: #6b7280;
    border-radius: 8px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.qty-btn:hover:not(:disabled) {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: scale(1.1);
}

.qty-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.qty-display {
    min-width: 30px;
    text-align: center;
    font-size: 16px;
    font-weight: 700;
    color: #374151;
}

.item-row.has-quantity .qty-display {
    color: #059669;
}

/* Modal Footer */
.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #f9fafb;
    border-top: 2px solid #e5e7eb;
}

.total-volume {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.total-volume span:first-child {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.total-volume strong {
    font-size: 24px;
    color: #059669;
    font-weight: 800;
}

.save-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

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

/* No Items Message */
.mqc-no-items {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.mqc-no-items p:first-child {
    font-size: 48px;
    margin-bottom: 12px;
}

.mqc-no-items p:last-child {
    font-size: 16px;
    color: #6b7280;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.item-updated {
    animation: itemPulse 0.3s ease;
}

@keyframes itemPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.volume-updated {
    animation: volumeHighlight 0.3s ease;
}

@keyframes volumeHighlight {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        color: #10b981;
    }
}

.mqc-input-success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
    animation: successPulse 0.6s ease;
}

@keyframes successPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .volume-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .category-tabs {
        gap: 6px;
    }
    
    .category-tab {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .item-row {
        padding: 12px 14px;
    }
    
    .item-name {
        font-size: 14px;
    }
    
    .qty-btn {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 16px;
        padding: 16px 20px;
    }
    
    .total-volume {
        width: 100%;
        text-align: center;
    }
    
    .save-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .category-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .item-controls {
        gap: 8px;
    }
    
    .qty-btn {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
}