/**
 * WTC Frontend Styles
 * Styling for customer-facing vehicle selection components
 * 
 * Components:
 * - .wtc-vehicle-selector (hero)
 * - .wtc-my-vehicle (header)
 * - .wtc-vehicle-bar (shop)
 * 
 * Note: These are base styles - Bricks will handle specific positioning
 * 
 * @package WindmillTruckCaps
 * @since 1.0.0
 */

/* ==========================================================================
   CSS Custom Properties (Override in Bricks)
   ========================================================================== */

:root {
    --wtc-primary: #b91c1c;        /* Red - matches brand */
    --wtc-primary-hover: #991b1b;
    --wtc-text: #1f2937;
    --wtc-text-light: #6b7280;
    --wtc-bg: #ffffff;
    --wtc-bg-light: #f3f4f6;
    --wtc-border: #d1d5db;
    --wtc-radius: 4px;
    --wtc-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    
    /* Windmill truck icon as data URI */
    --wtc-truck-icon: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 471.08 362.34%27%3E%3Cpath fill=%27currentColor%27 d=%27M347.72,2.12l-3.82-2.12H127.08l-3.82,2.12-53.18,85.12,3.82,6.88h323.2l3.82-6.88L347.72,2.12ZM82.01,85.12l37.44-59.93h232.08l37.44,59.93H82.01Z%27/%3E%3Cpath fill=%27currentColor%27 d=%27M147.05,142.08l-41.17,31.58v52.95h259.23v-52.95l-41.17-31.58h-176.9,0ZM317.85,204.98h-164.75v-9h164.75v9ZM333.28,175.95h-195.62v-9h195.62v9Z%27/%3E%3Cpath fill=%27currentColor%27 d=%27M403.33,101.96H67.66l-32.81,33.64v91.01h62.03v-55.17l1.76-3.57,44.14-33.87,2.74-.93h179.95l2.74.93,44.14,33.87,1.76,3.57v55.17h62.03v-91.01s-32.81-33.64-32.81-33.64ZM70.53,164.29v41.27l-14.78-17.98v-50h42.27l-27.48,26.71h-.01ZM414.67,187.58l-14.78,17.98v-41.27l-27.48-26.71h42.27v50h0Z%27/%3E%3Crect fill=%27currentColor%27 x=%27417.37%27 y=%27236.92%27 width=%2737.92%27 height=%2744.92%27/%3E%3Crect fill=%27currentColor%27 x=%2715.79%27 y=%27236.92%27 width=%2737.92%27 height=%2744.92%27/%3E%3Crect fill=%27currentColor%27 x=%2762.88%27 y=%27236.92%27 width=%27345.32%27 height=%2744.92%27/%3E%3Cpolygon fill=%27currentColor%27 points=%27356.84 313.74 114.25 313.74 105.47 292.15 365.62 292.15 356.84 313.74%27/%3E%3Cpath fill=%27currentColor%27 d=%27M34.76,285.54h62.73v57.25c0,10.79-8.76,19.55-19.55,19.55h-23.62c-10.79,0-19.55-8.76-19.55-19.55v-57.25h-.01Z%27/%3E%3Cpath fill=%27currentColor%27 d=%27M373.42,285.54h62.73v57.25c0,10.79-8.76,19.55-19.55,19.55h-23.62c-10.79,0-19.55-8.76-19.55-19.55v-57.25h-.01Z%27/%3E%3Cpolygon fill=%27currentColor%27 points=%27470.11 135.49 447.27 135.49 413.62 102.17 430.25 102.17 440.34 85.94 471.08 85.94 470.11 135.49%27/%3E%3Cpolygon fill=%27currentColor%27 points=%27.97 135.49 23.81 135.49 57.47 102.17 40.83 102.17 30.74 85.94 0 85.94 .97 135.49%27/%3E%3C/svg%3E");
}

/* ==========================================================================
   Hero Vehicle Selector
   Used on homepage hero section
   ========================================================================== */

.wtc-vehicle-selector {
    background: var(--wtc-bg);
    padding: 30px;
    border-radius: var(--wtc-radius);
    box-shadow: var(--wtc-shadow);
}

.wtc-selector-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wtc-text);
    text-align: center;
    margin-bottom: 20px;
}

.wtc-selector-fields {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.wtc-field {
    flex: 1;
}

.wtc-select {
    width: 100%;
    height: 50px;
    padding: 0 15px;
    font-size: 16px;
    color: var(--wtc-text);
    background: var(--wtc-bg);
    border: 1px solid var(--wtc-border);
    border-radius: var(--wtc-radius);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.wtc-select:focus {
    outline: none;
    border-color: var(--wtc-text);
    box-shadow: 0 0 0 2px rgba(31, 41, 55, 0.1);
}

.wtc-select:disabled {
    background-color: var(--wtc-bg-light);
    color: var(--wtc-text-light);
    cursor: not-allowed;
}

/* Validation error state */
.wtc-select.wtc-field-error {
    border-color: var(--wtc-primary) !important;
    box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.2);
}

.wtc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
	font-family:'Oswald',sans-serif;
	font-weight:600;
	text-transform:uppercase;
    gap: 8px;
    width: 100%;
    height: 50px;
    padding: 0 30px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: var(--wtc-primary);
    border: none;
    border-radius: var(--wtc-radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wtc-btn:hover:not(:disabled) {
    background: var(--wtc-primary-hover);
}

.wtc-btn:disabled {
    background: var(--wtc-border);
    cursor: not-allowed;
}

.wtc-btn.wtc-loading {
    position: relative;
    color: transparent;
}

.wtc-btn.wtc-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: wtc-spin 0.8s linear infinite;
}

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

/* Button shake animation for validation feedback */
.wtc-btn-shake {
    animation: wtc-shake 0.4s ease;
}

@keyframes wtc-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.wtc-btn-arrow {
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
	margin-top:-5px;
}

/* ==========================================================================
   My Vehicle Header Display
   Used in top header bar
   ========================================================================== */

.wtc-my-vehicle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
	font-family:'Oswald',sans-serif;
	font-weight:600;
	text-transform:uppercase;
    color: #ffffff;
    white-space: nowrap;
}

.wtc-my-vehicle-icon {
    display: flex;
    align-items: center;
    color: var(--wtc-primary);
}

.wtc-my-vehicle-icon svg {
    width: 19px;
    height: 19px;
}

.wtc-my-vehicle-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wtc-my-vehicle-value {
    color: var(--wtc-primary);
}

/* Wrapper for set/empty states (allows JS toggling) */
.wtc-my-vehicle-set {
    display: inline;
}

.wtc-my-vehicle-set .wtc-my-vehicle-label,
.wtc-my-vehicle-set .wtc-my-vehicle-value {
    display: inline;
}

.wtc-my-vehicle-empty {
    display: inline;
}

.wtc-my-vehicle-prompt {
    font-weight: 500;
    opacity: 0.9;
}

.wtc-my-vehicle-prompt:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ==========================================================================
   Vehicle Bar (Shop Page)
   Shows selector or current vehicle with Change/Clear
   ========================================================================== */

.wtc-vehicle-bar {
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    margin-bottom: 30px;
    border-radius: var(--wtc-radius);
    box-shadow: 0 3px 12px -3px rgba(0,0,0,0.2);
	min-height:105px;
	display:flex;
	justify-content:space-between;
	align-items:center;
}

/* Vehicle is SET - summary view */
.wtc-vehicle-bar-set {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
	width:100%;
}

.wtc-vehicle-bar-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wtc-vehicle-bar-icon {
    display: flex;
    align-items: center;
    color: var(--wtc-primary);
}

.wtc-vehicle-bar-icon svg {
    width: 28px;
    height: 28px;
}

.wtc-vehicle-bar-label {
    font-size: 14px;
    color: var(--wtc-text-light);
}

.wtc-vehicle-bar-vehicle {
    font-size: 16px;
    font-weight: 700;
    color: var(--wtc-text);
}

.wtc-vehicle-bar-actions {
    display: flex;
    gap: 10px;
}

.wtc-vehicle-bar-change,
.wtc-vehicle-bar-clear {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    padding: 0 30px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    border: none;
    border-radius: var(--wtc-radius);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.wtc-vehicle-bar-change {
    color: var(--wtc-primary);
    background: rgba(185, 28, 28, 0.1);
    border: 1px solid var(--wtc-primary);
	font-family:'Oswald',sans-serif;
	font-weight:600;
	text-transform:uppercase;
}

.wtc-vehicle-bar-change:hover {
    background: var(--wtc-primary);
    color: #ffffff;
}

.wtc-vehicle-bar-clear {
	padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--wtc-text-light);
    background: transparent;
    border: 1px solid var(--wtc-border);
    border-radius: var(--wtc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wtc-vehicle-bar-clear:hover {
    background: var(--wtc-bg-light);
    color: var(--wtc-text);
}

/* Vehicle bar FORM view (when changing) */
.wtc-vehicle-bar-form {
    /*padding-top: 20px;*/
    /*border-top: 1px solid var(--wtc-border);*/
    /*margin-top: 20px;*/
	display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 15px;
    width: 100%;
}

@media only screen and (max-width:767px) {
	.wtc-vehicle-bar-form {
		flex-direction: column;
	}	
}

.wtc-vehicle-bar-form-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--wtc-text);
    margin-bottom: 0;
	white-space:nowrap;
}

.wtc-vehicle-bar-form .wtc-selector-fields {
    margin-bottom: 0;
	width:100%;
}

.wtc-vehicle-bar-form .wtc-select {
    height: 45px;
}

.wtc-vehicle-bar-form-actions {
    display: flex;
    gap: 10px;
}

.wtc-vehicle-bar-form .wtc-btn {
    width: auto;
    height: 42px;
}

.wtc-vehicle-bar-cancel {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--wtc-text-light);
    background: transparent;
    border: 1px solid var(--wtc-border);
    border-radius: var(--wtc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wtc-vehicle-bar-cancel:hover {
    background: var(--wtc-bg-light);
    color: var(--wtc-text);
}

/* Vehicle bar EMPTY view (no vehicle set) */
.wtc-vehicle-bar-empty {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
	width:100%;
}

.wtc-vehicle-bar-prompt {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.wtc-vehicle-bar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--wtc-text);
}

.wtc-vehicle-bar-empty .wtc-selector-fields {
    flex: 1;
    margin-bottom: 0;
    min-width: 300px;
}

.wtc-vehicle-bar-empty .wtc-btn {
    width: auto;
    flex-shrink: 0;
}

/* ==========================================================================
   Vehicle Modal
   Popup modal triggered from header "My Vehicle" click
   ========================================================================== */

.wtc-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    /* Animation: use opacity/visibility instead of display for better backdrop-filter support */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.wtc-modal.wtc-modal-visible {
    opacity: 1;
    visibility: visible;
}

.wtc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
/*    backdrop-filter: blur(4px); */
/*    will-change: backdrop-filter; */ /* Hint browser to pre-composite blur layer */

/*	Backdrop blur removed for performance */

}

.wtc-modal-container {
    position: relative;
    background: var(--wtc-bg);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 480px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.wtc-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--wtc-bg-light);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--wtc-text-light);
    transition: all 0.2s ease;
}

.wtc-modal-close:hover {
    background: var(--wtc-border);
    color: var(--wtc-text);
}

.wtc-modal-header {
    text-align: center;
    padding: 40px 30px 20px;
}

.wtc-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(185, 28, 28, 0.1);
    border-radius: 50%;
    color: var(--wtc-primary);
    margin-bottom: 16px;
}

.wtc-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--wtc-text);
    margin: 0 0 8px;
}

.wtc-modal-subtitle {
    font-size: 15px;
    color: var(--wtc-text-light);
    margin: 0;
}

.wtc-modal-body {
    padding: 0 30px 30px;
}

.wtc-modal-body.wtc-vehicle-selector {
    background: transparent;
    box-shadow: none;
    padding: 0 30px 30px;
}

.wtc-modal-fields {
    flex-direction: column;
    gap: 16px;
}

.wtc-modal-fields .wtc-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--wtc-text);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wtc-modal-submit {
    margin-top: 24px;
}

.wtc-modal-footer {
    padding: 16px 30px;
    background: var(--wtc-bg-light);
    border-top: 1px solid var(--wtc-border);
    border-radius: 0 0 12px 12px;
}

.wtc-modal-current {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 14px;
    color: var(--wtc-text-light);
    margin: 0;
}

.wtc-modal-current strong {
    color: var(--wtc-text);
}

.wtc-modal-clear-btn {
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--wtc-primary);
    background: transparent;
    border: 1px solid var(--wtc-primary);
    border-radius: var(--wtc-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.wtc-modal-clear-btn:hover {
    background: var(--wtc-primary);
    color: #ffffff;
}

/* Body class when modal is open */
body.wtc-modal-open {
    overflow: hidden;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    /* Hero selector */
    .wtc-selector-fields {
        flex-direction: column;
        gap: 10px;
    }
    
    .wtc-vehicle-selector {
        padding: 20px;
    }
    
    .wtc-selector-title {
        font-size: 20px;
    }
    
    .wtc-select {
        height: 45px;
    }
    
    .wtc-btn {
        height: 45px;
    }
    
    /* Header 
    .wtc-my-vehicle-label {
        display: none;
    }
    */
	
	.wtc-my-vehicle-icon svg {
		width: 15px;
		height: 15px;
	}
	
    /* Vehicle bar */
    .wtc-vehicle-bar {
        padding: 15px 20px;
    }
    
    .wtc-vehicle-bar-set {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .wtc-vehicle-bar-info {
        flex-wrap: wrap;
    }
    
    .wtc-vehicle-bar-empty {
        flex-direction: column;
        align-items: stretch;
    }
    
    .wtc-vehicle-bar-prompt {
        justify-content: center;
    }
    
    .wtc-vehicle-bar-empty .wtc-selector-fields {
        min-width: 100%;
    }
    
    .wtc-vehicle-bar-empty .wtc-btn {
        width: 100%;
    }
    
    /* Modal */
    .wtc-modal {
        padding: 10px;
    }
    
    .wtc-modal-container {
        max-height: 95vh;
    }
    
    .wtc-modal-header {
        padding: 30px 20px 15px;
    }
    
    .wtc-modal-icon {
        width: 56px;
        height: 56px;
    }
    
    .wtc-modal-title {
        font-size: 20px;
    }
    
    .wtc-modal-body {
        padding: 0 20px 20px;
    }
    
    .wtc-modal-body.wtc-vehicle-selector {
        padding: 0 20px 20px;
    }
    
    .wtc-modal-footer {
        padding: 12px 20px;
    }
    
    .wtc-modal-current {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ==========================================================================
   Utility Classes for Bricks
   ========================================================================== */

/* Hide element when vehicle IS set */
.wtc-hide-when-vehicle-set {
    display: none;
}
body:not(.wtc-has-vehicle) .wtc-hide-when-vehicle-set {
    display: block;
}

/* Hide element when vehicle is NOT set */
.wtc-hide-when-no-vehicle {
    display: block;
}
body:not(.wtc-has-vehicle) .wtc-hide-when-no-vehicle {
    display: none;
}

/* No results CTA styling */
.wtc-no-results-cta {
    text-align: center;
    padding: 60px 30px;
    background: var(--wtc-bg-light);
    border-radius: var(--wtc-radius);
}

.wtc-no-results-cta h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--wtc-text);
    margin-bottom: 10px;
}

.wtc-no-results-cta p {
    font-size: 16px;
    color: var(--wtc-text-light);
    margin-bottom: 20px;
}

.wtc-no-results-cta .wtc-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: var(--wtc-primary);
    border-radius: var(--wtc-radius);
    text-decoration: none;
    transition: background 0.2s ease;
}

.wtc-no-results-cta .wtc-cta-btn:hover {
    background: var(--wtc-primary-hover);
}