:root {
    --primary: #003366; 
    --secondary: #0099cc; 
    --accent: #d32f2f; 
    --it-color: #6f42c1; 
    --academic-color: #00897b;
    --pro-rector-color: #c2185b;
    --bg: #f4f7f6;
    --sidebar-width: 340px;
    --header-height: 80px;
    --text-dark: #2c3e50;
    --border: #e0e0e0;
    
    /* Cores do Dashboard */
    --dash-total: #e3f2fd; --dash-total-text: #0d47a1;
    --dash-done: #e8f5e9; --dash-done-text: #1b5e20;
    --dash-exec: #fff3e0; --dash-exec-text: #e65100;
    --dash-pending: #ffebee; --dash-pending-text: #b71c1c;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }

body { display: flex; flex-direction: column; height: 100vh; background: var(--bg); overflow: hidden; }

/* === CABEÇALHO === */
.main-header {
    height: var(--header-height);
    background: linear-gradient(-45deg, #001a33, #003366, #004d99, #002244);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: white;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 100; position: relative;
    border-bottom: 3px solid var(--accent);
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.main-header h1 { font-size: 1.8rem; font-weight: 900; text-transform: uppercase; letter-spacing: 2px; text-shadow: 2px 2px 4px rgba(0,0,0,0.3); }

/* === LAYOUT === */
.app-container { display: flex; flex: 1; height: calc(100vh - var(--header-height)); overflow: hidden; }

/* === SIDEBAR === */
aside { width: var(--sidebar-width); background: white; border-right: 1px solid var(--border); display: flex; flex-direction: column; height: 100%; z-index: 10; box-shadow: 4px 0 15px rgba(0,0,0,0.05); }

.brand { padding: 20px 20px 10px 20px; background: white; text-align: center; }
.brand img { max-width: 140px; height: auto; margin-bottom: 5px; display: block; margin: 0 auto; }
.brand h2 { font-size: 1rem; color: var(--primary); font-weight: 800; margin-top: 5px; }
.brand span { font-size: 0.7rem; color: #777; text-transform: uppercase; letter-spacing: 1px; }

/* Dashboard Stats */
.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 10px; background: white; }
.stat-card { border-radius: 6px; padding: 8px 2px; text-align: center; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.stat-card:hover { transform: translateY(-3px); filter: brightness(0.95); }
.stat-card.total { background: var(--dash-total); color: var(--dash-total-text); }
.stat-card.done { background: var(--dash-done); color: var(--dash-done-text); border: 1px solid #c8e6c9; }
.stat-card.exec { background: var(--dash-exec); color: var(--dash-exec-text); border: 1px solid #ffe0b2; }
.stat-card.pending { background: var(--dash-pending); color: var(--dash-pending-text); }
.stat-num { font-size: 1.1rem; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.stat-label { font-size: 0.5rem; text-transform: uppercase; font-weight: 700; }

/* Botões Gerenciais Sidebar */
.manager-area { padding: 0 15px 15px 15px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
button[class^="btn-"] { border: none; padding: 10px; border-radius: 6px; font-size: 0.8rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: 0.3s; color: white; }
button[class^="btn-"]:hover { transform: translateY(-2px); }

.btn-manager-full { background: #2c3e50; }
.btn-it-advisor { background: var(--it-color); }
.btn-academic-advisor { background: var(--academic-color); }
.btn-pro-rector { background: var(--pro-rector-color); }

/* Busca e Lista de Cursos */
.search-box { padding: 15px; background: #f8f9fa; border-bottom: 1px solid var(--border); }
.search-box input { width: 100%; padding: 12px 15px; border: 1px solid #ddd; border-radius: 30px; font-size: 0.9rem; }

.course-list { flex: 1; overflow-y: auto; list-style: none; padding: 10px; }
.course-item { padding: 12px 15px; margin-bottom: 5px; border-radius: 8px; cursor: pointer; border-left: 4px solid transparent; background: white; display: flex; justify-content: space-between; align-items: center; font-size: 0.85rem; color: #555; }
.course-item:hover { background: #f0f4f8; color: var(--primary); }
.course-item.active { background: var(--primary); color: white; border-left: 4px solid var(--accent); }
.course-item .campus { display: block; font-size: 0.7rem; opacity: 0.7; font-weight: 600; text-transform: uppercase; }

.status-dot { width: 12px; height: 12px; border-radius: 50%; background: #e0e0e0; margin-left: 10px; border: 2px solid white; }
.status-dot.exec { background: #ff9800; }
.status-dot.done { background: #00c853; }

/* === CONTEÚDO PRINCIPAL === */
main { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }

.top-bar { background: white; padding: 15px 30px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.current-course h1 { font-size: 1.4rem; color: var(--primary); font-weight: 800; }
.current-course span { color: #777; font-size: 0.9rem; display: flex; align-items: center; gap: 5px; margin-top: 5px; }

.btn { padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.btn-report { background: var(--secondary); color: white; border: none; }
.btn-status-toggle { background: #f0f0f0; color: #555; border: 1px solid #ccc; }
.btn-status-toggle.exec { background: #fff3e0; color: #e65100; border-color: #ffb74d; }
.btn-status-toggle.done { background: #e8f5e9; color: #1b5e20; border-color: #81c784; }

.welcome-banner { background: #e3f2fd; color: var(--primary); padding: 15px 40px; border-bottom: 1px solid #bbdefb; font-size: 0.95rem; display: none; }

/* --- BOTÃO DE EDIÇÃO DE COORDENADOR --- */
.btn-edit-coord { 
    background: #fff; 
    border: 1px solid var(--secondary); 
    color: var(--secondary); 
    cursor: pointer; 
    margin-left: 10px; 
    font-size: 0.85rem;
    font-weight: 600; 
    padding: 5px 12px; 
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: 0.2s;
}
.btn-edit-coord:hover { background: var(--secondary); color: white; }
.input-edit-coord { padding: 5px; border: 1px solid var(--secondary); border-radius: 4px; font-size: 0.9rem; width: 300px; }
.btn-save-coord { padding: 5px 10px; background: #28a745; color: white; border: none; border-radius: 4px; cursor: pointer; margin-left: 5px; }
.btn-cancel-coord { padding: 5px 10px; background: #dc3545; color: white; border: none; border-radius: 4px; cursor: pointer; margin-left: 5px; }

.tabs-container { background: white; padding: 0 40px; border-bottom: 1px solid var(--border); }
.tabs { display: flex; gap: 30px; }
.tab { padding: 18px 0; cursor: pointer; color: #999; font-weight: 600; border-bottom: 3px solid transparent; font-size: 0.95rem; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.content-area { flex: 1; overflow-y: auto; padding: 40px; background: #f4f7f6; padding-bottom: 100px; }
.dimension-title { margin: 40px 0 20px; font-size: 1rem; color: var(--primary); background: #eef2f5; padding: 10px 15px; border-radius: 6px; border-left: 5px solid var(--secondary); text-transform: uppercase; font-weight: 800; }

.question-card { background: white; border-radius: 10px; padding: 25px; margin-bottom: 20px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid transparent; transition: 0.3s; }
.question-card:hover { border-color: #ddd; box-shadow: 0 10px 25px rgba(0,0,0,0.08); transform: translateY(-2px); }

/* Badges de Gestão */
.question-card.it-managed { border-left: 5px solid var(--it-color); background: #fcfaff; }
.it-badge { background: var(--it-color); color: white; font-size: 0.65rem; padding: 3px 8px; border-radius: 4px; display: inline-block; margin-bottom: 5px; font-weight: bold; }

.question-card.academic-managed { border-left: 5px solid var(--academic-color); background: #f0fdfc; }
.academic-badge { background: var(--academic-color); color: white; font-size: 0.65rem; padding: 3px 8px; border-radius: 4px; display: inline-block; margin-bottom: 5px; font-weight: bold; }

.question-card.pro-rector-managed { border-left: 5px solid var(--pro-rector-color); background: #fff0f5; }
.pro-rector-badge { background: var(--pro-rector-color); color: white; font-size: 0.65rem; padding: 3px 8px; border-radius: 4px; display: inline-block; margin-bottom: 5px; font-weight: bold; }

/* === CARTÃO DE EXEMPLO === */
.example-card { background-color: #fffbf0; border-left: 5px solid #ffc107; }
.example-badge { background: #ffc107; color: #856404; padding: 4px 10px; border-radius: 4px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; display: inline-block; margin-bottom: 5px; }
.input-example { width: 100%; padding: 12px; border: 1px solid #e0e0e0; border-radius: 6px; font-size: 0.9rem; background-color: white; color: #555; cursor: default; }

/* Botão Azul de Exemplo */
.btn-example {
    background-color: #003366 !important;
    color: white !important;
    border: none !important;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: default;
    opacity: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.q-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.q-text { font-size: 1.05rem; color: #333; line-height: 1.6; flex: 1; }

/* === BOTÃO 5W2H === */
.btn-5w2h { 
    background: #2c3e50; 
    color: white; 
    padding: 10px 20px; 
    border-radius: 30px; 
    font-size: 0.8rem; 
    font-weight: 700; 
    border: none; 
    cursor: pointer; 
    white-space: nowrap; 
    transition: 0.3s; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); 
}
.btn-5w2h:hover { 
    background: #1a252f; 
    transform: translateY(-2px);
}
.btn-5w2h.active { 
    background: var(--secondary); 
    color: white; 
}

/* === NOVO BOTÃO DELETAR PLANO (ABA < 4.8) === */
.btn-delete-plan {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
    transition: 0.2s;
}
.btn-delete-plan:hover { background: #b02a37; }

.form-5w2h { display: none; margin-top: 25px; padding-top: 25px; border-top: 1px dashed #ddd; background: #fafbfc; padding: 25px; border-radius: 8px; border: 1px solid #eee; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.form-group label { display: block; font-size: 0.75rem; font-weight: 800; color: #555; margin-bottom: 8px; text-transform: uppercase; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 0.95rem; }
.form-group textarea { resize: vertical; height: 80px; }

/* === NOVO LAYOUT DO HOW (DATAS) === */
.how-container { grid-column: 1 / -1; background: #fff; padding: 15px; border: 1px solid #eee; border-radius: 6px; }
.how-dates { display: flex; gap: 20px; margin-bottom: 10px; }
.how-dates .form-group { flex: 1; }

.save-indicator { text-align: right; margin-top: 15px; font-size: 0.85rem; color: #28a745; display: none; font-weight: 600; }

/* === MODAIS === */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal-content { background: white; width: 90%; max-width: 600px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); display: flex; flex-direction: column; max-height: 85vh; }
.modal-header { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: var(--primary); color: white; border-radius: 10px 10px 0 0; }
.modal-header.it-header { background: var(--it-color); }
.modal-header.academic-header { background: var(--academic-color); }
.modal-header.pro-rector-header { background: var(--pro-rector-color); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-footer { padding: 20px; border-top: 1px solid #eee; text-align: right; display: flex; justify-content: flex-end; gap: 10px; }
.modal-warning { margin-bottom: 20px; font-size: 0.9rem; padding: 15px; border-radius: 6px; border-left-width: 4px; border-left-style: solid; }
.it-warning { background: #f3e5f5; border-color: var(--it-color); }
.academic-warning { background: #e0f2f1; border-color: var(--academic-color); }
.pro-rector-warning { background: #fce4ec; border-color: var(--pro-rector-color); }

.course-select-list { list-style: none; }
.course-select-item { padding: 10px; border-bottom: 1px solid #eee; display: flex; align-items: center; gap: 10px; }
.checkbox-group label { display: block; margin-bottom: 10px; cursor: pointer; }

/* Status List (Modal) */
.status-list-item { padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: 0.2s; }
.status-list-item:hover { background: #f5f5f5; padding-left: 15px; }
.status-icon.done { color: #28a745; }
.status-icon.exec { color: #ff9800; }
.status-icon.pending { color: #d32f2f; }
.btn-small { padding: 5px 10px; font-size: 0.8rem; cursor: pointer; background: #e0e0e0; border: none; border-radius: 4px; }
.btn-modal-close { background: #ccc; color: #333; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; }
.btn-modal-confirm { background: var(--secondary); color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; }

/* === IMPRESSÃO === */
#printArea { display: none; }
@media print {
    body * { visibility: hidden; }
    #printArea, #printArea * { visibility: visible; }
    #printArea { display: block !important; position: absolute; left: 0; top: 0; width: 100%; background: white; padding: 20px; }
    #report-preview-overlay { display: none !important; }
    #preview-toolbar { display: none !important; }
    .report-page { page-break-after: always; margin-bottom: 50px; }
    .report-page:last-child { page-break-after: auto; }
    .report-header { text-align: center; border-bottom: 2px solid #000; padding-bottom: 20px; margin-bottom: 30px; }
    .report-header img { max-width: 150px; }
    .report-header h1 { font-size: 18pt; margin: 10px 0 5px; color: #000; }
    .report-section { margin-bottom: 30px; page-break-inside: avoid; }
    .report-section h3 { font-size: 14pt; border-bottom: 1px solid #ccc; padding-bottom: 5px; margin-bottom: 15px; color: #000; text-transform: uppercase; }
    .report-item { margin-bottom: 20px; page-break-inside: avoid; }
    .report-q { font-weight: bold; font-size: 11pt; margin-bottom: 8px; background: #f0f0f0; padding: 5px; }
    .report-table { width: 100%; border-collapse: collapse; font-size: 10pt; margin-top: 5px; }
    .report-table th, .report-table td { border: 1px solid #999; padding: 6px; text-align: left; vertical-align: top; }
    .report-table th { background: #e0e0e0; width: 15%; font-weight: bold; }
    .empty-plan { font-style: italic; color: #666; padding: 5px 10px; border-left: 3px solid #ccc; }
    .signature-line { width: 60%; margin: 60px auto 10px; border-top: 1px solid #000; }
    .report-footer { text-align: center; }
}

@media (max-width: 768px) {
    .app-container { flex-direction: column; height: auto; }
    aside { width: 100%; max-height: 250px; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}