/**
 * UI/UX Refinements - Motoristi.EU
 * Minor optimizations: Mobile fixes, Font consistency, Better spacing
 * Keep the loved design, just polish it!
 */

/* ==== FONT SYSTEM REFINEMENT ==== */
:root {
    /* Use Inter as primary font for better readability */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Consistent font sizes */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */
    
    /* Consistent spacing */
    --space-1: 0.25rem;  /* 4px */
    --space-2: 0.5rem;   /* 8px */
    --space-3: 0.75rem;  /* 12px */
    --space-4: 1rem;     /* 16px */
    --space-6: 1.5rem;   /* 24px */
    --space-8: 2rem;     /* 32px */
    --space-12: 3rem;    /* 48px */
    --space-16: 4rem;    /* 64px */
}

/* Apply consistent font to body */
body {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    line-height: 1.6;
}

/* Headings with better hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

/* Better readability for paragraphs */
p {
    margin: 0 0 var(--space-4) 0;
    line-height: 1.7;
}

/* ==== MOBILE HEADER FIXES ==== */
@media (max-width: 768px) {
    .modern-header {
        height: 64px; /* Slightly smaller on mobile */
        padding: 0 var(--space-4);
    }
    
    /* Ensure logo is always visible */
    .header-left {
        min-width: auto;
        flex-shrink: 0;
    }
    
    .modern-logo {
        height: 40px; /* Smaller logo on mobile */
    }
    
    /* Better mobile spacing */
    .header-right {
        gap: var(--space-2);
        min-width: auto;
    }
    
    /* Hide text in language button on mobile */
    .language-btn span:not(.flag-icon) {
        display: none;
    }
    
    /* Compact login button on mobile */
    .login-btn {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
        height: 36px;
    }
}

@media (max-width: 480px) {
    .modern-header {
        padding: 0 var(--space-3);
    }
    
    .modern-logo {
        height: 36px; /* Even smaller on very small screens */
    }
    
    .header-right {
        gap: var(--space-1);
    }
    
    /* Make buttons more compact */
    .header-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
        padding: 0;
    }
    
    .login-btn {
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
        height: 32px;
    }
}

/* ==== HERO SECTION REFINEMENT ==== */
.hero-section {
    padding: var(--space-16) var(--space-6);
    min-height: 60vh; /* Reduced from potential 100vh */
}

.hero-title {
    font-size: var(--text-4xl);
    line-height: 1.2;
    margin-bottom: var(--space-6);
}

@media (max-width: 768px) {
    .hero-section {
        padding: var(--space-12) var(--space-4);
        min-height: auto;
    }
    
    .hero-title {
        font-size: var(--text-3xl);
        margin-bottom: var(--space-4);
    }
}

@media (max-width: 480px) {
    .hero-section {
        padding: var(--space-8) var(--space-4);
    }
    
    .hero-title {
        font-size: var(--text-2xl);
    }
}

/* ==== FEATURE CARDS CONSISTENCY ==== */
.feature-card {
    padding: var(--space-6);
    border-radius: 12px;
    transition: all 0.3s ease;
    /* Dark transparent background like weather cards */
    background: rgba(26, 26, 46, 0.7) !important;
    backdrop-filter: blur(10px) !important;
    border: 2px solid rgba(255, 107, 53, 0.3) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

.feature-card:hover {
    transform: translateY(-4px); /* Consistent hover lift */
    box-shadow: 0 8px 30px rgba(255, 107, 53, 0.4) !important;
}

.feature-card h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-3);
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.feature-card p {
    font-size: var(--text-sm);
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.95) !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    opacity: 1;
    margin: 0;
}

@media (max-width: 768px) {
    .feature-card {
        padding: var(--space-4);
    }
    
    .feature-card h3 {
        font-size: var(--text-lg);
    }
}

/* ==== SECTION SPACING REFINEMENT ==== */
.content-section {
    padding: var(--space-16) var(--space-6);
}

@media (max-width: 768px) {
    .content-section {
        padding: var(--space-12) var(--space-4);
    }
}

@media (max-width: 480px) {
    .content-section {
        padding: var(--space-8) var(--space-4);
    }
}

/* ==== PLATFORM FEATURES GRID ==== */
.platform-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-6);
    margin-top: var(--space-8);
}

@media (max-width: 768px) {
    .platform-features-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: var(--space-4);
        margin-top: var(--space-6);
    }
}

@media (max-width: 480px) {
    .platform-features-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
}

/* ==== BUTTON CONSISTENCY ==== */
.btn, .cta-button, button[type="submit"] {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: 600;
    padding: var(--space-3) var(--space-6);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    line-height: 1.5;
}

.btn:hover, .cta-button:hover, button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 768px) {
    .btn, .cta-button, button[type="submit"] {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }
}

/* ==== FORM INPUT CONSISTENCY ==== */
input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    padding: var(--space-3) var(--space-4);
    border-radius: 8px;
    transition: all 0.3s ease;
    line-height: 1.5;
}

@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: var(--text-sm);
        padding: var(--space-2) var(--space-3);
    }
}

/* ==== MODAL REFINEMENTS ==== */
.modal-content {
    border-radius: 12px;
    max-width: 90vw;
    padding: var(--space-8);
}

@media (max-width: 768px) {
    .modal-content {
        padding: var(--space-6);
        max-width: 95vw;
    }
}

@media (max-width: 480px) {
    .modal-content {
        padding: var(--space-4);
        max-width: 100vw;
        border-radius: 0;
    }
}

/* ==== CARD GRID RESPONSIVENESS ==== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-6);
}

@media (max-width: 768px) {
    .cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: var(--space-4);
    }
}

@media (max-width: 480px) {
    .cards-grid {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
}

/* ==== TEXT READABILITY ==== */
.text-content {
    max-width: 65ch; /* Optimal line length for readability */
    line-height: 1.7;
}

/* ==== IMPROVED FOCUS STATES ==== */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid var(--theme-primary);
    outline-offset: 2px;
}

/* ==== LOADING STATES ==== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.6s linear infinite;
}

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

/* ==== SMOOTH SCROLLING ==== */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ==== TOUCH IMPROVEMENTS ==== */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets on mobile */
    button,
    .btn,
    a.nav-link {
        min-height: 44px; /* Apple's recommended minimum */
        min-width: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .feature-card:hover {
        transform: none;
    }
    
    button:hover,
    .btn:hover {
        transform: none;
    }
}
