/* Chamados Page - Uses base.css design system */

/* Override body to use full width */
body {
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden;
}

/* Containers ocupam toda a largura */
.container, .container-fluid {
    width: 100% !important;
    max-width: 100vw !important;
    padding-left: 2vw !important;
    padding-right: 2vw !important;
    margin: 0 !important;
}

/* Header específico para chamados */
.chamados-header {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 1.5rem 2vw 1rem 2vw;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.chamados-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text-primary);
}

.chamados-header p {
    font-size: 1rem;
    opacity: 0.8;
    margin: 0;
    color: var(--text-secondary);
}

/* Override stats cards backgrounds */
.bg-primary.stats-card {
    background: var(--primary) !important;
    color: var(--white) !important;
}

.bg-success.stats-card {
    background: var(--success) !important;
    color: var(--white) !important;
}

.bg-warning.stats-card {
    background: var(--warning) !important;
    color: var(--white) !important;
}

.bg-info.stats-card {
    background: var(--info) !important;
    color: var(--white) !important;
}

.bg-danger.stats-card {
    background: var(--danger) !important;
    color: var(--white) !important;
}

.bg-gradient.stats-card {
    background: var(--gradient-primary) !important;
    color: var(--white) !important;
}

/* Table específico para chamados */
.chamados-table-container {
    background: var(--white);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    width: 100%;
}

.table-responsive {
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.ultra-compact-table th,
.ultra-compact-table td {
    padding: 0.4rem 0.3rem;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border-light);
}

.ultra-compact-table th {
    background: var(--gradient-header);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 0.75rem;
}

.ultra-compact-table tbody tr:hover {
    background: var(--gray-50);
}

/* Text styles */
.text-compact {
    font-size: 0.8rem;
    line-height: 1.2;
    color: var(--text-primary);
    word-break: break-word;
}

.multi-line-text {
    font-size: 0.75rem;
    line-height: 1.3;
    max-height: 60px;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    padding: 0.15rem 0.3rem;
    color: var(--text-primary);
    word-wrap: break-word;
    white-space: pre-wrap;
}

/* Badges específicos */
.badge-tiny {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    border-radius: var(--radius-sm);
}

.horas-trabalhadas, .horas-calculadas {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 50px;
}

.valor-reais {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 70px;
    background: var(--gray-800) !important;
    color: var(--white) !important;
}

.valor-numero {
    font-weight: 700;
}

/* Input de desconto */
.desconto-input {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    background: var(--white) !important;
    font-size: 0.85rem;
    padding: 0.1rem 0.2rem;
    text-align: center;
    transition: border-color 0.2s;
}

.desconto-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* Loading e estados */
#loadingSpinner {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    color: var(--primary);
}

.no-data {
    text-align: center;
    padding: 2.5rem 0;
    color: var(--text-muted);
    font-size: 1rem;
}

/* Info e contadores */
#infoExibicao, #contadorFiltrados {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Botões de filtro - CORRIGIDO */
#btnAplicarFiltros {
    background: #2563eb !important;
    border: 1px solid #2563eb !important;
    color: white !important;
    font-weight: 500;
    transition: all 0.2s ease;
}

#btnAplicarFiltros:hover {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: white !important;
    transform: translateY(-1px);
}

#btnAplicarFiltros:focus {
    background: #1d4ed8 !important;
    border-color: #1d4ed8 !important;
    color: white !important;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25) !important;
}

#btnAplicarFiltros:active {
    background: #1e40af !important;
    border-color: #1e40af !important;
    color: white !important;
}

/* Botão limpar filtros */
#btnLimparFiltros {
    background: white !important;
    border: 1px solid #d1d5db !important;
    color: #374151 !important;
    font-weight: 500;
    transition: all 0.2s ease;
}

#btnLimparFiltros:hover {
    background: #f9fafb !important;
    border-color: #9ca3af !important;
    color: #374151 !important;
    transform: translateY(-1px);
}

/* Remove qualquer background conflitante */
.btn-primary, #btnAplicarFiltros {
    background: #2563eb !important;
    background-image: none !important;
    background-color: #2563eb !important;
}

/* Remove gradientes conflitantes */
.bg-gradient, .btn-primary.bg-gradient {
    background: none !important;
    background-image: none !important;
}

/* Garante que todos os botões sejam visíveis */
.btn {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Remove qualquer override que possa estar ocultando */
.page-header, .stat-card, .stat-card .icon, .btn-primary, #btnAplicarFiltros, .bg-gradient, .stats-card.bg-gradient .card-body .bi-cash-stack {
    /* Remove apenas animações problemáticas, mantém backgrounds */
    animation: none !important;
}

/* Action section melhor organizada */
.action-section {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Ajustes nos inputs e selects da action section */
.action-section .form-control,
.action-section .form-select {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.action-section .form-control:focus,
.action-section .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Labels mais organizados */
.action-section .form-label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.25rem;
}

/* Botões de ação melhor espaçados */
.action-section .btn {
    white-space: nowrap;
    transition: all 0.2s ease;
}

.action-section .btn:hover {
    transform: translateY(-1px);
}

/* Input de valor por hora destacado */
#inputValorHora {
    border: 2px solid #d1d5db;
    font-weight: 600;
    background: #f8fafc;
}

#inputValorHora:focus {
    border-color: #667eea;
    background: white;
}

/* Responsividade melhorada */
@media (max-width: 768px) {
    .action-section {
        padding: 0.75rem;
    }
    
    .action-section .d-flex.gap-1 {
        gap: 0.25rem !important;
    }
    
    .action-section .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem !important;
    }
}

/* Responsivo */
@media (max-width: 900px) {
    .container, .container-fluid, .chamados-header, .action-section, .chamados-table-container {
        padding-left: 1vw !important;
        padding-right: 1vw !important;
    }
}

@media (max-width: 600px) {
    .container, .container-fluid, .chamados-header, .action-section, .chamados-table-container {
        padding-left: 0.5vw !important;
        padding-right: 0.5vw !important;
    }
    
    .chamados-header h1 {
        font-size: 1.1rem;
    }
    
    .stats-card .card-body {
        padding: 0.5rem;
    }
    
    .table th, .table td {
        font-size: 0.8rem;
    }
}

/* No data state */
.no-data {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.no-data .display-1 {
    opacity: 0.5;
}

/* Filtros com labels */
.row.mb-3 .form-label {
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 0.25rem !important;
}

.row.mb-3 .form-control {
    border-radius: 6px;
    border: 1px solid #d1d5db;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.row.mb-3 .form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

#btnLimparFiltros {
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    margin-top: 0.25rem;
}

#btnLimparFiltros:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
}

/* Campo de desconto editável */
.desconto-input {
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    transition: all 0.3s ease;
}

.desconto-input:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25) !important;
}

.desconto-input:hover {
    border-color: #9ca3af !important;
}

/* Truncate text para descrição */
.text-truncate-custom {
    max-width: 200px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Estilo para descrição completa */
.descricao-completa {
    max-height: 120px;
    overflow-y: auto;
    font-size: 0.875rem;
    padding: 0.25rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.descricao-completa::-webkit-scrollbar {
    width: 4px;
}

.descricao-completa::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.descricao-completa::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.descricao-completa::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Badge para horas trabalhadas */
.horas-trabalhadas {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 50px;
}

/* Ícone de ajudante nas horas */
.horas-trabalhadas .bi-people-fill {
    color: rgba(255, 255, 255, 0.8);
}

/* Badge vermelho para chamados com menos de 10 minutos */
.horas-trabalhadas.bg-danger {
    background-color: #dc3545 !important;
    animation: pulse-danger 2s infinite;
}

@keyframes pulse-danger {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Badge para horas calculadas */
.horas-calculadas {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 60px;
    transition: all 0.3s ease;
}

/* Ícones nas horas calculadas */
.horas-calculadas .bi-people-fill,
.horas-calculadas .bi-percent {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.7rem;
    transition: opacity 0.3s ease;
}

/* Animação para atualização */
.horas-calculadas.atualizando {
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

/* Ajuste na largura das colunas de data/hora e horas */
.compact-table th:nth-child(6),
.compact-table th:nth-child(7) {
    min-width: 120px;
}

.compact-table td:nth-child(6),
.compact-table td:nth-child(7) {
    min-width: 120px;
    font-size: 0.8rem;
}

.compact-table th:nth-child(8),
.compact-table th:nth-child(9) {
    min-width: 80px;
}

/* Badge para valor em reais */
.valor-reais {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 70px;
    background-color: #343a40 !important;
}

.valor-reais .bi-currency-dollar {
    color: rgba(255, 255, 255, 0.8);
}

.valor-numero {
    font-weight: 700;
}

/* Estilo para o input de valor por hora */
#inputValorHora {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    height: 1.5rem;
}

#inputValorHora:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Ajuste para o card gradiente */
.bg-gradient {
    position: relative;
    overflow: hidden;
}

.bg-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.9;
    z-index: 1;
}

.bg-gradient .card-body {
    position: relative;
    z-index: 2;
}

/* Animação para o card de valor total */
.stats-card.bg-gradient .card-body .bi-cash-stack {
    animation: pulse-money 2s infinite;
}

@keyframes pulse-money {
    0%, 100% {
        transform: scale(1);
        color: rgba(255, 255, 255, 1);
    }
    50% {
        transform: scale(1.1);
        color: rgba(255, 255, 255, 0.8);
    }
}

/* Ultra compact table styles */
.ultra-compact-table {
    margin: 0;
    font-size: 0.8rem; /* Aumentado de 0.7rem para 0.8rem */
}

.ultra-compact-table th,
.ultra-compact-table td {
    padding: 0.35rem 0.4rem; /* Aumentado padding de 0.25rem 0.3rem */
    border-bottom: 1px solid #e5e7eb;
    line-height: 1.2; /* Aumentado de 1.1 para 1.2 */
    vertical-align: middle;
}

.ultra-compact-table th {
    background: #f8fafc;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-size: 0.75rem; /* Aumentado de 0.65rem para 0.75rem */
    padding: 0.3rem 0.4rem; /* Aumentado padding */
}

/* Compact text styles */
.text-compact {
    font-size: 0.8rem; /* Aumentado de 0.7rem para 0.8rem */
    line-height: 1.2; /* Aumentado de 1.1 para 1.2 */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Multi-line text for descriptions */
.multi-line-text {
    font-size: 0.75rem; /* Aumentado de 0.65rem para 0.75rem */
    line-height: 1.3; /* Aumentado de 1.2 para 1.3 */
    max-height: 60px;
    overflow-y: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    padding: 0.15rem; /* Aumentado padding */
    background-color: #f8f9fa;
    border-radius: 2px;
    border: 1px solid #e9ecef;
}

/* Tiny badges */
.badge-tiny {
    font-size: 0.7rem; /* Aumentado de 0.6rem para 0.7rem */
    padding: 0.2rem 0.4rem; /* Aumentado padding */
    border-radius: 3px;
}

/* Badge para horas trabalhadas ultra compacto */
.horas-trabalhadas.badge-tiny {
    min-width: 40px; /* Aumentado de 35px */
}

/* Badge para horas calculadas ultra compacto */
.horas-calculadas.badge-tiny {
    min-width: 45px; /* Aumentado de 40px */
}

/* Ícones nas horas calculadas ultra compactos */
.horas-calculadas.badge-tiny .bi-people-fill,
.horas-calculadas.badge-tiny .bi-percent {
    font-size: 0.6rem; /* Aumentado de 0.5rem */
    margin-left: 0.1rem;
}

/* Badge para valor em reais ultra compacto */
.valor-reais.badge-tiny {
    min-width: 65px; /* Aumentado de 60px */
    background-color: #343a40 !important;
}

/* Action section mais compacta - removida margin-bottom */
.action-section {
    background: white;
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.5rem; /* Reduzido de 1rem para 0.5rem */
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Ajustes de espaçamento mínimo */
.container-fluid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.row.mb-2 {
    margin-bottom: 0.3rem !important; /* Reduzido de 0.5rem */
}

/* Status badges específicos */
.badge.bg-warning {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.badge.bg-info {
    background-color: #0dcaf0 !important;
    color: #000 !important;
}

.badge.bg-success {
    background-color: #198754 !important;
    color: #fff !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
    color: #fff !important;
}

/* Ícones nos badges de status */
.badge-tiny .bi {
    font-size: 0.6rem;
    margin-right: 0.1rem;
}

/* Chamados Page - Uses base.css design system */

.chamados-header {
    @extend .header-section;
}

.action-section {
    @extend .action-section;
}

.chamados-table-container {
    @extend .table-container;
}
.chamados-table-container {
    /* Use centralized table container styles */
    @extend .table-container;
}
    transition: transform 0.2s ease;
    margin-bottom: 0.5rem;
}

.stats-card:hover {
    transform: translateY(-1px);
}

/* Table container compacto */
.chamados-table-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Paginação compacta */
.pagination-sm .page-link {
    padding: 0.15rem 0.3rem;
    font-size: 0.65rem;
    border-radius: 3px;
}

.pagination-sm .page-item:not(:first-child) .page-link {
    margin-left: 1px;
}

.pagination-sm .page-item.active .page-link {
    background-color: #667eea;
    border-color: #667eea;
}

/* Loading spinner */
#loadingSpinner {
    background-color: rgba(248, 250, 252, 0.9);
    border-radius: 4px;
}

/* Info de paginação */
#infoExibicao {
    white-space: nowrap;
}

/* Contador filtrados */
#contadorFiltrados {
    font-weight: normal;
}

/* Botões de filtro */
#btnAplicarFiltros {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

#btnAplicarFiltros:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

/* Chamados Page - Uses base.css design system */

.action-section {
    /* Use centralized action section styles */
    @extend .action-section;
}

.chamados-table-container {
    /* Use centralized table container styles */
    @extend .table-container;
}

/* Small items per page selector in table header */
.chamados-table-container .form-select-sm {
    border: 1px solid #d1d5db;
    border-radius: 3px;
    background: white;
    transition: all 0.2s ease;
}

.chamados-table-container .form-select-sm:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.1rem rgba(102, 126, 234, 0.25);
}

.chamados-table-container .form-select-sm:hover {
    border-color: #9ca3af;
}

/* Table header improvements */
.chamados-table-container .bg-primary-light {
    background: #f8fafc !important;
    border-bottom: 1px solid #e5e7eb;
}

.chamados-table-container .text-primary-dark {
    color: #374151 !important;
}

/* Better spacing in table header */
.chamados-table-container .d-flex.align-items-center.gap-2 {
    flex-wrap: wrap;
}

/* Responsive adjustments for table header */
@media (max-width: 768px) {
    .chamados-table-container .d-flex.justify-content-between {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start !important;
    }
    
    .chamados-table-container .d-flex.align-items-center.gap-2 {
        justify-content: space-between;
        width: 100%;
    }
}
