:root {
    --bg-color: #0d0d0d;
    --surface-color: #1a1a1a;
    --surface-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --border-color: #333333;
    --accent-color: #ffffff;
    --accent-hover: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #000;
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

#app-container {
    width: 100%;
    max-width: 480px; /* Mobile width constraint on desktop */
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    position: relative;
    overflow: hidden;
}

/* Header */
header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

#back-button {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

#back-button:active {
    transform: scale(0.9);
}

#back-button.hidden {
    display: none;
}

#corner-logo {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 132px; /* aumentado x2.2 */
    height: auto;
    border: 2px solid white; /* borde blanco */
    border-radius: 8px; /* round the corners a bit */
    background-color: white; /* in case it has transparency, keep it visible */
    z-index: 50; /* ensure it stays on top */
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}

#corner-logo:hover {
    transform: scale(1.1);
}

#app-title {
    font-size: 1.1rem;
    font-weight: 600;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#app-title.centered {
    text-align: center;
}

.btn-lang {
    background: var(--surface-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.btn-lang:hover {
    background: var(--accent-color);
    color: #000;
}


/* Search Bar */
#search-container {
    padding: 12px 16px;
    background-color: var(--bg-color);
    flex-shrink: 0;
    z-index: 5;
}

#search-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
}

#search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

#search-input::placeholder {
    color: var(--text-secondary);
}

/* Main Content */
#main-content {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
}

/* Views */
.list-view, .view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: var(--bg-color);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s ease;
    transform: translateX(100%); /* Start hidden to the right */
    opacity: 0;
    pointer-events: none;
    list-style: none;
}

.list-view.active, .view.active {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.list-view.previous {
    transform: translateX(-30%);
    opacity: 0.5;
}

/* List Items */
.list-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
    font-size: 1rem;
    font-weight: 500;
}

.list-item:hover, .list-item:active {
    background-color: var(--surface-hover);
}

.list-item::after {
    content: "›";
    color: var(--text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    margin-left: 8px;
}

/* Results Table View */
#results-view {
    padding: 16px;
}

.table-container {
    background-color: var(--surface-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

#results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

#results-table th {
    background-color: #222;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.75rem;
}

#results-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

#results-table tr:last-child td {
    border-bottom: none;
}

#results-table tbody tr {
    transition: background-color 0.2s ease;
}

#results-table tbody tr:hover {
    background-color: var(--surface-hover);
}

/* Loading Spinner */
#loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
}

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

#loading.hidden {
    display: none;
}

/* Scrollbar Styling for webkit */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Desktop Layout */
@media (min-width: 768px) {
    body {
        align-items: center;
        padding: 20px;
    }

    #app-container {
        max-width: 1200px;
        height: 90vh;
        border-radius: 12px;
        border: 1px solid var(--border-color);
    }

    header {
        border-radius: 12px 12px 0 0;
    }

    #back-button {
        display: none !important;
    }

    #app-title {
        transform: none !important;
        text-align: left;
    }

    #search-container.hide-on-mobile {
        display: block !important;
    }

    #main-content {
        display: flex;
        flex-direction: row;
    }

    .list-view, .view {
        position: relative;
        transform: none !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        height: 100%;
        display: block;
    }

    #make-list {
        flex: 0 0 250px;
        border-right: 1px solid var(--border-color);
    }

    #model-list {
        flex: 0 0 250px;
        border-right: 1px solid var(--border-color);
    }

    #results-view {
        flex: 1;
    }

    /* Keep items highlighted when active on desktop */
    .list-item.selected {
        background-color: var(--surface-hover);
        color: var(--accent-color);
        border-right: 3px solid var(--accent-color);
    }
}
