:root {
    --bs-font-sans-serif: 'Inter', sans-serif;
    --brt-yellow: #f7ca18;
    --brt-yellow-hover: #e0b615;
    --brt-dark: #1a1a1a;
}

body {
    background-color: #f4f4f9;
    font-family: var(--bs-font-sans-serif);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.fw-bold {
    font-weight: 600 !important; /* Elegant semi-bold instead of heavy bold */
}

/* Custom styling for inputs to add a subtle elegant border */
.form-control {
    border: 1px solid #d1d5db !important;
    background-color: #fcfcfc !important;
    font-weight: 400 !important;
    color: #2d3748 !important;
    transition: all 0.2s ease-in-out !important;
}
.form-control:focus {
    border-color: var(--brt-yellow) !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(247, 202, 24, 0.25) !important;
}

.brt-yellow-bg {
    background-color: var(--brt-yellow) !important;
    color: #000 !important;
}

.btn-primary, .btn-brt {
    background-color: var(--brt-yellow) !important;
    border-color: var(--brt-yellow) !important;
    color: #000 !important;
    font-weight: 600;
}

.btn-primary:hover, .btn-brt:hover {
    background-color: var(--brt-yellow-hover) !important;
    border-color: var(--brt-yellow-hover) !important;
}

.btn-outline-brt {
    color: #000 !important;
    border-color: var(--brt-yellow) !important;
    font-weight: 600;
}
.btn-outline-brt:hover, .btn-outline-brt.active {
    background-color: var(--brt-yellow) !important;
    color: #000 !important;
}

.brt-border-top {
    border-top: 4px solid var(--brt-dark) !important;
}

.logo {
    max-width: 200px;
    mix-blend-mode: multiply;
}

.drag-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 15px 20px;
    text-align: center;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s ease;
}

.drag-zone.drag-over {
    border-color: var(--brt-yellow);
    background: rgba(247, 202, 24, 0.08);
    color: #333;
}

.media-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 8px;
    margin-bottom: 10px;
    min-width: 0;
}
.media-item .flex-grow-1 {
    min-width: 0;
}
.media-item.has-preview {
    border-color: var(--brt-yellow);
    background: #fffdf0;
}

#openChecklistBtn {
    font-size: 1.05rem;
    white-space: nowrap;
    padding: 12px 20px;
    font-weight: 700;
}
@media (max-width: 768px) {
    #openChecklistBtn {
        font-size: 0.9rem;
        padding: 10px 15px;
    }
}
@media (max-width: 480px) {
    #openChecklistBtn {
        font-size: 0.8rem;
        padding: 8px 10px;
    }
}

/* File inputs inside media-item must be clean, border-free and aligned */
.media-item input[type="file"] {
    font-family: var(--bs-font-sans-serif) !important;
    font-size: 0.875rem !important;
    color: #4b5563 !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    align-self: center !important;
    flex-grow: 1 !important;
}

.media-item input[type="file"]::file-selector-button {
    background-color: #f3f4f6 !important;
    color: #1f2937 !important;
    border: 1px solid #d1d5db !important;
    padding: 6px 12px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 0.825rem !important;
    margin-right: 12px !important;
    transition: all 0.2s ease !important;
    cursor: pointer !important;
}

.media-item input[type="file"]::file-selector-button:hover {
    background-color: #e5e7eb !important;
    border-color: #9ca3af !important;
}

.photo-preview-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}
.video-info-badge {
    font-size: 0.8rem;
    color: #444;
    background: #f0f0f0;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* Checklist Checkboxes Base */
.checklist-table td input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--brt-yellow);
}

/* ====== OTIMIZAÇÃO EXTREMA PARA CELULAR (Tabelas -> Cards) ====== */
@media (max-width: 768px) {
    /* 1. Modal de Checklist */
    .checklist-table thead {
        display: none;
    }
    .checklist-table tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        padding: 8px;
        background: #fff;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    }
    .checklist-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none !important;
        padding: 12px 10px !important;
        border-bottom: 1px solid #f3f4f6 !important;
        background-color: #fff !important;
        -webkit-tap-highlight-color: transparent !important;
        transition: background-color 0.15s ease;
    }
    .checklist-table td:last-child {
        border-bottom: none !important;
    }
    .checklist-table td:has(input[type="checkbox"]:checked) {
        background-color: #fffdf0 !important;
    }
    .checklist-table.table-striped tbody tr:nth-of-type(odd) > * {
        background-color: transparent !important;
        box-shadow: none !important;
    }
    .checklist-table.table-hover tbody tr:hover > * {
        background-color: transparent !important;
        box-shadow: none !important;
    }
    .checklist-table td:first-child {
        display: block;
        font-weight: 700;
        font-size: 0.95rem;
        text-align: left;
        background-color: #f3f4f6 !important;
        border-left: 4px solid var(--brt-yellow) !important;
        color: #1f2937 !important;
        margin-bottom: 8px;
        padding: 10px 12px !important;
        border-radius: 4px;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }
    /* Rótulos automáticos via CSS para os Checkboxes */
    .checklist-table td:nth-child(2):before { content: "REVISAR"; font-weight: 600; font-size: 0.825rem; color: #4b5563; }
    .checklist-table td:nth-child(3):before { content: "TROCAR"; font-weight: 600; font-size: 0.825rem; color: #4b5563; }
    .checklist-table td:nth-child(4):before { content: "REGULAR"; font-weight: 600; font-size: 0.825rem; color: #4b5563; }
    .checklist-table td:nth-child(5):before { content: "INSPECIONAR"; font-weight: 600; font-size: 0.825rem; color: #4b5563; }
    
    .checklist-table td input[type="checkbox"] {
        transform: scale(1.3);
    }

    /* 2. Tabela de Inspeções (Painel Admin) */
    #inspecoesTable thead {
        display: none;
    }
    #inspecoesTable tbody tr {
        display: flex;
        flex-direction: column;
        margin-bottom: 15px;
        border: 1px solid #dee2e6;
        border-radius: 12px;
        padding: 15px;
        background: #fff;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    }
    #inspecoesTable td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border: none;
        padding: 8px 0;
        border-bottom: 1px dashed #eee;
    }
    #inspecoesTable td:last-child {
        border-bottom: none;
        justify-content: center;
        gap: 10px;
        margin-top: 10px;
    }
    #inspecoesTable td:nth-child(1):before { content: "Data/Hora:"; font-weight: 600; font-size: 0.85rem; color: #888; }
    #inspecoesTable td:nth-child(2):before { content: "Equipamento:"; font-weight: 600; font-size: 0.85rem; color: #888; }
    #inspecoesTable td:nth-child(3):before { content: "Máquina:"; font-weight: 600; font-size: 0.85rem; color: #888; }
    #inspecoesTable td:nth-child(4):before { content: "Operação:"; font-weight: 600; font-size: 0.85rem; color: #888; }
    #inspecoesTable td:nth-child(5):before { content: "Destino/Origem:"; font-weight: 600; font-size: 0.85rem; color: #888; }

    /* Modal Footer buttons responsiveness */
    #checklistModal .modal-footer {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }
    #checklistModal .modal-footer > button {
        width: 100% !important;
        margin: 0 !important;
    }

    /* Admin - cards de inspeção mais confortáveis no mobile */
    #inspecoesTable tbody tr {
        cursor: pointer;
        transition: box-shadow 0.2s ease;
    }
    body #inspecoesTable.table-hover > tbody > tr:hover > * {
        background-color: transparent !important;
        color: inherit !important;
        --bs-table-accent-bg: transparent !important;
        --bs-table-bg-state: transparent !important;
    }
    body #inspecoesTable tbody tr:hover {
        background-color: #fff !important;
        background: #fff !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
        transform: none !important;
    }
    #inspecoesTable td:last-child .btn {
        flex: 1;
        padding: 10px 0;
        font-size: 0.9rem;
    }

    /* Toolbar de filtros no mobile - empilha verticalmente */
    .card-body.d-flex.flex-wrap {
        flex-direction: column !important;
    }
    .card-body.d-flex.flex-wrap .input-group {
        width: 100% !important;
    }
    .card-body.d-flex.flex-wrap .btn-group {
        width: 100%;
        display: flex;
    }
    .card-body.d-flex.flex-wrap .btn-group .btn {
        flex: 1;
        font-size: 0.8rem;
        padding: 8px 4px;
    }

    /* Stats cards - 3 por linha no mobile */
    .col-6.col-md-4.col-xl-2 {
        width: calc(33.333% - 8px);
        flex: 0 0 calc(33.333% - 8px);
    }
}

/* ====== DESATIVA HOVER EM DISPOSITIVOS TOUCH (corrige "cinza travado") ====== */
@media (hover: none) {
    /* Tabela admin - sem hover em touch */
    .table-hover > tbody > tr:hover > * {
        background-color: transparent !important;
        color: inherit !important;
        --bs-table-accent-bg: transparent !important;
        --bs-table-bg-state: transparent !important;
    }

    /* Tabela de inspeções especificamente */
    #inspecoesTable tbody tr:hover {
        background-color: transparent !important;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05) !important;
    }

    /* Botões - sem hover stuck em touch */
    .btn:hover:not(:active) {
        opacity: 1 !important;
        filter: none !important;
    }

    /* Badges e cards - sem hover em touch */
    .card:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
}
