/* Modal Styles */
.wot-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99999;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.wot-modal-overlay.wot-open {
    display: flex;
    opacity: 1;
}

.wot-modal-content {
    background: #fff;
    width: 90%;
    max-width: 700px;
    /* Fixed height constraints for scrolling */
    max-height: 90vh; 
    overflow-y: auto;
    /* Hide scrollbar */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    
    border-radius: 16px;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    font-family: inherit;
    direction: rtl; /* Ensure RTL */
}

/* Hide scrollbar for Chrome, Safari and Opera */
.wot-modal-content::-webkit-scrollbar {
    display: none;
}

.wot-modal-overlay.wot-open .wot-modal-content {
    transform: translateY(0);
}

.wot-close-modal {
    position: sticky; /* Changed to sticky */
    top: 0; /* Stick to top of scrolling container */
    left: 0; /* In RTL, left is actually correct for absolute/fixed but for sticky inside RTL... let's see */
    /* Actually in RTL container, left is far side. We want it top-left visually. */
    /* Sticky operates within the flow. We might need to float it or absolute it relative to a non-scrolling wrapper if we want it truly fixed. */
    /* Given the structure, 'position: fixed' relative to viewport is risky on mobile if modal is centered. */
    /* Let's try absolute but make the close button OUTSIDE the scroll area? No, PHP structure puts it inside. */
    
    /* RE-EVALUATION: 
       The best way without changing PHP structure significantly is to make the button 'sticky'.
       But 'top: 0' refers to the scroll container. 
       However, we need to adjust negative margins to counteract padding if we want it in the corner.
    */
    position: sticky;
    top: -15px; /* Counteract parent padding top (30px? No, we want it visible) */
    /* Actually, let's make it float or absolute but stick to the viewport of the modal */
    
    /* Better Approach for Sticky Close Button: */
    float: left; 
    margin-top: -15px; /* Pull it up into padding area */
    margin-left: -15px;
    z-index: 100;
}

/* Wait, sticky works best if it's a direct child. */
/* Let's use Fixed positioning relative to the modal wrapper? No, modal wrapper is 100% screen. */

/* Let's go with a hack: 
   Make the close button position: fixed (relative to viewport) is bad.
   
   Let's use sticky properly:
*/
.wot-close-modal {
    position: sticky;
    top: 0;
    float: left; /* Keep it to the left */
    margin-left: -15px; /* Adjust for padding */
    margin-top: -15px; /* Adjust for padding */
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: all 0.2s;
    z-index: 1000; /* High z-index */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); /* Shadow for visibility over content */
}

.wot-close-modal:hover {
    background: #e5e7eb;
    color: #000;
}

/* Stepper Styles */
.wot-stepper-container {
    margin-top: 20px;
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 10px;
    padding-top: 20px; /* Added padding */
    position: relative;
    /* Hide scrollbar on stepper too */
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.wot-stepper-container::-webkit-scrollbar {
    display: none;
}

.wot-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    min-width: 100%;
    padding-top: 0; /* Reset any padding */
}

/* Shared style for lines to ensure exact alignment */
.wot-stepper::before,
.wot-progress-line {
    content: '';
    position: absolute;
    height: 4px;
    border-radius: 2px;
    transform: translateY(-50%); /* Vertically center the 4px line */
}

/* The Grey Line Behind */
.wot-stepper::before {
    top: 17px; /* Relative to stepper (which is pushed down by container padding) */
    left: 0;
    right: 0;
    background: #e5e7eb;
    z-index: 1;
}

/* The Blue Progress Line */
.wot-progress-line {
    top: 37px; /* 20px padding + 17px center */
    right: 0; /* RTL origin */
    background: #3b82f6; /* Blue */
    z-index: 2;
    transition: width 0.4s ease;
}

.wot-step {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 1 auto; 
    text-align: center;
    min-width: 80px;
}

.wot-step-circle {
    width: 34px;
    height: 34px;
    background: #e5e7eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border: 4px solid #fff; 
    box-sizing: border-box; /* Ensure border is inside size calculation */
    color: transparent;
    transition: all 0.3s ease;
}

.wot-step.active .wot-step-circle,
.wot-step.completed .wot-step-circle {
    background: #3b82f6;
    color: #fff;
}

/* Checkmark */
.wot-step.completed .wot-step-circle::after,
.wot-step.active .wot-step-circle::after {
    content: ''; 
    display: block;
    width: 18px;
    height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 12.6111L8.92308 17.5L20 6.5' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.wot-step.active .wot-step-circle {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.wot-step-label {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0 5px;
}

.wot-step.active .wot-step-label,
.wot-step.completed .wot-step-label {
    color: #1f2937;
    font-weight: 700;
}

/* Current Status Box */
.wot-status-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: right; /* RTL */
}

.wot-status-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111;
}

.wot-status-desc {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
}

.wot-admin-note {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #d1d5db;
}

.wot-note-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 5px;
    display: block;
    font-weight: 600;
}

.wot-note-content {
    font-size: 14px;
    color: #374151;
    background: #fffbeb;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #fcd34d;
}

/* Button Styles */
.woocommerce-MyAccount-orders .button.wot-track-btn {
    background-color: #3b82f6;
    color: white;
    border: none;
    margin-right: 5px; /* Spacing from View button */
}

.woocommerce-MyAccount-orders .button.wot-track-btn:hover {
    background-color: #2563eb;
}

/* Mobile Optimization */
@media (max-width: 600px) {
    .wot-modal-content {
        width: 95%;
        padding: 20px;
        margin: 10px auto; /* Centered */
        max-height: 85vh; /* Slightly less on mobile to show overlay */
    }
    
    .wot-step-label {
        font-size: 10px;
    }
}
