/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Primary Brand Colors - Modern Blue Palette */
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-900: #1e3a8a;
    
    /* Secondary Colors - Purple Accent */
    --secondary-color: #8b5cf6;
    --secondary-dark: #7c3aed;
    --secondary-light: #a78bfa;
    --accent-color: #06b6d4;
    --accent-dark: #0891b2;
    
    /* Status Colors - Vibrant and Accessible */
    --success-color: #10b981;
    --success-light: #34d399;
    --success-dark: #059669;
    --error-color: #ef4444;
    --error-light: #f87171;
    --error-dark: #dc2626;
    --warning-color: #f59e0b;
    --warning-light: #fbbf24;
    --warning-dark: #d97706;
    
    /* Neutral Colors - Modern Grays */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --text-light: #d1d5db;
    --text-white: #ffffff;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-dark: #1f2937;
    --bg-darker: #111827;
    
    /* Enhanced Gradients */
    --bg-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-secondary: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-error: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.8) 100%);
    
    /* Glass Effect Variables */
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* Enhanced Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* Border Colors */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --border-dark: #d1d5db;
    
    /* Border Radius */
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --border-radius-lg: 24px;
    --border-radius-xl: 32px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-gradient);
    z-index: -1;
}

.background-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s linear infinite;
}

.background-animation::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-50px, -50px) rotate(360deg); }
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

/* Main Container */
.container {
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 2rem;
    animation: slideInDown 0.8s ease-out;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo i {
    font-size: 2.5rem;
    color: var(--bg-primary);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--bg-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Card */
.card {
    background: var(--gradient-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow), var(--shadow-xl);
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.8s ease-out 0.2s both;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow), var(--shadow-2xl);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--bg-gradient);
}

/* Input Section */
.input-section {
    margin-bottom: 2rem;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.input-label i {
    color: var(--primary-color);
    font-size: 1rem;
}

.input-wrapper {
    position: relative;
    margin-bottom: 8px;
}

#vinInput {
    width: 100%;
    padding: 18px 20px 18px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-sm);
}

#vinInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-50), var(--shadow-md);
    transform: translateY(-1px);
    background: var(--bg-primary);
}

#vinInput::placeholder {
    color: var(--text-light);
    text-transform: none;
    letter-spacing: normal;
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.1rem;
    pointer-events: none;
    transition: var(--transition);
}

#vinInput:focus + .input-icon {
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

.character-counter {
    position: absolute;
    right: 50px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-weight: 600;
    background: var(--bg-primary);
    padding: 4px 10px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    pointer-events: none;
    z-index: 2;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.character-counter.valid {
    color: var(--success-color);
    background: var(--success-light);
    border-color: var(--success-color);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.character-counter.invalid {
    color: var(--error-color);
    background: var(--error-light);
    border-color: var(--error-color);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

.character-counter.warning {
    color: var(--warning-color);
    background: var(--warning-light);
    border-color: var(--warning-color);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.1);
}

.validation-message {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.validation-message.show {
    display: block;
}

.validation-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: var(--shadow-sm);
}

.validation-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
    box-shadow: var(--shadow-sm);
}

.validation-message.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
    box-shadow: var(--shadow-sm);
}

.validation-message.loading {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: var(--shadow-sm);
}

.validation-message.loading::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

.input-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

.input-hint i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    background: var(--gradient-primary);
    color: var(--text-white);
    border: none;
    padding: 18px 24px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-dark) 100%);
}

.submit-btn:active {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    transition: var(--transition);
}

.submit-btn:hover .btn-icon {
    transform: translateX(4px);
}

/* Enhanced Loading State */
.loading {
    text-align: center;
    padding: 2rem 0;
    position: relative;
    overflow: hidden;
}

.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Enhanced Spinner */
.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-ring:nth-child(1) {
    border-top: 4px solid var(--primary-color);
    border-right: 4px solid var(--primary-color);
    animation-duration: 1s;
}

.spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top: 4px solid var(--secondary-color);
    border-left: 4px solid var(--secondary-color);
    animation-duration: 1.5s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top: 4px solid var(--accent-color);
    border-bottom: 4px solid var(--accent-color);
    animation-duration: 2s;
}

/* Pulsing center dot */
.loading-spinner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 1.5s ease-in-out infinite;
}

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

@keyframes pulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0.7;
    }
}

/* Enhanced Loading Text */
.loading-text h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    animation: fadeInUp 0.6s ease-out;
}

.loading-text p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 8px;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* Animated dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    margin-top: 8px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

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

/* Progress Bar */
.loading-progress {
    width: 100%;
    max-width: 300px;
    height: 4px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1rem;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { 
        width: 0%;
        transform: translateX(-100%);
    }
    50% { 
        width: 70%;
        transform: translateX(0%);
    }
    100% { 
        width: 100%;
        transform: translateX(0%);
    }
}

/* Loading Steps */
.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 1rem;
    text-align: left;
    max-width: 300px;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    opacity: 0;
    animation: slideInLeft 0.5s ease-out forwards;
}

.loading-step:nth-child(1) { animation-delay: 0.5s; }
.loading-step:nth-child(2) { animation-delay: 1s; }
.loading-step:nth-child(3) { animation-delay: 1.5s; }

.loading-step.active {
    color: var(--primary-color);
    font-weight: 500;
}

.loading-step.completed {
    color: var(--success-color);
}

.loading-step-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    transition: all 0.3s ease;
}

.loading-step.active .loading-step-icon {
    background: var(--primary-color);
    animation: pulse 1s ease-in-out infinite;
}

.loading-step.completed .loading-step-icon {
    background: var(--success-color);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Mobile Loading Optimizations */
@media (max-width: 768px) {
    .loading-spinner {
        width: 60px;
        height: 60px;
    }
    
    .spinner-ring {
        border-width: 3px;
    }
    
    .loading-spinner::after {
        width: 10px;
        height: 10px;
    }
    
    .loading-text h3 {
        font-size: 1.2rem;
    }
    
    .loading-text p {
        font-size: 0.9rem;
    }
    
    .loading-steps {
        max-width: 100%;
    }
}

/* Error State */
.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

.error-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.error-icon {
    color: var(--error-color);
    font-size: 1.5rem;
    margin-top: 2px;
}

.error-text h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--error-color);
    margin-bottom: 4px;
}

.error-text p {
    color: #991b1b;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Success State */
.success {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1rem;
}

.success-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.success-icon {
    color: var(--success-color);
    font-size: 1.5rem;
    margin-top: 2px;
}

.success-text h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--success-color);
    margin-bottom: 4px;
}

.success-text p {
    color: #22543d;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Features Section */
.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    animation: slideInUp 0.8s ease-out 0.4s both;
}

.feature {
    text-align: center;
    padding: 1.5rem 1rem;
    background: var(--glass-bg);
    border-radius: var(--border-radius);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.feature:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: var(--shadow-lg);
    border-color: rgba(255, 255, 255, 0.3);
}

.feature i {
    font-size: 2rem;
    color: var(--bg-primary);
    margin-bottom: 1rem;
    display: block;
}

.feature h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-primary);
    margin-bottom: 0.5rem;
}

.feature p {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

/* Redirect Loading Overlay */
.redirect-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

.redirect-loading-content {
    text-align: center;
    color: white;
    max-width: 400px;
    padding: 2rem;
}

.redirect-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

.redirect-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-radius: 50%;
    animation: redirectSpin 2s linear infinite;
}

.redirect-ring:nth-child(1) {
    border-top-color: var(--primary-color);
    animation-duration: 1.5s;
}

.redirect-ring:nth-child(2) {
    border-right-color: var(--secondary-color);
    animation-duration: 2s;
    animation-direction: reverse;
}

.redirect-ring:nth-child(3) {
    border-bottom-color: var(--accent-color);
    animation-duration: 2.5s;
}

.redirect-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: redirectPulse 1.5s ease-in-out infinite;
}

.redirect-text h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.redirect-text p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
}

.redirect-countdown {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

#countdownNumber {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    min-width: 60px;
    animation: countdownPulse 1s ease-in-out infinite;
}

.countdown-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.redirect-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.redirect-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    width: 0%;
    animation: redirectProgress 3s ease-out forwards;
}

/* Animations */
@keyframes redirectSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes redirectPulse {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.7;
    }
}

@keyframes countdownPulse {
    0%, 100% { 
        transform: scale(1);
    }
    50% { 
        transform: scale(1.1);
    }
}

@keyframes redirectProgress {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Animations */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Mobile-First Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
        min-height: 100vh;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .container {
        max-width: 100%;
        width: 100%;
    }
    
    .header {
        margin-bottom: 1.5rem;
    }
    
    .logo h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 0;
    }
    
    .card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        border-radius: 16px;
    }
    
    .input-section {
        margin-bottom: 1.5rem;
    }
    
    .input-label {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
    
    #vinInput {
        padding: 18px 20px;
        font-size: 1.1rem;
        border-radius: 12px;
    }
    
    .submit-btn {
        padding: 18px 24px;
        font-size: 1.1rem;
        border-radius: 12px;
        min-height: 56px; /* Ensure touch target is at least 44px */
    }
    
    .features {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .feature {
        padding: 1.2rem 1rem;
        border-radius: 12px;
    }
    
    .feature i {
        font-size: 1.8rem;
        margin-bottom: 0.8rem;
    }
    
    .feature h4 {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }
    
    .feature p {
        font-size: 0.85rem;
        line-height: 1.3;
    }
    
    .loading-content {
        gap: 1.2rem;
    }
    
    .loading-spinner {
        width: 50px;
        height: 50px;
    }
    
    .loading-text h3 {
        font-size: 1.2rem;
    }
    
    .loading-text p {
        font-size: 0.9rem;
    }
    
    .error, .success {
        padding: 1.2rem;
        border-radius: 12px;
    }
    
    .error-content, .success-content {
        gap: 10px;
    }
    
    .error-icon, .success-icon {
        font-size: 1.3rem;
    }
    
    .error-text h3, .success-text h3 {
        font-size: 1rem;
    }
    
    .error-text p, .success-text p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
        padding-top: 15px;
    }
    
    .card {
        padding: 1.2rem;
        margin-bottom: 1.2rem;
    }
    
    .logo {
        gap: 8px;
    }
    
    .logo h1 {
        font-size: 1.9rem;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 0.95rem;
    }
    
    .input-label {
        font-size: 0.85rem;
    }
    
    #vinInput {
        padding: 16px 18px;
        font-size: 1rem;
    }
    
    .input-hint {
        font-size: 0.8rem;
    }
    
    .submit-btn {
        padding: 16px 20px;
        font-size: 1rem;
        min-height: 52px;
    }
    
    .feature {
        padding: 1rem 0.8rem;
    }
    
    .feature i {
        font-size: 1.6rem;
    }
    
    .feature h4 {
        font-size: 0.95rem;
    }
    
    .feature p {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    body {
        padding: 5px;
        padding-top: 10px;
    }
    
    .card {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1.7rem;
    }
    
    .logo i {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    #vinInput {
        padding: 14px 16px;
        font-size: 0.95rem;
    }
    
    .submit-btn {
        padding: 14px 18px;
        font-size: 0.95rem;
        min-height: 48px;
    }
}

/* Mobile Redirect Loading Optimizations */
@media (max-width: 768px) {
    .redirect-loading-content {
        padding: 1.5rem;
        max-width: 350px;
    }
    
    .redirect-spinner {
        width: 60px;
        height: 60px;
    }
    
    .redirect-text h3 {
        font-size: 1.3rem;
    }
    
    .redirect-text p {
        font-size: 0.9rem;
    }
    
    #countdownNumber {
        font-size: 1.8rem;
        padding: 0.4rem 0.8rem;
        min-width: 50px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .submit-btn:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }
    
    .feature:hover {
        transform: none;
    }
    
    .submit-btn:active {
        transform: scale(0.98);
    }
    
    .feature:active {
        transform: scale(0.98);
    }
    
    /* Larger touch targets */
    .submit-btn {
        min-height: 48px;
    }
    
    #vinInput {
        min-height: 48px;
    }
    
    .input-icon {
        right: 18px;
    }
}

/* Landscape Mobile Optimization */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 5px;
        align-items: center;
    }
    
    .container {
        max-width: 90%;
    }
    
    .header {
        margin-bottom: 1rem;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
    }
    
    .card {
        padding: 1.2rem;
        margin-bottom: 1rem;
    }
    
    .features {
        display: none; /* Hide features in landscape to save space */
    }
}

/* High DPI Display Optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .background-animation::before {
        background-size: 25px 25px;
    }
}

/* Dark Mode Support for Mobile */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --text-tertiary: #9ca3af;
        --bg-primary: #1f2937;
        --bg-secondary: #111827;
        --border-color: #374151;
        --border-light: #4b5563;
    }
    
    .card {
        background: linear-gradient(145deg, rgba(31, 41, 55, 0.95) 0%, rgba(17, 24, 39, 0.9) 100%);
        color: var(--text-primary);
        border-color: var(--border-color);
    }
    
    .input-label {
        color: var(--text-secondary);
    }
    
    #vinInput {
        background: var(--bg-primary);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    
    #vinInput:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), var(--shadow-md);
    }
    
    #vinInput::placeholder {
        color: var(--text-tertiary);
    }
    
    .input-hint {
        color: var(--text-tertiary);
    }
    
    .character-counter {
        background: var(--bg-primary);
        color: var(--text-tertiary);
        border-color: var(--border-color);
    }
    
    .validation-message.error {
        background: rgba(239, 68, 68, 0.15);
        border-color: rgba(239, 68, 68, 0.4);
    }
    
    .validation-message.success {
        background: rgba(16, 185, 129, 0.15);
        border-color: rgba(16, 185, 129, 0.4);
    }
    
    .validation-message.warning {
        background: rgba(245, 158, 11, 0.15);
        border-color: rgba(245, 158, 11, 0.4);
    }
    
    .validation-message.loading {
        background: rgba(59, 130, 246, 0.15);
        border-color: rgba(59, 130, 246, 0.4);
    }
}

/* Focus States for Accessibility */
.submit-btn:focus-visible,
#vinInput:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #333333;
        --bg-primary: #ffffff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}