/**
 * Vehicle Lookup Styles for Blue Motors Southampton
 * Enhanced DVLA and DVSA API integration styles
 * 
 * @package BlueMotosSouthampton
 * @since 1.0.0
 */

/* =============================================================================
   Shortcode Container Styles
   ========================================================================== */

.bms-vehicle-lookup-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bms-vehicle-lookup-container.compact {
    max-width: 600px;
}

.bms-vehicle-lookup-container.large {
    max-width: 900px;
}

.bms-lookup-header {
    text-align: center;
    margin-bottom: 30px;
}

.bms-lookup-title {
    font-size: 24px;
    color: #333;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.bms-lookup-description {
    color: #666;
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}

.bms-registration-section {
    margin-bottom: 20px;
}

.bms-registration-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.bms-error-container {
    margin-top: 10px;
}

.bms-hidden-fields {
    display: none !important;
}

.bms-shortcode-content {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Theme Variations */
.bms-vehicle-lookup-container.compact .bms-lookup-title {
    font-size: 20px;
}

.bms-vehicle-lookup-container.compact .bms-vehicle-display {
    padding: 15px;
}

.bms-vehicle-lookup-container.compact .bms-registration-input {
    padding: 10px 14px;
    font-size: 14px;
}

.bms-vehicle-lookup-container.minimal .bms-lookup-header {
    margin-bottom: 15px;
}

.bms-vehicle-lookup-container.minimal .bms-vehicle-display {
    background: transparent;
    border: 1px solid #ddd;
    box-shadow: none;
}

/* Admin Theme */
.bms-vehicle-lookup-container.admin {
    background: #f1f1f1;
    padding: 15px;
    border-radius: 5px;
}

.bms-vehicle-lookup-container.admin .bms-lookup-title {
    font-size: 18px;
    margin-bottom: 15px;
}

/* =============================================================================
   Registration Input Wrapper
   ========================================================================== */

.bms-registration-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.bms-registration-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
}

.bms-registration-input:focus {
    outline: none;
    border-color: #3366CC;
    box-shadow: 0 0 0 3px rgba(51, 102, 204, 0.1);
}

.bms-registration-input.bms-loading {
    border-color: #f39c12;
    background-color: #fef9e7;
}

.bms-registration-input.bms-success {
    border-color: #27ae60;
    background-color: #eafaf1;
}

.bms-registration-input.bms-error {
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

/* =============================================================================
   Lookup Button and Status
   ========================================================================== */

.bms-lookup-button {
    padding: 12px 16px;
    background: #3366CC;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

.bms-lookup-button:hover {
    background: #2854a8;
    transform: translateY(-1px);
}

.bms-lookup-button:disabled {
    background: #bbb;
    cursor: not-allowed;
    transform: none;
}

.bms-lookup-button .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.bms-lookup-status {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
}

.bms-lookup-status.loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3366CC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.bms-lookup-status.success .dashicons {
    color: #27ae60;
    font-size: 20px;
}

.bms-lookup-status.error .dashicons {
    color: #e74c3c;
    font-size: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   Error Messages
   ========================================================================== */

.bms-error-message {
    background: #fdf2f2;
    color: #e74c3c;
    padding: 8px 12px;
    border-radius: 4px;
    border-left: 4px solid #e74c3c;
    font-size: 14px;
    margin-top: 8px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
   Vehicle Display
   ========================================================================== */

.bms-vehicle-display {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.bms-vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

.bms-vehicle-header h4 {
    margin: 0;
    color: #495057;
    font-size: 18px;
}

.bms-clear-vehicle {
    background: none;
    border: none;
    font-size: 24px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.bms-clear-vehicle:hover {
    background: #e9ecef;
    color: #495057;
}

.bms-vehicle-info {
    margin-bottom: 16px;
}

.bms-vehicle-basic {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
}

.bms-vehicle-details {
    color: #6c757d;
    margin-bottom: 12px;
    font-size: 14px;
}

.bms-vehicle-mot {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    margin-bottom: 12px;
}

.bms-mot-status {
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    text-transform: uppercase;
}

.bms-mot-status.valid {
    background: #d4edda;
    color: #155724;
}

.bms-mot-status.invalid {
    background: #f8d7da;
    color: #721c24;
}

.bms-mot-status.unknown {
    background: #fff3cd;
    color: #856404;
}

.bms-vehicle-indicators {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.bms-maintenance-indicator,
.bms-risk-indicator {
    padding: 8px 12px;
    background: white;
    border-radius: 6px;
    font-size: 14px;
}

.bms-maintenance-score {
    font-weight: 600;
}

.bms-maintenance-score.good {
    color: #28a745;
}

.bms-maintenance-score.average {
    color: #ffc107;
}

.bms-maintenance-score.poor {
    color: #dc3545;
}

.bms-risk-level {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}

.bms-risk-level.low {
    color: #28a745;
}

.bms-risk-level.medium {
    color: #ffc107;
}

.bms-risk-level.high {
    color: #dc3545;
}

.bms-vehicle-actions {
    display: flex;
    gap: 12px;
}

.bms-mot-history-toggle {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease;
}

.bms-mot-history-toggle:hover {
    background: #5a6268;
}

/* =============================================================================
   MOT History Display
   ========================================================================== */

.bms-mot-history-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #dee2e6;
}

.bms-mot-summary {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.bms-mot-summary h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.bms-mot-tests {
    max-height: 300px;
    overflow-y: auto;
}

.bms-mot-test {
    background: white;
    border-radius: 6px;
    margin-bottom: 8px;
    overflow: hidden;
    border-left: 4px solid #dee2e6;
}

.bms-mot-test.passed {
    border-left-color: #28a745;
}

.bms-mot-test.failed {
    border-left-color: #dc3545;
}

.bms-test-header {
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.bms-test-result {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
}

.bms-test-defects {
    padding: 0 12px 12px;
    border-top: 1px solid #f8f9fa;
}

.bms-defect {
    padding: 6px;
    margin: 4px 0;
    border-radius: 4px;
    font-size: 13px;
}

.bms-defect.advisory {
    background: #fff3cd;
    color: #856404;
}

.bms-defect.fail {
    background: #f8d7da;
    color: #721c24;
}

.bms-defect.dangerous {
    background: #f5c6cb;
    color: #721c24;
    font-weight: 600;
}

/* =============================================================================
   Service Recommendations
   ========================================================================== */

.bms-service-recommendations {
    background: #e7f3ff;
    border: 1px solid #b8daff;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.bms-service-recommendations h4 {
    margin: 0 0 16px 0;
    color: #004085;
    font-size: 16px;
}

.bms-recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bms-service-recommendation {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 4px solid transparent;
}

.bms-service-recommendation:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.bms-service-recommendation.urgent {
    border-left-color: #dc3545;
}

.bms-service-recommendation.preventive {
    border-left-color: #ffc107;
}

.bms-service-recommendation.maintenance {
    border-left-color: #28a745;
}

.bms-recommendation-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: white;
}

.bms-service-recommendation.urgent .bms-recommendation-icon {
    background: #dc3545;
}

.bms-service-recommendation.preventive .bms-recommendation-icon {
    background: #ffc107;
}

.bms-service-recommendation.maintenance .bms-recommendation-icon {
    background: #28a745;
}

.bms-recommendation-content {
    flex: 1;
}

.bms-recommendation-content strong {
    display: block;
    margin-bottom: 4px;
    color: #212529;
}

.bms-recommendation-content p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

.bms-recommendation-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dee2e6;
}

.bms-recommendation-priority.priority-1 {
    background: #dc3545;
}

.bms-recommendation-priority.priority-2 {
    background: #fd7e14;
}

.bms-recommendation-priority.priority-3 {
    background: #ffc107;
}

.bms-recommendation-priority.priority-4 {
    background: #28a745;
}

/* =============================================================================
   Mock Data Notice
   ========================================================================== */

.bms-mock-data-notice {
    background: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 12px;
    font-size: 12px;
    text-align: center;
    border: 1px solid #ffeaa7;
}

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

@media (max-width: 768px) {
    .bms-registration-wrapper {
        flex-direction: column;
        gap: 12px;
    }
    
    .bms-lookup-button {
        width: 100%;
        justify-content: center;
    }
    
    .bms-vehicle-indicators {
        grid-template-columns: 1fr;
    }
    
    .bms-test-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .bms-service-recommendation {
        flex-direction: column;
        text-align: center;
    }
    
    .bms-recommendations-list {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .bms-vehicle-display {
        padding: 16px;
        margin: 16px 0;
    }
    
    .bms-service-recommendations {
        padding: 16px;
        margin: 16px 0;
    }
    
    .bms-mot-history-details {
        font-size: 14px;
    }
    
    .bms-vehicle-basic {
        font-size: 16px;
    }
}

/* =============================================================================
   WordPress Admin Styles
   ========================================================================== */

.wp-admin .bms-registration-input {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.wp-admin .bms-lookup-button {
    font-family: inherit;
}

/* =============================================================================
   Print Styles
   ========================================================================== */

@media print {
    .bms-lookup-button,
    .bms-clear-vehicle,
    .bms-mot-history-toggle,
    .bms-service-recommendation {
        display: none;
    }
    
    .bms-vehicle-display {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .bms-mock-data-notice {
        display: none;
    }
}

/* =============================================================================
   Accessibility Improvements
   ========================================================================== */

.bms-registration-input:focus,
.bms-lookup-button:focus,
.bms-mot-history-toggle:focus,
.bms-service-recommendation:focus {
    outline: 2px solid #3366CC;
    outline-offset: 2px;
}

.bms-service-recommendation {
    role: button;
    tabindex: 0;
}

.bms-service-recommendation:focus {
    outline: 2px solid #3366CC;
    outline-offset: 2px;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bms-registration-input {
        border-width: 3px;
    }
    
    .bms-vehicle-display {
        border-width: 2px;
    }
    
    .bms-service-recommendation {
        border-width: 2px;
        border-style: solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bms-registration-input,
    .bms-lookup-button,
    .bms-service-recommendation,
    .bms-clear-vehicle {
        transition: none;
    }
    
    .bms-lookup-status.loading .spinner {
        animation: none;
    }
    
    @keyframes spin {
        0%, 100% { transform: rotate(0deg); }
    }
}
