/* Mobile-First Responsive Design with New UI Improvements */
.twfp-wrapper {
    margin: 15px 0;
    text-align: center;
}

.twfp-open {
    background: linear-gradient(135deg, #25D366 0%, var(--twfp-btn-color, #128C7E) 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 280px;
    justify-content: center;
}

.twfp-open:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.twfp-trust {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.twfp-badge {
    background: rgba(37, 211, 102, 0.1);
    color: #128C7E;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.twfp-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 999999;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.twfp-modal.twfp-active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.twfp-card {
    background: var(--twfp-popup-bg, #ffffff);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    margin-top: 40px !important;
    position: relative;
    padding: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: twfp-slideIn 0.3s ease-out;
    overflow: visible;
}

@keyframes twfp-slideIn {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.twfp-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f1f1f1;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    transition: all 0.2s ease;
    z-index: 10;
}

.twfp-close:hover {
    background: #e0e0e0;
    color: #333;
}

.twfp-product-section {
    background: var(--twfp-product-bg, #f8f9fa);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.twfp-product-image-container {
    display: flex;
    justify-content: center;
    margin-top: -40px;
    margin-bottom: 12px;
}

.twfp-product-image {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 4px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 3;
    margin-top: -35px;
}

.twfp-product-info {
    text-align: center;
}

.twfp-prod-name {
    font-size: 15px;
    font-weight: 700;
    color: #2c3e50;
    margin: 0 0 5px;
    line-height: 1.3;
}

.twfp-prod-price {
    font-size: 16px;
    font-weight: 700;
    color: #25D366;
    margin: 0;
}

.twfp-heading {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
    text-align: center;
    margin: 0 0 6px;
}

.twfp-sub {
    text-align: center;
    color: #6c757d;
    margin: 0 0 15px;
    font-size: 12px;
    line-height: 1.4;
}

.twfp-form {
    padding: 0;
}

.twfp-row {
    margin-bottom: 12px;
}

.twfp-row label {
    display: block;
    font-weight: 600;
    color: #495057;
    margin-bottom: 5px;
    font-size: 12px;
}

.twfp-req {
    color: #dc3545;
}

.twfp-opt {
    color: #6c757d;
    font-weight: 400;
}

.twfp-row input,
.twfp-row textarea,
.twfp-row select {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #e9ecef;
    border-radius: 7px;
    font-size: 13px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
    font-family: inherit;
}

.twfp-row input:focus,
.twfp-row textarea:focus,
.twfp-row select:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.twfp-inline {
    display: flex;
    gap: 8px;
}

.twfp-col {
    flex: 1;
}

.twfp-quantity-box {
    display: flex;
    align-items: center;
    border: 1.5px solid #e9ecef;
    border-radius: 7px;
    overflow: hidden;
    background: #fff;
}

.twfp-quantity-btn {
    background: #f8f9fa;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    color: #495057;
    transition: all 0.2s ease;
}

.twfp-quantity-btn:hover {
    background: #e9ecef;
}

.twfp-quantity-input {
    width: 36px;
    border: none;
    text-align: center;
    padding: 0;
    height: 32px;
    font-weight: 600;
    font-size: 13px;
}

.twfp-actions {
    margin-top: 20px;
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.twfp-proceed {
    background: linear-gradient(135deg, #25D366 0%, var(--twfp-btn-color, #128C7E) 100%);
    color: white;
    border: none;
    padding: 11px 18px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all 0.2s ease;
}

.twfp-proceed:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.twfp-cancel {
    background: #6c757d;
    color: white;
    border: none;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.twfp-cancel:hover {
    background: #5a6268;
}

.twfp-foot {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: #6c757d;
}

.twfp-foot a {
    color: #25D366;
    text-decoration: none;
    font-weight: 600;
}

.twfp-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

/* Tablet Styles */
@media (min-width: 768px) {
    .twfp-modal {
        padding: 15px;
        align-items: center;
    }
    
    .twfp-card {
        margin: 30px !important;
        padding: 20px;
    }
    
    .twfp-open {
        width: auto;
        min-width: 280px;
    }
    
    .twfp-product-image {
        width: 80px;
        height: 80px;
    }
    
    .twfp-prod-name {
        font-size: 16px;
    }
    
    .twfp-heading {
        font-size: 20px;
    }
    
    .twfp-sub {
        font-size: 13px;
    }
    
    .twfp-actions {
        flex-direction: row;
    }
    
    .twfp-proceed {
        flex: 2;
    }
    
    .twfp-cancel {
        flex: 1;
    }
}
.twfp-total-breakdown {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin: 15px 0;
}

.twfp-total-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.twfp-total-item:last-child {
    border-bottom: none;
}

.twfp-grand-total {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid #dee2e6;
    font-size: 1.1em;
    color: #25D366;
}

/* Desktop Styles */
@media (min-width: 1024px) {
    .twfp-card {
        max-width: 430px;
        padding: 25px;
    }
    
    .twfp-product-image {
        width: 85px;
        height: 85px;
    }
    
    .twfp-heading {
        font-size: 21px;
    }
    
    .twfp-row {
        margin-bottom: 15px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .twfp-open,
    .twfp-proceed,
    .twfp-cancel,
    .twfp-close,
    .twfp-quantity-btn {
        min-height: 44px;
    }
    
    .twfp-row input,
    .twfp-row textarea,
    .twfp-row select {
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}