/* Import Cairo Font */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap');

/* Base Variables */
:root {
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: 1px solid rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --glass-blur: blur(12px);
    
    /* Variables customizable via Elementor or Global Settings */
    --wcvot-gradient-start: #FF7E5F;
    --wcvot-gradient-end: #FEB47B;
    --wcvot-success-color: #42e695;
    --wcvot-error-color: #FF4B2B;

    --primary-gradient: linear-gradient(135deg, var(--wcvot-gradient-start), var(--wcvot-gradient-end));
    --success-gradient: linear-gradient(135deg, var(--wcvot-success-color), #3bb2b8);
    --error-gradient: linear-gradient(135deg, var(--wcvot-error-color), #FF416C);
    
    --text-color: #333;
    --text-color-light: #fff;
    --font-family: 'Cairo', sans-serif;
    
    /* Global Settings Fallbacks */
    --wcvot-main-title-color: #333;
    --wcvot-sub-title-color: #666;
    --wcvot-details-bg: rgba(255,255,255,0.15);
    --wcvot-details-text: #333;
}

/* RTL Support */
[dir="rtl"] .wcvot-tracker-container,
[dir="rtl"] .wcvot-search-container,
[dir="rtl"] .wcvot-order-details-glass {
    direction: rtl;
    text-align: right;
}

/* Common Glassmorphism */
.wcvot-tracker-container,
.wcvot-search-container,
.wcvot-order-details-glass {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    margin: 40px auto;
    font-family: var(--font-family);
    color: var(--text-color);
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.8s ease-out;
}

/* Search Container Specifics */
.wcvot-search-container {
    max-width: 600px;
    text-align: center;
}

.wcvot-search-container h2 {
    margin-top: 0;
    margin-bottom: 30px;
    color: var(--text-color);
    font-weight: 700;
}

/* Pill Search Bar Design */
.wcvot-form-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50px;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: nowrap; /* Ensure they stay on one line */
}

.wcvot-search-container input[type="text"] {
    background: transparent;
    border: none;
    box-shadow: none;
    margin: 0;
    padding: 10px 20px;
    flex-grow: 1;
    font-family: var(--font-family);
    font-size: 16px;
    width: auto; /* Allow flex to control width */
    color: #333;
    outline: none;
}

.wcvot-search-container input[type="text"]:focus {
    background: transparent;
    box-shadow: none;
    outline: none;
}

.wcvot-search-container button {
    margin: 0;
    padding: 10px 30px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: none; /* Clean look inside the pill */
    flex-shrink: 0; /* Prevent button shrinking */
}

.wcvot-search-container button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 126, 95, 0.3);
}

/* Tracker Result Page */
.wcvot-tracker-container {
    background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(255,255,255,0.7)); 
}

.wcvot-header {
    text-align: center;
    margin-bottom: 40px;
}

.wcvot-header h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    color: var(--wcvot-main-title-color); 
}

.wcvot-header p {
    font-size: 16px;
    color: var(--wcvot-sub-title-color);
    font-weight: 600;
}

.wcvot-progress-track {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    padding: 0 20px;
}

/* Cancelled Mode Layout */
.wcvot-progress-track.cancelled-mode {
    justify-content: center;
    gap: 0; 
}
.wcvot-progress-track.cancelled-mode .wcvot-step {
    flex: 0 0 auto;
}
.wcvot-progress-track.cancelled-mode .wcvot-progress-line {
    flex-grow: 0;
    width: 150px; 
    margin-left: 10px;
    margin-right: 10px;
}

.wcvot-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 100px;
    opacity: 0; 
    animation: slideUp 0.6s ease-out forwards;
}

.wcvot-step:nth-child(1) { animation-delay: 0.1s; }
.wcvot-step:nth-child(3) { animation-delay: 0.3s; } 

.wcvot-icon-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    border: 1px solid rgba(255,255,255,0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wcvot-step.active .wcvot-icon-circle {
    background: var(--success-gradient);
    color: white;
    box-shadow: 0 10px 20px rgba(66, 230, 149, 0.4);
    transform: scale(1.1);
}

/* Cancelled State */
.wcvot-step.active.cancelled .wcvot-icon-circle {
    background: var(--error-gradient);
    box-shadow: 0 10px 20px rgba(255, 75, 43, 0.4);
}

.wcvot-icon-circle svg {
    width: 32px;
    height: 32px;
    stroke-width: 2.5;
}

.wcvot-label {
    font-size: 14px;
    font-weight: 600;
    color: #888;
    text-align: center;
    transition: color 0.3s;
}

.wcvot-step.active .wcvot-label {
    color: #333;
    font-weight: 700;
}

.wcvot-step.active.cancelled .wcvot-label {
    color: var(--wcvot-error-color);
}

/* Progress Line with Loop Animation */
.wcvot-progress-line {
    flex-grow: 1;
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    margin-top: 32px; 
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.wcvot-progress-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--success-gradient);
    transition: width 1s ease-in-out;
}

/* RTL Animation Fix */
[dir="rtl"] .wcvot-progress-line::after {
    left: auto;
    right: 0;
}

.wcvot-progress-line.active::after {
    width: 100%;
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.2) 25%, 
        var(--wcvot-success-color) 50%, 
        #3bb2b8 75%
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite linear;
}

[dir="rtl"] .wcvot-progress-line.active::after {
    background: linear-gradient(-90deg, 
        rgba(255,255,255,0.2) 25%, 
        var(--wcvot-success-color) 50%, 
        #3bb2b8 75%
    );
    background-size: 200% 100%;
    animation: shimmer-rtl 2s infinite linear;
}

.wcvot-progress-line.cancelled-line::after {
    background: var(--error-gradient);
    width: 100%; 
    animation: none; 
}
.wcvot-progress-line.active.cancelled-line::after {
    background: linear-gradient(90deg, 
        var(--wcvot-error-color) 0%, 
        #FF416C 50%, 
        var(--wcvot-error-color) 100%
    );
    background-size: 200% 100%;
    animation: shimmer-cancelled 3s infinite linear;
}
[dir="rtl"] .wcvot-progress-line.active.cancelled-line::after {
    animation: shimmer-cancelled-rtl 3s infinite linear;
}


@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@keyframes shimmer-rtl {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

@keyframes shimmer-cancelled {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}
@keyframes shimmer-cancelled-rtl {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}


/* Error Message */
.wcvot-error {
    background-color: rgba(255, 230, 230, 0.9);
    color: #d8000c;
    border: 1px solid #d8000c;
    padding: 15px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 600px;
    text-align: center;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

/* Order Details Glass Container */
.wcvot-order-details-glass {
    margin-top: 30px;
    background: var(--wcvot-details-bg);
    color: var(--wcvot-details-text);
}
/* Adjust WC Table Styles inside Glass */
.wcvot-order-details-glass table.shop_table {
    border: none;
    border-collapse: separate;
    border-spacing: 0 10px;
    background: transparent;
}
.wcvot-order-details-glass table.shop_table th,
.wcvot-order-details-glass table.shop_table td {
    background: rgba(255,255,255,0.4);
    border: none;
    padding: 15px;
}
.wcvot-order-details-glass table.shop_table th {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.7;
}
.wcvot-order-details-glass address {
    border: 1px solid rgba(0,0,0,0.05);
    padding: 20px;
    border-radius: 10px;
    background: rgba(255,255,255,0.3);
}

/* Hide Duplicated Customer Details from Order Details Template */
.wcvot-order-details-glass .woocommerce-order-details > .woocommerce-customer-details,
.wcvot-order-details-glass .woocommerce-order-details > address,
.wcvot-order-details-glass .woocommerce-order-details > .col2-set {
    display: none !important;
}

/* Address Order Reversal: Shipping First, Billing Second */
/* Target the manual customer details block (sibling of the hidden one usually, or direct child of glass container) */
/* The manual call to order-details-customer.php creates .woocommerce-customer-details. We want to style IT. */

.wcvot-order-details-glass .woocommerce-customer-details .col2-set,
.wcvot-order-details-glass .woocommerce-customer-details .woocommerce-columns {
    display: flex !important;
    flex-wrap: wrap;
    width: 100%;
}

.wcvot-order-details-glass .woocommerce-customer-details .col-1, 
.wcvot-order-details-glass .woocommerce-customer-details .woocommerce-column--billing-address {
    order: 2; /* Billing Second */
}

.wcvot-order-details-glass .woocommerce-customer-details .col-2, 
.wcvot-order-details-glass .woocommerce-customer-details .woocommerce-column--shipping-address {
    order: 1; /* Shipping First */
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive / Mobile */
@media (max-width: 768px) {
    .wcvot-progress-track {
        flex-direction: column;
        align-items: center; 
        gap: 0;
        padding: 0;
    }

    .wcvot-progress-track.cancelled-mode {
        flex-direction: column;
        justify-content: flex-start;
    }
    
    .wcvot-step {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        margin-bottom: 0;
        padding: 10px 0;
    }
    
    .wcvot-icon-circle {
        margin-bottom: 0;
        margin-right: 20px;
        flex-shrink: 0;
    }
    
    [dir="rtl"] .wcvot-icon-circle {
        margin-right: 0;
        margin-left: 20px;
    }
    
    .wcvot-label {
        font-size: 16px;
        text-align: left;
    }
    
    [dir="rtl"] .wcvot-label {
        text-align: right;
    }
    
    .wcvot-progress-line {
        width: 4px;
        height: 40px; 
        margin: 0;
        align-self: flex-start;
        margin-left: 33px; 
        margin-top: -10px;
        margin-bottom: -10px;
        z-index: 1;
    }

    .wcvot-progress-track.cancelled-mode .wcvot-progress-line {
        width: 4px;
        height: 40px;
        margin-left: 33px; 
        margin-right: 0;
    }
    
    [dir="rtl"] .wcvot-progress-line {
        margin-left: 0;
        margin-right: 33px;
    }
    
    .wcvot-progress-line::after {
        width: 100%;
        height: 0%;
        top: 0;
        left: 0;
        animation: none; 
        transition: height 1s;
    }
    
    .wcvot-progress-line.active::after {
        height: 100%;
    }
    
    /* Search Bar Mobile */
    .wcvot-form-group {
        width: 100%;
        max-width: 100%;
    }
}
