/* ==========================================================================
   SISTEMA DE VALIDAÇÃO DE HORAS EXTRACURRICULARES - COEX / UFPR
   Estilos Globais e Responsivos
   ========================================================================== */

:root {
    --primary: #003366;
    --primary-hover: #002244;
    --primary-light: #e6f0fa;
    --secondary: #2b6cb0;
    --accent: #d97706;
    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #ca8a04;
    --warning-light: #fef9c3;
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- BANNER DE DEMO / AVISOS --- */
.demo-banner {
    background: linear-gradient(90deg, #1e3a8a, #0369a1);
    color: #ffffff;
    padding: 8px 16px;
    font-size: 0.85rem;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.demo-banner strong {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
}

/* --- HEADER & NAVEGAÇÃO --- */
.app-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
.brand-logo {
    width: 38px;
    height: 38px;
    background: #ffffff;
    color: var(--primary);
    font-weight: 800;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}
.brand-text h1 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
}
.brand-text p {
    font-size: 0.75rem;
    color: #cbd5e1;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}
.user-info {
    text-align: right;
    font-size: 0.85rem;
}
.user-name {
    font-weight: 600;
}
.user-meta {
    color: #94a3b8;
    font-size: 0.75rem;
}

/* --- BOTÕES --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}
.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-hover);
}
.btn-secondary {
    background-color: #ffffff;
    color: var(--text-main);
    border-color: var(--border);
}
.btn-secondary:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
}
.btn-success {
    background-color: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background-color: #15803d;
}
.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #b91c1c;
}
.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}
.btn-outline-light {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.4);
    color: #ffffff;
}
.btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #ffffff;
}

/* --- CONTAINER PRINCIPAL --- */
.container {
    max-width: 1200px;
    margin: 24px auto;
    padding: 0 16px;
}

/* --- CARDS & GRID --- */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- STATS / KPIS DASHBOARD --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--secondary);
}
.stat-card.stat-success::before { background-color: var(--success); }
.stat-card.stat-warning::before { background-color: var(--warning); }
.stat-card.stat-primary::before { background-color: var(--primary); }

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 4px 0;
}
.stat-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- BARRA DE PROGRESSO --- */
.progress-container {
    width: 100%;
    background-color: #e2e8f0;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #16a34a);
    transition: width 0.4s ease-in-out;
}

/* --- DISTRIBUIÇÃO POR GRUPOS --- */
.groups-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.group-badge {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.group-badge.active {
    background: var(--primary-light);
    border-color: var(--secondary);
    color: var(--primary);
    font-weight: 600;
}
.group-badge .gb-title {
    font-size: 0.75rem;
}
.group-badge .gb-hours {
    font-weight: 700;
}

/* --- FORMULÁRIOS --- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.form-grid-full {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}
.form-label .required {
    color: var(--danger);
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    background-color: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(43, 108, 176, 0.15);
}
.form-help {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.form-callout {
    background-color: var(--primary-light);
    border-left: 4px solid var(--secondary);
    padding: 12px 16px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 16px;
    font-size: 0.85rem;
}
.form-callout strong {
    color: var(--primary);
}

/* --- TABELAS --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}
.table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:hover {
    background-color: #f8fafc;
}

/* --- STATUS BADGES --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.status-pendente {
    background-color: var(--warning-light);
    color: #854d0e;
    border: 1px solid #fef08a;
}
.status-aprovado {
    background-color: var(--success-light);
    color: #166534;
    border: 1px solid #bbf7d0;
}
.status-rejeitado {
    background-color: var(--danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}
.modal-overlay.open {
    display: flex;
}
.modal-dialog {
    background: var(--bg-card);
    width: 100%;
    max-width: 650px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modalSlideIn 0.2s ease-out;
}
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    background-color: var(--primary);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}
.modal-close {
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}
.modal-body {
    padding: 20px;
    max-height: 75vh;
    overflow-y: auto;
}
.modal-footer {
    padding: 14px 20px;
    background-color: #f8fafc;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- AUTH PAGE (LOGIN / CADASTRO) --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #002244 0%, #003366 50%, #0f172a 100%);
}
.auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 460px;
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.3);
}
.auth-header {
    text-align: center;
    margin-bottom: 24px;
}
.auth-logo-badge {
    width: 56px;
    height: 56px;
    background: var(--primary);
    color: #ffffff;
    font-weight: 800;
    font-size: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.auth-header h2 {
    font-size: 1.4rem;
    color: var(--primary);
}
.auth-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}
.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.quick-login-box {
    margin-top: 20px;
    padding: 12px;
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}
.quick-login-box h4 {
    color: var(--text-muted);
    margin-bottom: 6px;
    font-size: 0.75rem;
    text-transform: uppercase;
}
.quick-login-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Responsividade */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-grid-full {
        grid-column: span 1;
    }
    .app-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
    .header-user {
        width: 100%;
        justify-content: space-between;
    }
}

/* --- ESTILOS DE IMPRESSÃO OFICIAL (RELATÓRIO / PDF) --- */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 11pt;
    }
    .app-header, .stats-grid, .auth-tabs, .btn, .card-header button, 
    #secao-pedidos, .modal-overlay, .demo-banner {
        display: none !important;
    }
    #secao-relatorio {
        display: block !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    .table th, .table td {
        border: 1px solid #94a3b8 !important;
        padding: 8px !important;
    }
    .table th {
        background-color: #f1f5f9 !important;
    }
    .status-badge {
        border: 1px solid #000000 !important;
        background: none !important;
        color: #000000 !important;
    }
    .progress-container {
        display: none !important;
    }
    #tabela-consolidada th:last-child,
    #tabela-consolidada td:last-child {
        display: none !important;
    }
}
