/* =============================================
   CarAdvisor - Main Stylesheet
   Responsive design for web, iOS & Android
   ============================================= */

:root {
    --ca-primary: #1a56db;
    --ca-secondary: #6b7280;
    --ca-warning: #f59e0b;
    --ca-success: #10b981;
    --ca-danger: #ef4444;
    --ca-border-radius: 12px;
    --ca-shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --ca-shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
}

/* ============ Base ============ */
html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    color: #1f2937;
    background-color: #f9fafb;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* iOS safe areas */
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============ Hero Section ============ */
.hero-section {
    background: linear-gradient(135deg, #1a56db 0%, #1e3a8a 60%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ============ Cards ============ */
.card {
    border-radius: var(--ca-border-radius) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.garage-card:hover,
.promo-card:hover,
.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ca-shadow-lg) !important;
}

.category-card {
    transition: all 0.2s ease;
    cursor: pointer;
}

/* ============ Service rows ============ */
.service-row:hover {
    background-color: #f0f9ff;
}

/* ============ Navbar ============ */
.navbar {
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-size: 1.4rem;
    letter-spacing: -0.5px;
}

/* ============ Buttons ============ */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.15s ease;
}

.btn:active {
    transform: scale(0.97);
}

/* ============ Forms ============ */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #d1d5db;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--ca-primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

/* ============ Alerts ============ */
.alert {
    border-radius: 10px;
    border: none;
}

/* ============ Tables ============ */
.table > :not(caption) > * > * {
    padding: 0.75rem 1rem;
}

/* ============ Badges ============ */
.badge {
    font-weight: 500;
    border-radius: 6px;
}

/* ============ Stars ============ */
.bi-star-fill.text-warning {
    color: #f59e0b !important;
}

/* ============ Garage icon circle ============ */
.garage-icon-circle {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ PWA Install Banner ============ */
#pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    padding: 12px 20px;
    display: none;
    align-items: center;
    gap: 12px;
    min-width: 280px;
}

#ios-install-hint {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1a56db;
    color: white;
    text-align: center;
    padding: 12px 16px;
    font-size: 0.85rem;
    z-index: 9999;
}

/* ============ Loading spinner ============ */
.spinner-border {
    width: 2.5rem;
    height: 2.5rem;
}

/* ============ Sticky top adjustment ============ */
.sticky-top {
    top: 0;
    z-index: 1020;
}

/* ============ Responsive ============ */
@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 1.75rem;
    }

    .display-4 {
        font-size: 2rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        font-size: 0.85rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        text-align: center;
    }

    .d-flex.gap-3 {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ============ Touch-friendly ============ */
@media (hover: none) {
    .btn {
        min-height: 44px; /* iOS minimum tap target */
        padding: 0.5rem 1rem;
    }

    .list-group-item {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* ============ Print ============ */
@media print {
    .navbar, footer, .btn { display: none !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ============ Blazor loading ============ */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ============ Transitions ============ */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

/* ============ Custom scrollbar ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f1f1; }
::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1a1; }
