/* =====================================================
   Preparacao TJPE2025 - CSS CUSTOMIZADO
   Responsividade, Acessibilidade e Melhorias Visuais
   ===================================================== */

/* Reset e configurações base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ===== ACESSIBILIDADE ===== */

/* Foco visível para navegação por teclado */
*:focus {
    outline: 3px solid #2196F3;
    outline-offset: 2px;
}

/* Skip links para leitores de tela */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
}

.skip-link:focus {
    top: 6px;
}

/* Alto contraste para melhor legibilidade */
.high-contrast {
    background: #000 !important;
    color: #fff !important;
}

.high-contrast .w3-card-4 {
    background: #333 !important;
    color: #fff !important;
    border: 2px solid #fff;
}

/* Texto alternativo para ícones */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== RESPONSIVIDADE ===== */

/* Container responsivo */
.container-responsive {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Grid responsivo melhorado */
@media (max-width: 768px) {
    .w3-row-padding > .w3-col {
        margin-bottom: 16px;
    }
    
    .w3-bar .w3-bar-item {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .w3-jumbo {
        font-size: 48px !important;
    }
    
    .w3-xxxlarge {
        font-size: 32px !important;
    }
}

@media (max-width: 480px) {
    .w3-container {
        padding: 8px;
    }
    
    .w3-card-4 {
        margin-bottom: 12px;
    }
    
    .w3-button {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .w3-table {
        font-size: 12px;
    }
    
    .w3-bar .w3-right {
        float: none !important;
        width: 100%;
        text-align: center;
    }
}

/* Campos de senha com botão de visualização */
.password-field {
    position: relative;
}

.password-field .password-toggle {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
}

.password-field .password-toggle i {
    pointer-events: none;
}

/* ===== MELHORIAS VISUAIS ===== */

/* Animações suaves */
.w3-card-4, .w3-button, .w3-bar-item {
    transition: all 0.3s ease;
}

.w3-hover-shadow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2) !important;
}

.w3-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Gradientes para cards */
.gradient-blue {
    background: linear-gradient(135deg, #2196F3, #1976D2);
}

.gradient-green {
    background: linear-gradient(135deg, #4CAF50, #388E3C);
}

.gradient-orange {
    background: linear-gradient(135deg, #FF9800, #F57C00);
}

.gradient-purple {
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

/* Melhorias no formulário */
.form-group {
    margin-bottom: 20px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* Melhorias nas questões */
.question-option {
    padding: 15px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fff;
}

.question-option:hover {
    border-color: #2196F3;
    background: #f5f5f5;
}

.question-option.selected {
    border-color: #2196F3;
    background: #e3f2fd;
}

.question-option.correct {
    border-color: #4CAF50;
    background: #e8f5e8;
}

.question-option.incorrect {
    border-color: #f44336;
    background: #ffebee;
}

/* Timer visual */
.timer-warning {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Navegação de questões */
.question-nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 8px;
    padding: 16px;
}

.question-nav-btn {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ddd;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.question-nav-btn:hover {
    transform: scale(1.1);
}

.question-nav-btn.current {
    background: #2196F3;
    color: white;
    border-color: #1976D2;
}

.question-nav-btn.answered {
    background: #4CAF50;
    color: white;
    border-color: #388E3C;
}

.question-nav-btn.unanswered {
    background: #f5f5f5;
    border-color: #ddd;
}

/* Gráficos responsivos */
.chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
}

/* Indicadores de progresso */
.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    transition: width 0.5s ease;
    border-radius: 10px;
}

/* Badges e tags melhorados */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-success {
    background: #4CAF50;
    color: white;
}

.badge-danger {
    background: #f44336;
    color: white;
}

.badge-warning {
    background: #FF9800;
    color: white;
}

.badge-info {
    background: #2196F3;
    color: white;
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Loading states */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Melhorias na tabela */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-hover tbody tr:hover {
    background-color: #f5f5f5;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background: #121212;
        color: #e0e0e0;
    }
    
    .auto-dark .w3-card-4 {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    
    .auto-dark .form-control {
        background: #2e2e2e;
        border-color: #444;
        color: #e0e0e0;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .w3-card-4 {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .w3-button {
        border: 1px solid #ddd;
    }
}

/* ===== COMPONENTES ESPECÍFICOS ===== */

/* Header fixo melhorado */
.header-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-fixed + .main-content {
    margin-top: 60px;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
}

/* Breadcrumb */
.breadcrumb {
    background: #f8f9fa;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: #2196F3;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Alertas melhorados */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: #4CAF50;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f44336;
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: #FF9800;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: #2196F3;
    color: #0c5460;
}

/* Utilitários */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

/* ===== RESPONSIVIDADE AVANÇADA ===== */

/* Tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .w3-col.l3 {
        width: 50% !important;
    }
    
    .w3-col.l4 {
        width: 50% !important;
    }
    
    .w3-col.l6 {
        width: 100% !important;
    }
}

/* Smartphones pequenos */
@media (max-width: 320px) {
    .w3-container {
        padding: 4px;
    }
    
    .w3-button {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .w3-large {
        font-size: 16px !important;
    }
}

/* Landscape em dispositivos móveis */
@media (max-height: 500px) and (orientation: landscape) {
    .w3-jumbo {
        font-size: 32px !important;
    }
    
    .w3-container {
        padding: 8px;
    }
}

