/* Custom Styles for Heineken Placas System */

:root {
    --heineken-primary: #008200;
    --heineken-secondary: #1e3a8a;
    --heineken-accent: #059669;
    --heineken-warning: #d97706;
    --heineken-danger: #dc2626;
    --heineken-light: #f8fafc;
    --heineken-dark: #1e293b;
}

body {
    background-color: var(--heineken-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Navbar Customization */
.navbar-dark.bg-primary {
    background-color: var(--heineken-primary) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Logo Styling */
.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    height: 70px;
}

/* Logo Transportadora - Mantém cores originais */
.transportadora-logo {
    min-width: 90px;
}

.transportadora-logo-img {
    max-height: 70px;
    max-width: 90px;
    object-fit: contain;
    transition: all 0.3s ease;
    /* Sem filtro para manter cores originais */
}

.transportadora-logo-img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

.fallback-logo-transportadora {
    font-size: 2.2rem;
    color: #ffffff;
}

/* Logo Heineken - Mantém cores originais */
.heineken-logo-img {
    max-height: 60px;
    max-width: 80px;
    object-fit: contain;
    transition: all 0.3s ease;
    /* Sem filtro para manter cores originais */
}

.heineken-logo-img:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

.fallback-logo-heineken {
    font-size: 2.5rem;
    color: #ffffff;
}

.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.brand-text span:first-child {
    color: #ffffff;
    font-size: 1.2em;
}

.brand-text span:last-child {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9em;
}

/* Card Enhancements */
.card {
    border-radius: 12px;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Button Enhancements */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: var(--heineken-primary);
    border-color: var(--heineken-primary);
}

.btn-primary:hover {
    background-color: #006600;
    border-color: #006600;
}

.btn-success {
    background-color: var(--heineken-accent);
    border-color: var(--heineken-accent);
}

.btn-success:hover {
    background-color: #047857;
    border-color: #047857;
}

.btn-outline-primary {
    color: var(--heineken-primary);
    border-color: var(--heineken-primary);
}

.btn-outline-primary:hover {
    background-color: var(--heineken-primary);
    border-color: var(--heineken-primary);
}

/* Form Enhancements */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    transition: all 0.3s ease;
    padding: 0.75rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--heineken-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 130, 0, 0.25);
}

.form-label {
    color: var(--heineken-dark);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Table Enhancements */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    background-color: #f8fafc;
    border: none;
    font-weight: 600;
    color: var(--heineken-dark);
    padding: 0.5rem;
    font-size: 0.9rem;
}

.table tbody td {
    padding: 0.5rem;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 0.9rem;
}

/* Tabela de Placas - MEGA compacta */
.table-placas {
    font-size: 0.7rem;
}

.table-placas thead th {
    padding: 0.2rem 0.15rem;
    font-size: 0.65rem;
    text-align: center;
    min-width: 30px;
    vertical-align: middle;
    position: relative;
}

.table-placas tbody td {
    padding: 0.15rem 0.1rem;
    font-size: 0.65rem;
    text-align: center;
    min-width: 30px;
}

.table-placas .placa-info {
    padding: 0.3rem 0.2rem;
    text-align: left;
    min-width: 80px;
    max-width: 80px;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Colunas fixas mais compactas */
.table-placas .sticky-col {
    min-width: 60px;
    max-width: 60px;
    font-size: 0.7rem;
    padding: 0.3rem 0.2rem;
}

.table-placas .sticky-col-2 {
    min-width: 70px;
    max-width: 70px;
    font-size: 0.7rem;
    padding: 0.3rem 0.2rem;
}

.table-placas .status-cell {
    padding: 0.1rem;
    text-align: center;
    min-width: 28px;
    max-width: 32px;
    vertical-align: middle;
    position: relative;
    white-space: nowrap;
}

.table-placas .status-badge {
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.table-placas .status-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Estilo para os dropdowns de status */
.table-placas .status-select {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    color: inherit;
    font-size: 0.7rem;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    outline: none;
    padding: 0;
    margin: 0;
    border-radius: 3px;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1px center;
    background-size: 10px;
    padding-right: 18px;
}

.table-placas .status-select:focus {
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.table-placas .status-select option {
    background: white;
    color: #333;
    font-size: 0.8rem;
    padding: 8px 12px;
    font-weight: normal;
}

.table-placas .status-select option[value="D"] {
    background: #28a745;
    color: white;
}

.table-placas .status-select option[value="ND"] {
    background: #dc3545;
    color: white;
}

.table-placas .status-select option[value="C"] {
    background: #ffc107;
    color: #212529;
}

.table-placas .status-select option[value=""] {
    background: #f8f9fa;
    color: #6c757d;
}

/* Indicador de motivo para status ND */
.table-placas .motivo-indicator {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    color: #dc3545;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s ease;
}

.table-placas .motivo-indicator:hover {
    background: white;
    transform: scale(1.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Tooltip para mostrar motivo */
.motivo-tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    z-index: 10001;
    max-width: 250px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.motivo-tooltip.show {
    opacity: 1;
}

.motivo-tooltip::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: #333;
}

/* Tooltip para status e equipe */
.status-tooltip {
    position: fixed;
    background: #2d3748;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 10002;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 1px solid #4a5568;
}

.status-tooltip.show {
    opacity: 1;
}

.status-tooltip::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-bottom-color: #2d3748;
}

.status-tooltip .tooltip-header {
    font-weight: bold;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #4a5568;
}

.status-tooltip .tooltip-status {
    margin-bottom: 4px;
}

.status-tooltip .tooltip-equipe {
    font-size: 12px;
    color: #e2e8f0;
}

.status-tooltip .tooltip-equipe .equipe-item {
    margin-bottom: 2px;
}

.status-tooltip .tooltip-equipe .equipe-label {
    font-weight: 600;
    color: #a0aec0;
}

/* Melhorar hover das células de status */
.table-placas .status-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    position: relative;
}

/* Removido: estilos de destaque de coluna para manter cores originais dos status */

/* Estilo para quando apenas um dia está visível */
.table-placas .status-cell[style*="display: none"] {
    display: none !important;
}

.table-placas th[style*="display: none"] {
    display: none !important;
}

/* Design Responsivo - Tabela de Placas */
.table-placas {
    width: 100%;
    min-width: 1200px; /* Largura mínima para caber todos os dias do mês */
    font-size: 0.85rem;
    table-layout: fixed; /* Força largura fixa das colunas */
}

.table-placas .status-cell {
    min-width: 35px;
    width: 35px;
    max-width: 35px;
    font-size: 0.75rem;
    padding: 0.2rem;
    text-align: center;
    vertical-align: middle;
    overflow: hidden;
}

/* Colunas de dias com largura fixa */
.table-placas th[data-dia],
.table-placas .status-cell[data-dia] {
    min-width: 35px;
    width: 35px;
    max-width: 35px;
}

/* Container responsivo para a tabela */
.table-responsive-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* Garantir que a tabela não seja cortada */
.table-responsive-container::-webkit-scrollbar {
    height: 8px;
}

.table-responsive-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-responsive-container::-webkit-scrollbar-thumb {
    background: var(--heineken-primary);
    border-radius: 4px;
}

.table-responsive-container::-webkit-scrollbar-thumb:hover {
    background: #006600;
}

/* Indicador de scroll horizontal */
.table-responsive-container::after {
    content: '← Role para ver mais dias →';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--heineken-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.8;
    pointer-events: none;
    z-index: 10;
}

/* Esconder indicador quando não há scroll */
.table-responsive-container:not(.has-scroll)::after {
    display: none;
}

/* Responsividade para diferentes tamanhos de tela */
@media (max-width: 1200px) {
    .table-placas {
        font-size: 0.8rem;
    }
    
    .table-placas .status-cell {
        min-width: 40px;
        width: 40px;
        max-width: 40px;
        font-size: 0.75rem;
        padding: 0.2rem;
    }
}

@media (max-width: 768px) {
    .table-placas {
        font-size: 0.75rem;
        min-width: 600px;
    }
    
    .table-placas .status-cell {
        min-width: 35px;
        width: 35px;
        max-width: 35px;
        font-size: 0.7rem;
        padding: 0.15rem;
    }
    
    .table-placas th {
        font-size: 0.7rem;
        padding: 0.3rem 0.2rem;
    }
    
    .table-placas td {
        padding: 0.2rem;
    }
}

@media (max-width: 576px) {
    .table-placas {
        font-size: 0.7rem;
        min-width: 500px;
    }
    
    .table-placas .status-cell {
        min-width: 30px;
        width: 30px;
        max-width: 30px;
        font-size: 0.65rem;
        padding: 0.1rem;
    }
    
    .table-placas th {
        font-size: 0.65rem;
        padding: 0.25rem 0.1rem;
    }
    
    .table-placas td {
        padding: 0.15rem 0.1rem;
    }
}

/* Alinhamento perfeito entre datas e quadradinhos */
.table-placas th:not(.placa-info) {
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.table-placas td:not(.placa-info) {
    text-align: center;
    vertical-align: middle;
    position: relative;
}

/* Garantir que os quadradinhos fiquem centralizados nas células */
.table-placas .status-cell {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
    height: 100%;
    position: relative;
    overflow: visible;
    cursor: pointer;
    user-select: none;
}

/* Garantir que o conteúdo da célula ocupe toda a área */
.table-placas .status-cell .status-text {
    display: block;
    width: 100%;
    height: 100%;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsividade para filtros e controles */
@media (max-width: 768px) {
    .filtros-container {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .filtros-container .col-md-2,
    .filtros-container .col-md-3 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
    
    .btn-group .btn {
        font-size: 0.8rem;
        padding: 0.375rem 0.75rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
}

@media (max-width: 576px) {
    .filtros-container .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    .form-label {
        font-size: 0.8rem;
        margin-bottom: 0.25rem;
    }
    
    .form-select,
    .form-control {
        font-size: 0.8rem;
        padding: 0.375rem 0.5rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .navbar-nav .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Responsividade para cards de resumo */
@media (max-width: 768px) {
    .resumo-cards .col-md-4 {
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 0.9rem;
    }
    
    .display-6 {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .resumo-cards .col-md-4 {
        margin-bottom: 0.75rem;
    }
    
    .card-title {
        font-size: 0.8rem;
    }
    
    .display-6 {
        font-size: 1.25rem;
    }
    
    .card-body {
        padding: 0.75rem 0.5rem;
    }
}

/* Estilos específicos para dispositivos móveis */
.mobile-device .table-placas {
    font-size: 0.7rem;
    min-width: 500px;
}

.mobile-device .table-placas .status-cell {
    min-width: 30px;
    width: 30px;
    max-width: 30px;
    font-size: 0.65rem;
    padding: 0.1rem;
}

.mobile-device .table-placas th {
    font-size: 0.65rem;
    padding: 0.25rem 0.1rem;
}

.mobile-device .table-placas td {
    padding: 0.15rem 0.1rem;
}

.mobile-device .filtros-container {
    flex-direction: column !important;
    gap: 0.5rem !important;
}

.mobile-device .filtros-container .col-md-2,
.mobile-device .filtros-container .col-md-3,
.mobile-device .filtros-container .col-md-4 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

.mobile-device .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

.mobile-device .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.mobile-device .form-select,
.mobile-device .form-control {
    font-size: 0.8rem;
    padding: 0.375rem 0.5rem;
}

.mobile-device .navbar-brand {
    font-size: 1rem;
}

.mobile-device .navbar-nav .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
}

/* Melhorar scroll horizontal em mobile */
.mobile-device .table-responsive-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Tooltip otimizado para mobile */
.mobile-device .status-tooltip {
    font-size: 0.8rem;
    padding: 0.5rem;
    max-width: 200px;
}

/* Ícones da equipe em branco para maior destaque */
.table-placas .bi-people {
    color: white !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.table-placas .btn .bi-people {
    color: inherit !important;
    filter: none;
}

/* Botão de gerenciar equipe com ícone branco */
.table-placas .btn-outline-secondary .bi-people {
    color: #6c757d !important;
}

.table-placas .btn-outline-secondary:hover .bi-people {
    color: white !important;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Badge Enhancements */
.badge {
    font-size: 0.75em;
    padding: 0.5em 0.75em;
    border-radius: 6px;
    font-weight: 500;
}

.badge.bg-success {
    background-color: var(--heineken-accent) !important;
}

.badge.bg-warning {
    background-color: var(--heineken-warning) !important;
    color: white !important;
}

.badge.bg-primary {
    background-color: var(--heineken-secondary) !important;
}

.badge.bg-secondary {
    background-color: #64748b !important;
}

/* Alert Enhancements */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.25rem;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Icon Enhancements */
.bi {
    vertical-align: middle;
}

/* Page Header */
.h2 {
    color: var(--heineken-dark);
    font-weight: 600;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .table-responsive {
        border-radius: 8px;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: var(--heineken-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #006600;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--heineken-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-available {
    background-color: var(--heineken-accent);
}

.status-unavailable {
    background-color: var(--heineken-warning);
}

.status-loaded {
    background-color: var(--heineken-secondary);
}

/* Quick Actions Grid */
.quick-actions .btn {
    margin-bottom: 0.5rem;
}

/* Footer */
footer {
    margin-top: auto;
    border-top: 1px solid #e2e8f0;
}

/* Form Validation Styles */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: var(--heineken-danger);
    box-shadow: 0 0 0 0.2rem rgba(220, 38, 38, 0.25);
}

.invalid-feedback {
    color: var(--heineken-danger);
    font-size: 0.875em;
    margin-top: 0.25rem;
}

/* Modal Enhancements */
.modal-content {
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 12px 12px;
}

/* Logo Carsten para tela de login */
.carsten-logo {
/* Estilos específicos para logo Carsten */
}

.carsten-logo-img {
    max-height: 120px;
    max-width: 200px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.carsten-logo-img:hover {
    transform: scale(1.05);
}

.fallback-logo-carsten {
    font-size: 80px;
    color: #6c757d;
}

/* Inline Styles Moved to CSS Classes */
.filtro-dia-info {
    display: none;
}

.mes-select {
    max-width: 240px;
}

.badge-mudancas {
    display: none;
}

.table-header-tipo {
    min-width: 70px;
}

.table-header-unidade {
    min-width: 100px;
}

.table-header-placa {
    min-width: 110px;
}

.table-header-equipe {
    min-width: 90px;
}

.table-header-dia {
    min-width: 40px;
}

.table-header-disp {
    min-width: 50px;
}

.table-header-indisp {
    min-width: 50px;
}

.table-header-carg {
    min-width: 50px;
}

.icon-people-small {
    font-size: 0.7rem;
}

.status-popup {
    display: none;
    position: fixed;
    z-index: 10000;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.motivo-select {
    display: none;
}

.fallback-logo {
    display: none;
}

.motivo-group {
    display: none;
}

.motivo-group.show {
    display: block;
}

.icon-large {
    font-size: 4rem;
}

/* Status popup styles */
.status-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

.status-option:hover {
    background-color: #f8f9fa;
}

.status-option.selected {
    background-color: #007bff;
    color: white;
}

.status-option.status-D {
    background-color: #d4edda;
    color: #155724;
}

.status-option.status-ND {
    background-color: #f8d7da;
    color: #721c24;
}

.status-option.status-C {
    background-color: #fff3cd;
    color: #856404;
}
