/* Reset and Bengali Font */
.tfs-popup-overlay,
.tfs-popup-overlay *,
.tfs-popup-container,
.tfs-popup-container * {
    font-family: 'Anek Bangla', sans-serif !important;
    box-sizing: border-box !important;
}

/* Order Button */
.tfs-order-btn {
    display: inline-block !important;
    padding: 12px 25px !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 5px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin: 10px 0 !important;
    text-decoration: none !important;
    line-height: normal !important;
    text-align: center !important;
    width: auto !important;
    max-width: 100% !important;
}

.tfs-order-btn:hover {
    opacity: 0.9 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
    color: #fff !important;
}

/* Popup Overlay - MAXIMUM PRIORITY */
.tfs-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.85) !important;
    z-index: 999999999 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 15px !important;
    overflow-y: auto !important;
    animation: fadeIn 0.3s ease !important;
    margin: 0 !important;
}

.tfs-popup-overlay[style*="display: block"],
.tfs-popup-overlay[style*="display: flex"] {
    display: flex !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Popup Container - CENTERED & RESPONSIVE */
.tfs-popup-container {
    background: #ffffff !important;
    border-radius: 12px !important;
    width: 95% !important;
    max-width: 420px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    position: relative !important;
    margin: auto !important;
    padding: 0 !important;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5) !important;
    animation: slideUp 0.3s ease !important;
    transform: none !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    float: none !important;
}

@keyframes slideUp {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Close Button - FIXED POSITION */
.tfs-popup-close {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: #ff4444 !important;
    color: #ffffff !important;
    font-size: 22px !important;
    line-height: 36px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    z-index: 100 !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
    font-weight: 300 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

.tfs-popup-close:hover {
    background: #d32f2f !important;
    transform: rotate(90deg) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Popup Content */
.tfs-popup-content {
    padding: 42px 18px 18px 18px !important;
}

.tfs-popup-title {
    font-size: 18px !important;
    color: #333 !important;
    margin: 0 0 12px 0 !important;
    text-align: center !important;
    font-weight: 600 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
}

/* Product Info */
.tfs-product-info {
    display: flex !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
    padding: 10px !important;
    background: #f8f9fa !important;
    border-radius: 8px !important;
    align-items: flex-start !important;
}

.tfs-product-info img {
    width: 65px !important;
    height: 65px !important;
    object-fit: cover !important;
    border-radius: 6px !important;
    flex-shrink: 0 !important;
}

.tfs-product-details {
    flex: 1 !important;
    min-width: 0 !important;
}

.tfs-product-details h3 {
    margin: 0 0 6px 0 !important;
    font-size: 14px !important;
    color: #333 !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
}

.tfs-product-price {
    font-size: 13px !important;
    color: #ff6900 !important;
    font-weight: 600 !important;
    margin: 0 0 8px 0 !important;
}

/* Quantity Wrapper */
.tfs-quantity-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    overflow: hidden !important;
    background: #fff !important;
}

.tfs-qty-minus,
.tfs-qty-plus {
    width: 36px !important;
    height: 36px !important;
    border: none !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #333 !important;
    padding: 0 !important;
}

.tfs-qty-minus:hover,
.tfs-qty-plus:hover {
    background: #e0e0e0 !important;
}

#tfs-quantity {
    width: 60px !important;
    height: 36px !important;
    border: none !important;
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    text-align: center !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    padding: 0 !important;
    background: #fff !important;
    -moz-appearance: textfield !important;
}

#tfs-quantity::-webkit-outer-spin-button,
#tfs-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* Form Groups - FIXED FOR ALL THEMES */
.tfs-form-group {
    margin-bottom: 10px !important;
    clear: both !important;
    width: 100% !important;
    float: none !important;
}

.tfs-form-group label {
    display: block !important;
    margin-bottom: 5px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: #333 !important;
    line-height: 1.3 !important;
    width: 100% !important;
    float: none !important;
}

.tfs-form-group input,
.tfs-form-group textarea,
.tfs-form-group select {
    width: 100% !important;
    max-width: 100% !important;
    padding: 9px 11px !important;
    border: 1px solid #ddd !important;
    border-radius: 5px !important;
    font-size: 13px !important;
    transition: border-color 0.3s ease !important;
    background: #fff !important;
    box-sizing: border-box !important;
    display: block !important;
    float: none !important;
    margin: 0 !important;
    line-height: normal !important;
    height: auto !important;
}

.tfs-form-group textarea {
    min-height: 70px !important;
    max-height: 150px !important;
    resize: vertical !important;
    overflow-y: auto !important;
}

.tfs-form-group select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    padding-right: 35px !important;
    cursor: pointer !important;
}

.tfs-form-group input:focus,
.tfs-form-group textarea:focus,
.tfs-form-group select:focus {
    outline: none !important;
    border-color: #ff6900 !important;
    box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.1) !important;
}

/* Total Price */
.tfs-total-price {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%) !important;
    padding: 12px 15px !important;
    border-radius: 8px !important;
    margin: 14px 0 !important;
    text-align: center !important;
    border: 2px solid #ffd54f !important;
    clear: both !important;
}

.tfs-total-price p {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #333 !important;
}

#tfs-total-amount {
    color: #ff6900 !important;
    font-size: 19px !important;
    font-weight: 700 !important;
}

/* Submit Button */
.tfs-submit-btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 13px !important;
    background: linear-gradient(135deg, #ff6900 0%, #ff8c00 100%) !important;
    color: #fff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-transform: none !important;
    box-shadow: 0 4px 15px rgba(255, 105, 0, 0.3) !important;
    margin-top: 5px !important;
    display: block !important;
    float: none !important;
    line-height: normal !important;
}

.tfs-submit-btn:hover {
    background: linear-gradient(135deg, #e55a00 0%, #ff6900 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(255, 105, 0, 0.4) !important;
}

.tfs-submit-btn:active {
    transform: translateY(0) !important;
}

.tfs-submit-btn:disabled {
    background: #ccc !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.7 !important;
}

/* Success Message */
.tfs-success-message {
    text-align: center !important;
    padding: 30px 20px !important;
}

.tfs-success-icon {
    width: 70px !important;
    height: 70px !important;
    background: #4caf50 !important;
    color: #fff !important;
    font-size: 40px !important;
    line-height: 70px !important;
    border-radius: 50% !important;
    margin: 0 auto 15px !important;
    animation: scaleIn 0.5s ease !important;
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.tfs-success-message h2 {
    color: #333 !important;
    margin-bottom: 12px !important;
    font-size: 19px !important;
}

.tfs-success-message p {
    font-size: 13px !important;
    line-height: 1.5 !important;
    margin: 8px 0 !important;
}

.tfs-order-details {
    background: #f9f9f9 !important;
    padding: 15px !important;
    border-radius: 8px !important;
    margin: 18px 0 !important;
    text-align: left !important;
}

.tfs-order-details p {
    margin: 6px 0 !important;
    font-size: 12px !important;
}

.tfs-download-btn,
.tfs-close-success {
    padding: 12px 30px !important;
    background: #4caf50 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-block !important;
    text-decoration: none !important;
    margin: 8px 5px !important;
}

.tfs-download-btn:hover,
.tfs-close-success:hover {
    background: #45a049 !important;
    color: #fff !important;
}

/* Loading State */
.tfs-loading {
    display: inline-block !important;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid #f3f3f3 !important;
    border-top: 2px solid #ff6900 !important;
    border-radius: 50% !important;
    animation: spin 1s linear infinite !important;
    margin-left: 8px !important;
    vertical-align: middle !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Messages */
.tfs-error {
    color: #f44336 !important;
    font-size: 11px !important;
    margin-top: 4px !important;
    display: block !important;
}

.tfs-form-group.has-error input,
.tfs-form-group.has-error textarea,
.tfs-form-group.has-error select {
    border-color: #f44336 !important;
}

/* Scrollbar */
.tfs-popup-container::-webkit-scrollbar {
    width: 6px !important;
}

.tfs-popup-container::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

.tfs-popup-container::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 3px !important;
}

.tfs-popup-container::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

/* Prevent body scroll when popup is open */
body.tfs-popup-open {
    overflow: hidden !important;
    padding-right: 0 !important;
}

/* Hide sidebar when popup is active */
body.tfs-popup-open aside,
body.tfs-popup-open .sidebar,
body.tfs-popup-open #secondary {
    z-index: 1 !important;
}

/* Theme Compatibility Fixes */
.tfs-popup-container input[type="text"],
.tfs-popup-container input[type="tel"],
.tfs-popup-container input[type="number"],
.tfs-popup-container textarea,
.tfs-popup-container select {
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    box-shadow: none !important;
}

/* Responsive */
@media (max-width: 480px) {
    .tfs-popup-overlay {
        padding: 10px !important;
    }
    
    .tfs-popup-container {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 10px !important;
    }
    
    .tfs-popup-content {
        padding: 40px 15px 15px 15px !important;
    }
    
    .tfs-popup-title {
        font-size: 17px !important;
    }
    
    .tfs-product-info img {
        width: 55px !important;
        height: 55px !important;
    }
    
    .tfs-product-details h3 {
        font-size: 13px !important;
    }
}