/**
 * Leka Delivery Time - Frontend Styles
 */

/* CSS Custom Properties - defaults */
:root {
    --leka-primary: #10b981;
    --leka-primary-light: #d1fae5;
    --leka-bg-start: #f8fffe;
    --leka-bg-end: #f0fdf9;
    --leka-border: #d1fae5;
    --leka-text: #111827;
    --leka-text-light: #6b7280;
    --leka-warning: #fef3c7;
    --leka-radius: 12px;
    --leka-padding: 16px 20px;
    --leka-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --leka-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --leka-date-weight: 700;
}

/* Main Widget Container */
.leka-delivery-widget {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: var(--leka-padding);
    background: linear-gradient(135deg, var(--leka-bg-start) 0%, var(--leka-bg-end) 100%);
    border: 1px solid var(--leka-border);
    border-radius: var(--leka-radius);
    font-family: var(--leka-font);
    margin: 16px 0;
    box-shadow: var(--leka-shadow);
}

.leka-delivery-widget[data-style="compact"] {
    padding: 12px 16px;
    gap: 10px;
}

.leka-delivery-widget[data-style="minimal"] {
    background: transparent;
    border: none;
    padding: 8px 0;
    box-shadow: none;
}

/* Icon */
.leka-delivery-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--leka-primary);
    border-radius: calc(var(--leka-radius) - 2px);
    color: white;
}

.leka-delivery-icon svg {
    width: 22px;
    height: 22px;
}

.leka-delivery-widget[data-style="compact"] .leka-delivery-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.leka-delivery-widget[data-style="compact"] .leka-delivery-icon svg {
    width: 18px;
    height: 18px;
}

.leka-delivery-widget[data-style="minimal"] .leka-delivery-icon {
    display: none;
}

/* Content */
.leka-delivery-content {
    flex: 1;
    min-width: 0;
}

/* Urgency Banner */
.leka-delivery-urgency {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--leka-primary);
    background: var(--leka-primary-light);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.leka-pulse {
    width: 8px;
    height: 8px;
    background: var(--leka-primary);
    border-radius: 50%;
    animation: leka-pulse 2s infinite;
}

@keyframes leka-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.leka-delivery-widget[data-style="compact"] .leka-delivery-urgency {
    font-size: 11px;
    padding: 3px 8px;
    margin-bottom: 6px;
}

/* Delivery Dates */
.leka-delivery-dates {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 6px;
}

.leka-delivery-label {
    font-size: 13px;
    color: var(--leka-text-light);
    font-weight: 500;
}

.leka-delivery-range {
    font-size: 15px;
    font-weight: var(--leka-date-weight);
    color: var(--leka-text);
}

.leka-date-separator {
    color: #9ca3af;
    font-weight: 400;
}

.leka-delivery-widget[data-style="compact"] .leka-delivery-dates {
    margin-bottom: 4px;
}

.leka-delivery-widget[data-style="compact"] .leka-delivery-range {
    font-size: 14px;
}

/* Country Info */
.leka-delivery-country {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--leka-text-light);
}

.leka-country-flag {
    font-size: 16px;
}

.leka-country-name {
    font-weight: 500;
    color: var(--leka-text);
}

.leka-delivery-days {
    color: var(--leka-text-light);
    font-size: 12px;
    opacity: 0.8;
}

.leka-delivery-widget[data-style="compact"] .leka-delivery-country {
    font-size: 12px;
}

/* Saturday Badge */
.leka-saturday-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 4px;
}

/* Seasonal Notice */
.leka-seasonal-notice {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--leka-warning);
    border-radius: 6px;
    font-size: 11px;
    color: #92400e;
    font-weight: 500;
}

.leka-seasonal-icon {
    font-size: 12px;
}

.leka-delivery-widget[data-style="compact"] .leka-seasonal-notice {
    margin-top: 6px;
    padding: 4px 8px;
    font-size: 10px;
}

/* Country Selector */
.leka-country-selector {
    margin-top: 10px;
    position: relative;
}

.leka-selector-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
}

.leka-selector-toggle:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.leka-selector-toggle[aria-expanded="true"] {
    background: #f3f4f6;
    border-color: var(--leka-primary);
}

.leka-selector-toggle svg {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.leka-selector-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

/* Dropdown */
.leka-country-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 300px;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    margin-top: 6px;
    padding: 6px;
}

.leka-country-dropdown[hidden] {
    display: none;
}

/* Country Option */
.leka-country-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s ease;
}

.leka-country-option:hover {
    background: #f3f4f6;
}

.leka-country-option.active {
    background: #ecfdf5;
}

.leka-country-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.leka-option-flag {
    font-size: 20px;
    flex-shrink: 0;
}

.leka-option-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

.leka-option-days {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 10px;
}

.leka-country-option.active .leka-option-days {
    background: var(--leka-primary-light);
    color: var(--leka-primary);
}

.leka-option-saturday {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 700;
    margin-left: 4px;
}

/* Thank You Page */
.leka-thankyou-delivery {
    margin: 24px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.leka-thankyou-delivery h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.leka-thankyou-delivery .leka-delivery-widget {
    margin: 0;
}

/* Loading State */
.leka-delivery-widget.loading {
    opacity: 0.6;
    pointer-events: none;
}

.leka-delivery-widget.loading .leka-delivery-range::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #e5e7eb;
    border-top-color: var(--leka-primary);
    border-radius: 50%;
    animation: leka-spin 0.8s linear infinite;
}

@keyframes leka-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .leka-delivery-widget {
        background: linear-gradient(135deg, #1a2e2a 0%, #1f3a34 100%);
        border-color: #2f5249;
    }
    
    .leka-delivery-range {
        color: #f9fafb;
    }
    
    .leka-country-name {
        color: #e5e7eb;
    }
    
    .leka-delivery-label,
    .leka-delivery-country {
        color: #9ca3af;
    }
    
    .leka-country-dropdown {
        background: #1f2937;
        border-color: #374151;
    }
    
    .leka-country-option:hover {
        background: #374151;
    }
    
    .leka-country-option.active {
        background: #1f3a34;
    }
    
    .leka-option-name {
        color: #f9fafb;
    }
    
    .leka-option-days {
        background: #374151;
        color: #9ca3af;
    }
    
    .leka-seasonal-notice {
        background: #422006;
        color: #fde68a;
    }
}

/* Responsive */
@media (max-width: 480px) {
    .leka-delivery-widget {
        flex-direction: column;
        gap: 10px;
    }
    
    .leka-delivery-icon {
        width: 36px;
        height: 36px;
    }
    
    .leka-delivery-dates {
        flex-direction: column;
        gap: 2px;
    }
    
    .leka-country-dropdown {
        min-width: 100%;
        position: fixed;
        left: 16px;
        right: 16px;
        bottom: 0;
        top: auto;
        border-radius: 16px 16px 0 0;
        max-height: 50vh;
        padding: 12px;
    }
}

/* Print */
@media print {
    .leka-country-selector {
        display: none;
    }
    
    .leka-delivery-widget {
        border: 1px solid #000;
        box-shadow: none;
    }
}
