html, body {
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden !important;
    background: url('../img/background.jpg') no-repeat center center fixed;
    background-size: cover;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-position: center center;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Garante que o conteúdo não ultrapasse a tela */
}

/* Header fixo no topo e transparente */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 1000;
    background: transparent !important;
    border-bottom: none;
    box-shadow: none;
    transition: background 0.3s;
}

body, .cards-container {
    padding-top: 30px; /* Espaço para o header fixo */
}

/* Carrossel de favoritos */
.favoritos-carousel-container {
    max-width: 600px;
    margin: 0 auto 30px;
    overflow: hidden;
}

.favoritos-carousel-title {
    text-align: center;
    color: #ff2222;
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    letter-spacing: 1px;
    text-shadow: 1px 1px 8px #000;
}

.favoritos-carousel {
    position: relative;
    height: 400px;
}

.carousel-indicators {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    display: flex;
    gap: 8px;
    z-index: 10;
    margin-top: 10px;
    justify-content: center;
}
.favorito-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    display: flex;
    justify-content: center;
}

.favorito-slide.active {
    opacity: 1;
    z-index: 1;
}
.favorito-card {
    width: 100%;
    max-width: 350px;
    background: #111;
    color: #ff2222;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    overflow: hidden;
}
.favorito-card .card-img-top {
    width: 100%;
    height: 180px;
    object-fit: contain; /* Mostra a imagem inteira, sem cortar */
    object-position: center;
    background: #222;
    border-radius: 8px 8px 0 0;
    margin: 0;
    padding: 0;
    display: block;
}
.favorito-card .card-body {
    background: #000;
    color: #ff2222;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0.7rem;
}

/* Centraliza os cards do meio da página para baixo */
.cards-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    min-height: 50vh;
    box-sizing: border-box;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Cards — layout com imagem em destaque e nome centralizado */
.cards-container .card {
    width: 220px;
    height: 300px;
    margin: 0.5rem;
    border-radius: 12px;
    overflow: hidden;
    background: #0b0b0b;
    color: #fff;
    position: relative;
    transition: transform 0.15s, box-shadow 0.2s ease-in-out;
    cursor: pointer;
    border: 1px solid rgba(0, 200, 255, 0.15);
    box-shadow: 0 0 0 rgba(0, 200, 255, 0), 0 6px 18px rgba(0,0,0,0.35);
    box-sizing: border-box;
}
.cards-container .card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 0 12px rgba(0, 200, 255, 0.25), 0 12px 24px rgba(0, 0, 0, 0.45);
}

/* Imagem ocupa todo o card menos a faixa do nome */
.cards-container .card-img-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 42px);
    object-fit: cover;
    object-position: center;
    display: block;
    padding: 0;
    margin: 0;
    max-width: none;
    max-height: none;
    background: #0b0b0b;
}

/* Faixa do nome — ancorada no fundo */
.cards-container .card-body {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 42px;
    background: #050505;
    color: #fff;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    padding: 4px 10px;
    border-top: 1px solid rgba(0, 200, 255, 0.08);
}

.cards-container .card-title {
    color: #fff !important;
    font-weight: 600;
    font-size: 0.82rem;
    text-align: center;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* Navbar links e botões em tons de vermelho */
.navbar .navbar-brand,
.navbar .navbar-nav .nav-link,
.navbar .navbar-toggler {
    color: #fff !important;
    border-color: #ff2222 !important;
    text-shadow: 1px 1px 4px #000;
}

.navbar .navbar-nav .nav-link.active,
.navbar .navbar-nav .nav-link:focus,
.navbar .navbar-nav .nav-link:hover {
    color: #ff2222 !important;
    background: rgba(0,0,0,0.5) !important;
    border-radius: 6px;
}

.btn-danger,
.btn-danger:focus,
.btn-danger:hover {
    background: #ff2222 !important;
    border-color: #b30000 !important;
    color: #fff !important;
}

/* List-group para estatísticas em vermelho */
.list-group-item {
    background: #330000 !important;
    color: #ff2222 !important;
    border: none;
}

.card-title,
.card-text {
    color: #ff2222 !important;
}

/* Botão Sair do modal com padrão vermelho */

.modal-content-custom .btn-close {
    background: #b30000 !important;
    color: #fff !important;
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 90px;
    min-height: 40px;
    font-size: 1.1rem;
    text-align: center;
}

/* Responsividade para telas menores */
@media (max-width: 1200px) {
    .cards-container .card {
        width: 30vw;
        min-width: 180px;
        max-width: 240px;
        height: 340px;
    }
}

@media (max-width: 900px) {
    .cards-container .card {
        width: 45vw;
        min-width: 160px;
        max-width: 230px;
        height: 320px;
    }
    
    /* Ajustes para carrossel em tablets */
    .favoritos-carousel-title {
        font-size: 1.8rem;
    }
    
    .favoritos-carousel {
        height: 350px;
    }
}

@media (max-width: 768px) {
    /* Ajustes para header em mobile */
    .navbar-brand span {
        display: none !important;
    }
    
    /* Ajustes para carrossel em mobile */
    .favoritos-carousel-container {
        max-width: 95%;
        margin: 0 auto 20px;
    }
    
    .favoritos-carousel-title {
        font-size: 1.5rem;
        margin-bottom: 0.8rem;
    }
    
    .favoritos-carousel {
        height: 300px;
    }
    
    .favorito-card {
        max-width: 300px;
    }
    
    .favorito-card .card-img-top {
        height: 150px;
    }
    
    /* Ajustes para containers */
    .container {
        padding-left: 8px;
        padding-right: 8px;
        max-width: 100vw;
    }
    
    /* Formulário de cadastro de carrinho */
    #formCarro .form-label,
    #formCarro .form-control,
    #formCarro .form-select,
    #formCarro textarea {
        font-size: 1.1rem;
        padding: 0.85rem 1rem;
    }
    #formCarro .form-control,
    #formCarro .form-select {
        min-height: 48px;
        border-radius: 10px;
    }
    #formCarro .form-label {
        font-weight: 600;
        margin-bottom: 0.3rem;
    }
    #formCarro .btn {
        font-size: 1.1rem;
        width: 100%;
        min-height: 48px;
        border-radius: 10px;
        margin-bottom: 0.5rem;
        box-sizing: border-box;
        min-height: 48px;
        border-radius: 10px;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    #formCarro .d-flex.gap-2.flex-wrap {
        flex-direction: column;
        gap: 0.5rem !important;
    }
    #formCarro #previewMobile img {
        max-width: 90vw;
        max-height: 220px;
        border-radius: 10px;
        margin: 0 auto 10px auto;
        display: block;
        box-shadow: 0 0 8px #000;
    }
    #formCarro #cameraArea {
        min-height: 220px;
        max-width: 100vw;
        padding: 0;
    }
    #formCarro #videoMobile {
        width: 100vw;
        max-width: 340px;
        max-height: 220px;
        border-radius: 10px;
        margin: 0 auto;
        display: block;
    }
    #formCarro #btnCameraMobile,
    #formCarro #btnCapture {
        width: 100%;
        min-height: 48px;
        font-size: 1.1rem;
        margin-top: 0.5rem;
        border-radius: 10px;
    }
    /* Tabela de carros cadastrados */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .table-carros {
        font-size: 0.95rem;
        min-width: 600px;
    }
    .table-carros th, .table-carros td {
        padding: 0.5rem 0.4rem;
        text-align: center;
    }
    .table-carros img {
        width: 48px;
        height: 32px;
    }
    .table-carros .btn {
        font-size: 1rem;
        min-width: 70px;
        min-height: 38px;
        margin-bottom: 0.2rem;
        border-radius: 8px;
    }
    /* Esconde colunas menos importantes em mobile (exemplo: estado, usuário) */
    .table-carros th:nth-child(5),
    .table-carros td:nth-child(5),
    .table-carros th:nth-child(8),
    .table-carros td:nth-child(8) {
        display: none;
    }
}

@media (max-width: 600px) {
    .cards-container .card {
        width: 90vw;
        min-width: 120px;
        max-width: 100vw;
        height: 300px;
    }
    
    /* Ajustes específicos para smartphones */
    body, .cards-container {
        padding-top: 20px; /* Mais espaço para header em mobile */
    }
    
    /* Header mais compacto */
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .navbar-brand img {
        max-height: 40px;
    }
    
    /* Carrossel ainda mais compacto */
    .favoritos-carousel {
        height: 280px;
    }
    
    .favorito-card {
        max-width: 280px;
    }
    
    .favorito-card .card-img-top {
        height: 130px;
    }
    
    .favorito-card .card-body {
        padding: 0.5rem;
    }
    
    /* Formulários mais amigáveis */
    .form-control, .form-select {
        font-size: 16px; /* Evita zoom no iOS */
        padding: 0.75rem;
    }
    
    /* Tabelas responsivas */
    .table-carros {
        font-size: 0.85rem;
    }
    
    .table-carros img {
        width: 50px;
        height: 35px;
    }
    
    .table-carros .btn {
        padding: 0.2rem 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Modal responsivo */
    .modal-content-custom {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    .modal-content-custom img {
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    /* Ajustes para telas muito pequenas */
    .favoritos-carousel-title {
        font-size: 1.3rem;
    }
    
    .favoritos-carousel {
        height: 250px;
    }
    
    .favorito-card {
        max-width: 250px;
    }
    
    .favorito-card .card-img-top {
        height: 110px;
    }
    
    /* Cards ainda menores */
    .cards-container .card {
        height: 280px;
    }
    
    /* Texto menor em tabelas */
    .table-carros {
        font-size: 0.8rem;
    }
    
    .table-carros th, .table-carros td {
        padding: 0.3rem;
    }
}

/* Garante que tabelas e containers não ultrapassem a tela */
.table-responsive, .container, .row {
    max-width: 100vw;
    overflow-x: auto;
    box-sizing: border-box;
}

/* Logo padrão para todas as páginas */
.navbar-brand img {
    max-height: 48px;
    width: auto;
    display: block;
}

/* Efeito visual para logo de administrador (apenas em páginas específicas) */
.admin-logo {
    filter: drop-shadow(0 0 4px #ffd700);
    transition: all 0.3s ease;
}

.admin-logo:hover {
    filter: drop-shadow(0 0 12px #ffd700) drop-shadow(0 0 20px #ffaa00) brightness(1.2);
    transform: scale(1.05);
}

/* Garantir altura consistente do header em todas as páginas */
.navbar {
    min-height: 70px;
}

.navbar .container {
    min-height: 56px;
    align-items: center;
}
