/**
 * Estilos personalizados para o Sistema de Testes de Automação Residencial
 */

/* Ajustes gerais */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* Estilização de status */
.status-badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    display: inline-block;
}

.status-pendente {
    background-color: #f8f9fa;
    color: #fd7e14;
    border: 1px solid #fd7e14;
}

.status-concluido, .status-completo {
    background-color: #f8f9fa;
    color: #198754;
    border: 1px solid #198754;
}

.status-nao_concluido, .status-falhou {
    background-color: #f8f9fa;
    color: #dc3545;
    border: 1px solid #dc3545;
}

/* Cards na dashboard */
.dashboard-card {
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 20px;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.dashboard-card .card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dashboard-card .card-icon {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

/* Área de checklist */
.checklist-area {
    margin-bottom: 30px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    background-color: #f8f9fa;
}

.checklist-area-title {
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #0d6efd;
    padding-bottom: 8px;
    margin-bottom: 15px;
    color: #0d6efd;
}

.checklist-item {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    transition: background-color 0.2s;
}

.checklist-item:hover {
    background-color: #f1f3f5;
}

.checklist-item.active {
    border-left: 5px solid #0d6efd;
}

/* Formulários */
.form-card {
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.form-card .card-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
}

/* Tabelas */
.table-responsive {
    margin-bottom: 30px;
}

.table-actions {
    white-space: nowrap;
}

/* Paginação customizada */
.pagination {
    justify-content: center;
    margin-top: 20px;
}

/* Animações */
.fade-in {
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

/* Responsividade */
@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .checklist-item {
        padding: 10px;
    }
}

/* Estilos para o modal de visualização de imagem */
#imageModal .modal-body {
    text-align: center;
}

#imageModal img {
    max-width: 100%;
}

/* Estatísticas */
.stats-card {
    margin-bottom: 20px;
}

.stats-card .card-body {
    padding: 20px;
}

.stats-number {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0;
}

.stats-label {
    font-size: 0.9rem;
    color: #6c757d;
    text-transform: uppercase;
}

/* Barra de progresso */
.progress {
    height: 10px;
    margin-top: 5px;
}

/* Filtros */
.filters-container {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    background-color: #f8f9fa;
}

/* Login e registro */
.login-container {
    max-width: 400px;
    margin: 50px auto;
}

/* Responsividade para dispositivos móveis */
@media (max-width: 767px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
    }
    
    .table td, .table th {
        padding: 0.5rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .container, .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    /* Formulários em dispositivos móveis */
    input, select, textarea, .form-control {
        font-size: 16px !important; /* Previne zoom em iOS */
        height: auto;
    }
    
    .btn {
        min-height: 38px; /* Altura mínima para fácil toque */
    }
}

/* Estilos específicos para telas muito pequenas (iPhone SE, etc) */
@media (max-width: 375px) {
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    h1 {
        font-size: 1.6rem;
    }
    
    h2 {
        font-size: 1.4rem;
    }
}

/* Circular chart para exibir porcentagens */
.circular-chart {
    width: 100%;
    height: 100%;
}

circle.circle-bg {
    fill: none;
    stroke: rgba(13, 110, 253, 0.1);
    stroke-width: 3.8;
}

circle.circle-progress {
    fill: none;
    stroke: #0d6efd;
    stroke-width: 3.8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1s ease;
}

circle.circle-progress.success {
    stroke: #28a745;
}

circle.circle-progress.warning {
    stroke: #ffc107;
}

circle.circle-progress.danger {
    stroke: #dc3545;
}

/* Correções para o flatpickr calendar */
.flatpickr-calendar {
    opacity: 0;
    display: none;
    text-align: center;
    visibility: hidden;
    padding: 0;
    animation: none;
    direction: ltr;
    border: 0;
    font-size: 14px;
    line-height: 24px;
    border-radius: 5px;
    position: absolute;
    width: 307.875px;
    box-sizing: border-box;
    touch-action: manipulation;
    background: #fff;
    box-shadow: 0 3px 13px rgba(0,0,0,0.08);
}

.flatpickr-calendar.open,
.flatpickr-calendar.inline {
    opacity: 1;
    visibility: visible;
    overflow: hidden;
    max-height: 640px;
    z-index: 99999 !important;
}

.flatpickr-calendar.animate.open {
    -webkit-animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
    animation: fpFadeInDown 300ms cubic-bezier(0.23, 1, 0.32, 1);
    display: block !important;
    transform: none !important;
}

@keyframes fpFadeInDown {
    from {
        opacity: 0;
        transform: translate3d(0, -20px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.flatpickr-day.selected, 
.flatpickr-day.startRange, 
.flatpickr-day.endRange {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.flatpickr-day:hover {
    background-color: #e9ecef;
}

.flatpickr-day.today {
    border-color: #0d6efd;
    color: #0d6efd;
    font-weight: bold;
}

/* Estado vazio - quando não há dados */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 30px 20px;
    background-color: rgba(0,0,0,0.02);
    border-radius: 8px;
    margin-bottom: 20px;
}

.empty-state-icon {
    font-size: 40px;
    color: #6c757d;
    opacity: 0.3;
    margin-bottom: 15px;
}

/* Connection Status */
.connection-status {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background-color: #f44336;
    color: white;
    text-align: center;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    z-index: 2000;
    font-weight: 500;
}

.connection-status.show {
    transform: translateY(0);
}

.connection-status.online {
    background-color: #4CAF50;
}

/* Garantir que o menu sanduíche e o dropdown fiquem acima de outros elementos */
.navbar-toggler {
    z-index: 1050; /* Valor alto para garantir que esteja acima de outros elementos */
}

.collapse {
    position: relative;
    z-index: 1040; /* Garantir que o menu dropdown esteja acima do conteúdo principal */
}

.dropdown-menu {
    z-index: 1060; /* Garantir que o menu dropdown esteja acima de outros elementos */
}

/* ------- NOVO DASHBOARD MOBILE ------- */

/* Container principal do dashboard */
.dashboard-mobile {
    padding: 15px;
    background-color: #f8f9fc;
    position: relative;
}

/* Cabeçalho de boas-vindas */
.mobile-welcome {
    margin-bottom: 16px;
    padding: 12px;
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
}

.mobile-welcome h1 {
    font-size: 20px;
    margin-bottom: 4px;
    font-weight: 700;
    color: #333;
}

.mobile-welcome p {
    font-size: 13px;
    margin-bottom: 0;
    color: #6c757d;
}

/* Cards de estatísticas */
.mobile-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.mobile-stats-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: white;
    border-radius: 16px;
    padding: 15px 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-align: center;
    overflow: hidden;
    position: relative;
}

.mobile-stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: currentColor;
    opacity: 0.7;
}

.mobile-stats-card:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.mobile-stats-card i {
    font-size: 20px;
    margin-bottom: 8px;
}

.mobile-stats-card h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 2px 0;
    line-height: 1.2;
}

.mobile-stats-card p {
    font-size: 12px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* Gráfico de eficácia */
.mobile-efficacy-card {
    margin-bottom: 16px;
    text-align: center;
    background-color: white;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.mobile-efficacy-chart-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
}

.mobile-efficacy-chart {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.mobile-efficacy-chart svg {
    transform: rotate(-90deg);
}

.mobile-efficacy-chart-center {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    z-index: 2;
}

.mobile-efficacy-percentage {
    font-size: 24px;
    font-weight: 700;
    color: #333;
}

.mobile-efficacy-card h4 {
    font-size: 16px;
    margin-top: 10px;
    margin-bottom: 4px;
    font-weight: 600;
    color: #333;
}

.mobile-efficacy-card p {
    font-size: 13px;
    color: #6c757d;
}

/* Cabeçalhos de seção */
.mobile-section-header {
    margin: 24px 0 16px 0;
    padding: 0 5px;
}

.mobile-section-header h2 {
    font-size: 17px;
    font-weight: 700;
    color: #333;
    margin: 0;
    display: flex;
    align-items: center;
}

.mobile-section-header h2 i {
    margin-right: 8px;
    color: #0d6efd;
}

/* Cards de checklist */
.mobile-checklist-cards {
    margin-bottom: 16px;
}

.mobile-checklist-card {
    display: flex;
    background-color: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    margin-bottom: 12px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mobile-checklist-card:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.mobile-checklist-status {
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.mobile-checklist-status.status-completo {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.mobile-checklist-status.status-pendente {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.mobile-checklist-status.status-falhou {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.mobile-checklist-card-content {
    flex: 1;
    padding: 12px;
    position: relative;
}

.mobile-checklist-card-content h4 {
    font-size: 15px;
    margin: 0 0 6px 0;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.mobile-checklist-card-info {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6c757d;
}

.mobile-checklist-card-info span {
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-checklist-card-info i {
    margin-right: 4px;
    color: #6c757d;
}

/* Estado vazio (quando não há testes) */
.dashboard-mobile .empty-state {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    padding: 24px 15px;
}

.dashboard-mobile .empty-state-icon {
    background-color: rgba(13, 110, 253, 0.1);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 15px;
}

.dashboard-mobile .empty-state-icon i {
    font-size: 24px;
    color: #0d6efd;
}

.dashboard-mobile .empty-state p {
    color: #6c757d;
    margin-bottom: 16px;
}

/* Card de estatísticas gerais */
.mobile-stats-summary {
    background-color: white;
    border-radius: 16px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 16px;
}

.mobile-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.mobile-stat-item:last-child {
    border-bottom: none;
}

.mobile-stat-label {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #495057;
}

.mobile-stat-label i {
    margin-right: 10px;
    color: #0d6efd;
    width: 18px;
    text-align: center;
}

.mobile-stat-value {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

/* Garantir que os elementos mobile sejam exibidos corretamente em dispositivos móveis */
@media (max-width: 767px) {
    .dashboard-mobile, 
    .mobile-stats-grid, 
    .mobile-stats-card, 
    .mobile-efficacy-card, 
    .mobile-section-header,
    .mobile-checklist-cards,
    .mobile-checklist-card,
    .mobile-stat-item {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Corrigir possíveis problemas com componentes que mostram/escondem conteúdo */
    .navbar-collapse.collapse:not(.show) {
        display: none !important;
    }
    
    /* Melhorar o comportamento do menu no mobile */
    .navbar-toggler {
        position: relative;
        z-index: 2000;
    }
    
    .navbar-collapse.show {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #0d6efd;
        padding: 15px;
        z-index: 1000;
        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    }
}

/* Estilos para corrigir problemas com modais */
.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1050 !important;
}

/* Garantir que modais sobrepostos funcionem corretamente */
.modal-backdrop + .modal-backdrop {
    z-index: 1041 !important;
}

.modal.show {
    opacity: 1;
    display: block;
    z-index: 1050 !important;
}

.modal-content {
    box-shadow: 0 5px 15px rgba(0,0,0,.5);
}

/* Correção para dispositivos móveis */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem auto;
    }
}