/* Modal Base Styles */
.ovp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 20px;
    animation: ovpFadeIn 0.3s ease;
}

.ovp-modal-container {
    background: white;
    border-radius: 16px;
    max-width: 95%;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: ovpSlideUp 0.4s ease;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .ovp-modal-container {
        max-width: 600px;
    }
}

@media (min-width: 1024px) {
    .ovp-modal-container {
        max-width: 700px;
    }
}

/* Header */
.ovp-modal-header {
    background: linear-gradient(135deg, #8B0000 0%, #B22222 100%);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
}

.ovp-modal-header h2 {
    margin: 0;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 700;
    line-height: 1.3;
}

.ovp-modal-header .ovp-event-badge {
    display: inline-block;
    background: #FFD700;
    color: #8B0000;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Content */
.ovp-modal-content {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.ovp-modal-content::-webkit-scrollbar {
    width: 6px;
}

.ovp-modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.ovp-modal-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* Offer Details */
.ovp-offer-highlight {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    border-left: 5px solid #FF9800;
}

.ovp-offer-highlight h3 {
    color: #D32F2F;
    margin: 0 0 10px 0;
    font-size: clamp(18px, 3vw, 22px);
}

.ovp-offer-highlight p {
    margin: 0;
    font-size: clamp(14px, 2.5vw, 16px);
    line-height: 1.5;
}

/* Coupon Section */
.ovp-coupon-section {
    background: #F5F5F5;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    text-align: center;
}

.ovp-coupon-code {
    font-size: clamp(24px, 5vw, 32px);
    font-weight: 800;
    letter-spacing: 2px;
    color: #8B0000;
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    border: 2px dashed #8B0000;
    margin: 15px 0;
    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: all;
}

.ovp-coupon-code:hover {
    background: #FFF8E1;
    transform: scale(1.02);
}

.ovp-coupon-code.copied {
    background: #E8F5E9;
    border-color: #4CAF50;
    color: #2E7D32;
}

.ovp-coupon-hint {
    font-size: 14px;
    color: #666;
    margin-top: 10px;
}

/* Products Grid */
.ovp-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 25px 0;
}

@media (max-width: 480px) {
    .ovp-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
}

.ovp-product-card {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid #eee;
}

.ovp-product-card:hover {
    transform: translateY(-5px);
}

.ovp-product-image {
    height: 120px;
    overflow: hidden;
}

.ovp-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ovp-product-info {
    padding: 12px;
    text-align: center;
}

.ovp-product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 5px;
    line-height: 1.3;
    height: 36px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ovp-product-price {
    color: #8B0000;
    font-weight: 700;
    font-size: 16px;
}

.ovp-product-price del {
    color: #999;
    font-size: 13px;
    margin-right: 5px;
}

/* 4+2 Offer Badge */
.ovp-4plus2-badge {
    background: linear-gradient(135deg, #4CAF50 0%, #2E7D32 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 25px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin: 10px 0;
    font-size: clamp(14px, 2.5vw, 16px);
}

.ovp-4plus2-badge i {
    font-size: 18px;
}

/* Action Buttons */
.ovp-modal-actions {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: #F9F9F9;
    border-top: 1px solid #eee;
}

.ovp-modal-actions button {
    flex: 1;
    padding: 16px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: clamp(15px, 3vw, 17px);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 54px;
}

.ovp-btn-order {
    background: linear-gradient(135deg, #8B0000 0%, #D32F2F 100%);
    color: white;
}

.ovp-btn-order:hover {
    background: linear-gradient(135deg, #6B0000 0%, #B22222 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 0, 0, 0.3);
}

.ovp-btn-close {
    background: #F5F5F5;
    color: #666;
    border: 2px solid #ddd;
}

.ovp-btn-close:hover {
    background: #EAEAEA;
    border-color: #ccc;
}

/* Timer */
.ovp-timer {
    background: #FFF3E0;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    margin: 20px 0;
    border: 1px solid #FFCC80;
}

.ovp-timer h4 {
    margin: 0 0 10px 0;
    color: #E65100;
    font-size: clamp(16px, 3vw, 18px);
}

.ovp-timer-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    font-size: clamp(20px, 4vw, 28px);
    font-weight: 700;
    color: #D32F2F;
}

.ovp-timer-unit {
    background: white;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 50px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.ovp-timer-label {
    font-size: 11px;
    color: #666;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Animations */
@keyframes ovpFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ovpSlideUp {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes ovpPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.ovp-pulse {
    animation: ovpPulse 2s infinite;
}

/* Landscape Optimization */
@media (orientation: landscape) and (max-height: 600px) {
    .ovp-modal-container {
        max-height: 85vh;
        max-width: 90%;
    }
    
    .ovp-modal-content {
        padding: 15px;
    }
    
    .ovp-modal-actions {
        padding: 15px;
    }
    
    .ovp-modal-actions button {
        padding: 12px 20px;
        min-height: 48px;
    }
}

/* iPhone Notch Safe Area */
@supports (padding: max(0px)) {
    .ovp-modal-container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Loading State */
.ovp-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.ovp-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8B0000;
    border-radius: 50%;
    animation: ovpSpin 1s linear infinite;
}

@keyframes ovpSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
/* ============================================
   TIMER STYLES
   ============================================ */

.ovp-timer-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    padding: 20px;
    color: white;
    margin-bottom: 25px;
}

.ovp-timer-countdown {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.ovp-timer-unit {
    text-align: center;
    min-width: 60px;
}

.ovp-timer-value {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
}

.ovp-timer-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 5px;
}

.ovp-timer-separator {
    font-size: 1.8rem;
    font-weight: bold;
    margin-top: -10px;
    opacity: 0.7;
}

.ovp-timer-expired {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 10px;
}

/* ============================================
   MODAL CLOSE IMPROVEMENTS
   ============================================ */

.ovp-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.ovp-modal-close:hover {
    background: #e9ecef;
    transform: rotate(90deg);
}

/* ============================================
   QUANTITY VALIDATION STYLES
   ============================================ */

.ovp-quantity-error {
    color: #e53e3e;
    font-size: 0.85rem;
    margin-top: 5px;
    display: none;
}

.ovp-invalid {
    border-color: #e53e3e !important;
    background-color: #fff5f5 !important;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.ovp-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: ovp-spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes ovp-spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE TIMER
   ============================================ */

@media (max-width: 768px) {
    .ovp-timer-countdown {
        gap: 10px;
    }
    
    .ovp-timer-unit {
        min-width: 50px;
    }
    
    .ovp-timer-value {
        font-size: 1.8rem;
    }
    
    .ovp-timer-separator {
        font-size: 1.5rem;
        margin-top: -8px;
    }
}