/**
 * Food Van Pickup - Frontend Styles
 * Works with WooCommerce checkout and various themes
 */

/* Wrapper for the whole picker section */
.fvp-picker-wrapper {
    margin: 0 0 30px 0;
    padding: 20px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Dark theme support */
body.dark .fvp-picker-wrapper,
.fvp-picker-wrapper[data-theme="dark"] {
    background: #2a2a2a;
    border-color: #444;
}

.fvp-picker-wrapper h3 {
    margin: 0 0 20px 0;
    padding: 0 0 10px 0;
    border-bottom: 1px solid #ddd;
    font-size: 1.2em;
}

/* The picker container */
.fvp-picker {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Each field row - use WooCommerce form-row styling */
.fvp-picker .form-row {
    margin: 0;
    padding: 0;
}

.fvp-picker .form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Make sure selects are visible and full width */
.fvp-picker select,
.fvp-picker .fvp-select {
    width: 100% !important;
    min-height: 45px;
    padding: 10px 15px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    color: #333;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
    cursor: pointer;
}

.fvp-picker select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

.fvp-picker select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* Location info display */
.fvp-location-info {
    padding: 10px 15px;
    background: #e8f4e8;
    border-left: 3px solid #46b450;
    border-radius: 0 4px 4px 0;
    margin-top: 5px;
    font-size: 14px;
}

.fvp-location-info .fvp-address {
    display: block;
    color: #333;
}

.fvp-location-info .fvp-description {
    display: block;
    margin-top: 5px;
    font-style: italic;
    color: #666;
}

.fvp-location-info .fvp-description:empty {
    display: none;
}

/* Loading indicator */
.fvp-loading {
    display: inline-block;
    margin-top: 5px;
    font-size: 13px;
    color: #666;
    font-style: italic;
}

/* Summary box */
.fvp-summary {
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    color: #155724;
    margin-top: 10px;
}

.fvp-summary strong {
    display: block;
    margin-bottom: 5px;
}

/* No availability message */
.fvp-no-availability {
    text-align: center;
    padding: 20px;
}

.fvp-notice {
    padding: 15px;
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    color: #856404;
    margin: 0;
}

/* Error state */
.fvp-field.has-error select {
    border-color: #dc3545 !important;
}

.fvp-error-message {
    display: block;
    margin-top: 5px;
    color: #dc3545;
    font-size: 13px;
}

/* Pickup details on order pages */
.fvp-order-pickup-details {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

.fvp-order-pickup-details h2 {
    margin: 0 0 15px 0;
    font-size: 1.2em;
}

.fvp-pickup-table {
    width: 100%;
}

.fvp-pickup-table th {
    text-align: left;
    padding: 5px 15px 5px 0;
    font-weight: 600;
    white-space: nowrap;
    width: 100px;
}

.fvp-pickup-table td {
    padding: 5px 0;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .fvp-picker-wrapper {
        padding: 15px;
        margin: 0 0 20px 0;
    }
    
    .fvp-picker select {
        min-height: 50px;
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* High contrast / accessibility */
@media (prefers-contrast: high) {
    .fvp-picker select {
        border-width: 2px;
    }
}


/* --- Compatibility fixes for themes that hide native <select> or use Select2 globally --- */
.fvp-picker-wrapper select,
.fvp-picker-wrapper .fvp-select {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    max-height: none !important;
    position: relative !important;
    z-index: 2;
}

/* If Select2 is applied by the theme, keep the container in-flow inside the picker */
.fvp-picker-wrapper .select2-container {
    width: 100% !important;
    position: relative !important;
    float: none !important;
    display: block !important;
    z-index: 3;
}

/* Stop select2 from collapsing */
.fvp-picker-wrapper .select2-container .select2-selection--single {
    min-height: 45px;
}

/* ---- Slot Hold Timer ---- */
.fvp-hold-timer {
    padding: 12px 16px;
    border-radius: 6px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    font-size: 14px;
    font-weight: 600;
    margin: 10px 0 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.fvp-hold-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.fvp-hold-countdown {
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    font-weight: 700;
    min-width: 45px;
}

.fvp-hold-timer--warning {
    background: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
    animation: fvp-pulse 1s ease-in-out infinite;
}

.fvp-hold-timer--expired {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
    animation: none;
}

@keyframes fvp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
