* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #d8280b;
    --primary-dark: #b32209;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg:
        0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

body {
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
        Cantarell, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* 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-width: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo svg {
    width: 32px;
    height: 32px;
}

.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #25d366;
    color: white;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s;
    box-shadow: var(--shadow);
    white-space: nowrap;
}

.whatsapp-btn:hover {
    background: #20ba5a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.whatsapp-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.whatsapp-text {
    display: inline;
}

.whatsapp-fab {
    display: none;
}

.username-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    font-size: 0.875rem;
}

.username-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.username-value {
    color: var(--text-primary);
    font-weight: 600;
}

.search-container {
    flex: 1;
    max-width: 600px;
}

.search-form {
    display: flex;
    gap: 0.75rem;
}

.search-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(233, 28, 35, 0.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.filters-container {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: relative;
    z-index: 5;
}

.filters {
    display: flex;
    align-items: end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 150px;
}

.filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    outline: none;
    position: relative;
    z-index: 10;
}

.filter-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(233, 28, 35, 0.1);
}

.filter-select:hover {
    border-color: var(--primary);
}

main {
    padding: 2rem 0;
}

.stats-bar {
    margin-bottom: 3rem;
    display: flex;
    gap: 1rem;
    width: 100%;
}

.stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 2rem;
}

.stat {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    flex: 1;
    min-width: 0;
    text-align: center;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.loading {
    text-align: center;
    padding: 4rem 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.error {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
}

.empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.cars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.car-card {
    background: var(--bg-primary);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

.car-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.car-card-report {
    border: 2px solid var(--success);
    position: relative;
}

.car-card-report:hover {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.car-card-report::after {
    content: "Click to Purchase Report";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(16, 185, 129, 0.95), transparent);
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
}

.car-card-report:hover::after {
    opacity: 1;
}

footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: 2rem 0;
    margin-top: 4rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Mobile: Always show purchase hint on report cards */
@media (max-width: 768px) {
    .car-card-report::after {
        opacity: 1;
        background: rgba(16, 185, 129, 0.9);
        font-size: 0.8rem;
        padding: 0.5rem;
    }
}

.car-image-container {
    position: relative;
    width: 100%;
    padding-top: 50%;
    background: var(--bg-secondary);
    overflow: hidden;
}

.car-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.status-pills {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.status-badge {
    padding: 0.375rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-sold {
    background: var(--danger);
    color: white;
}

.status-available {
    background: var(--primary);
    color: white;
}

.status-report {
    background: var(--success);
    color: white;
}

.car-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.car-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.car-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.car-details {
    display: grid;
    gap: 0.75rem;
    margin-top: auto;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.detail-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.color-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--border);
}

/* Tablet and Medium Screens */
@media (max-width: 1024px) and (min-width: 769px) {
    .cars-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.25rem;
    }

    .car-card {
        min-height: 400px;
    }

    .car-image-container {
        padding-top: 55%;
    }

    .car-body {
        padding: 1rem;
    }

    .car-title {
        font-size: 1rem;
    }

    .detail-row {
        padding-bottom: 0.625rem;
    }
}

/* Mobile Landscape and Small Tablets */
@media (max-width: 768px) and (min-width: 481px) {
    .container {
        padding: 0 0.75rem;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .logo {
        text-align: center;
    }

    .whatsapp-btn {
        display: none;
    }

    .whatsapp-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 2rem;
        right: 1.5rem;
        width: 60px;
        height: 60px;
        background: #25d366;
        color: white;
        border-radius: 50%;
        box-shadow:
            0 4px 12px rgba(37, 211, 102, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .whatsapp-fab:hover,
    .whatsapp-fab:active {
        background: #20ba5a;
        transform: scale(1.1);
        box-shadow:
            0 6px 16px rgba(37, 211, 102, 0.5),
            0 3px 6px rgba(0, 0, 0, 0.3);
    }

    .whatsapp-fab svg {
        width: 32px;
        height: 32px;
    }

    .username-display {
        align-self: center;
        margin: 0.25rem 0;
    }

    .search-container {
        max-width: 100%;
    }

    .search-form {
        gap: 0.5rem;
    }

    .search-input {
        padding: 0.625rem 0.875rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.9rem;
    }

    .stats-bar {
        flex-direction: column;
        align-items: stretch;
        margin-bottom: 2rem;
    }

    .stats {
        flex-direction: row;
        gap: 0.75rem;
    }

    .stat {
        flex: 1;
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .cars-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .car-card {
        flex-direction: row;
        height: auto;
        min-height: 140px;
    }

    .car-left-column {
        width: 45%;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
    }

    .car-image-container {
        width: 100%;
        padding-top: 60%;
        flex-shrink: 0;
    }

    .status-pills {
        flex-direction: row;
        gap: 0.25rem;
        padding: 0.375rem;
        border-bottom: none;
        border-right: 1px solid var(--border);
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.375rem;
    }

    .car-body {
        flex: 1;
        padding: 0.75rem;
    }

    .car-title {
        font-size: 0.95rem;
        margin-bottom: 0.25rem;
    }

    .car-subtitle {
        font-size: 0.8rem;
        margin-bottom: 0.75rem;
    }

    .car-details {
        gap: 0.375rem;
    }

    .detail-row {
        padding-bottom: 0.375rem;
    }

    .detail-label,
    .detail-value {
        font-size: 0.8rem;
    }

    .filters {
        flex-direction: row;
        align-items: end;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .filter-group {
        min-width: 120px;
        flex: 1;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    .header {
        padding: 1rem 0;
    }

    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .logo {
        font-size: 1.25rem;
        justify-content: center;
    }

    .whatsapp-btn {
        display: none;
    }

    .whatsapp-fab {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        bottom: 1.5rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        background: #25d366;
        color: white;
        border-radius: 50%;
        box-shadow:
            0 4px 12px rgba(37, 211, 102, 0.4),
            0 2px 4px rgba(0, 0, 0, 0.2);
        z-index: 1000;
        text-decoration: none;
        transition: all 0.3s ease;
    }

    .whatsapp-fab:hover,
    .whatsapp-fab:active {
        background: #20ba5a;
        transform: scale(1.1);
        box-shadow:
            0 6px 16px rgba(37, 211, 102, 0.5),
            0 3px 6px rgba(0, 0, 0, 0.3);
    }

    .whatsapp-fab svg {
        width: 28px;
        height: 28px;
    }

    .username-display {
        align-self: center;
        margin: 0.25rem 0;
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }

    .search-container {
        max-width: 100%;
    }

    .search-form {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-input {
        padding: 0.75rem;
        font-size: 1rem;
        text-align: center;
    }

    .btn {
        padding: 0.75rem;
        font-size: 1rem;
        justify-content: center;
    }

    .filters-container {
        padding: 0.75rem 0;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .filter-group {
        min-width: auto;
    }

    .filter-select {
        padding: 0.625rem;
        font-size: 0.9rem;
    }

    .stats-bar {
        margin-bottom: 1.5rem;
    }

    .stats {
        flex-direction: column;
        gap: 0.75rem;
    }

    .stat {
        padding: 1rem;
    }

    .stat-label {
        font-size: 0.8rem;
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .cars-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .car-card {
        flex-direction: row;
        height: auto;
        min-height: 120px;
        border-radius: 0.5rem;
    }

    .car-left-column {
        width: 40%;
        display: flex;
        flex-direction: column;
        flex-shrink: 0;
    }

    .car-image-container {
        width: 100%;
        padding-top: 50%;
        flex-shrink: 0;
    }

    .status-pills {
        flex-direction: row;
        gap: 0.15rem;
        padding: 0.25rem;
        border-bottom: none;
        border-right: 1px solid var(--border);
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
    }

    .status-badge {
        font-size: 0.65rem;
        padding: 0.15rem 0.3rem;
    }

    .car-body {
        flex: 1;
        padding: 0.5rem;
    }

    .car-title {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
        line-height: 1.3;
    }

    .car-subtitle {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }

    .car-details {
        gap: 0.25rem;
    }

    .detail-row {
        padding-bottom: 0.25rem;
    }

    .detail-label,
    .detail-value {
        font-size: 0.75rem;
    }

    .color-dot {
        width: 10px;
        height: 10px;
    }
}

.currency-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

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

.currency-popup {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.currency-popup h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.currency-popup p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.currency-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.currency-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.currency-btn:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.currency-flag {
    font-size: 2rem;
}

.currency-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.currency-amount {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.currency-close {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.currency-close:hover {
    background: var(--border);
}

@media (max-width: 480px) {
    .currency-popup {
        padding: 1.5rem;
    }

    .currency-popup h2 {
        font-size: 1.25rem;
    }

    .currency-buttons {
        grid-template-columns: 1fr;
    }

    .currency-btn {
        padding: 1.25rem;
    }

    .currency-flag {
        font-size: 1.75rem;
    }

    .currency-name {
        font-size: 0.9rem;
    }

    .currency-amount {
        font-size: 1.1rem;
    }
}
