:root {
    --primary-red: #ed1c24;
    --bg-color: #f1f5f9;
    /* Softer light blue-gray background */
    --card-bg: #ffffff;
    --text-color: #334155;
    /* Softer than near-black */
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 275px;
    --sidebar-collapsed-width: 70px;

    /* Theme-specific for elements */
    --sim-form-bg: #f8fafc;
    --sim-item-border: #e2e8f0;
}

/* Extra Classes for Tabela Professores Form and Header */
.tabela-prof-header-icon {
    color: var(--primary-red);
}

.tabela-prof-desc {
    margin-bottom: 20px;
}

.search-input {
    padding-left: 35px;
}

.filter-month {
    width: auto;
    padding: 6px 10px;
}

.filter-label {
    margin-left: 10px;
}

.filter-select {
    width: auto;
    min-width: 180px;
}

.filter-select-large {
    width: auto;
    min-width: 200px;
}

.col-prof {
    width: 220px;
}

.col-center {
    text-align: center;
}

/* Dashboard Extras */
.filter-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--card-bg);
    padding: 12px 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.filter-group {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

.filter-month-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
}

.filter-month-input {
    padding: 6px 10px;
    width: auto;
}

.btn-clear {
    font-size: .8rem;
    padding: 6px 12px;
}

.btn-tabela {
    padding: 8px 16px;
    font-size: .85rem;
    white-space: nowrap;
}

.filter-bar .btn-primary {
    padding: 8px 12px;
    flex-shrink: 0;
}

.links i {
    font-size: 1.2rem;
    margin-right: 10px;
}

/* Period Selection Buttons */
.period-btns {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.period-btn {
    padding: 10px 18px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 20px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-size: 0.85rem;
}

.period-btn .status-icon {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.period-btn:hover {
    border-color: var(--primary-red);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(237, 28, 36, 0.15);
}

.period-btn.active {
    background-color: var(--primary-red) !important;
    color: #fff !important;
    border-color: var(--primary-red) !important;
    box-shadow: 0 6px 15px rgba(237, 28, 36, 0.3) !important;
}

.period-btn.active .status-icon {
    color: #fff !important;
}

/* Calendar Day Tooltip */
.cal-tooltip {
    position: fixed;
    z-index: 10000;
    background: rgba(15, 23, 42, 0.95);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.88rem;
    pointer-events: none;
    display: none;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    max-width: 280px;
    white-space: pre-line;
    line-height: 1.6;
}

[data-tema="escuro"] {
    --bg-color: #0f172a;
    /* Deeper midnight slate */
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;

    --sim-form-bg: #1a2233;
    --sim-item-bg: rgba(255, 255, 255, 0.03);
    --sim-item-border: rgba(255, 255, 255, 0.08);
}

/* --- Reset --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow-x: hidden;
}

/* --- Layout principal --- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 30px 40px;
    transition: margin-left .3s ease, padding .3s ease;
    min-height: 100vh;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

body.sidebar-closed .main-content {
    margin-left: var(--sidebar-collapsed-width);
    padding: 40px 30px;
}

/* --- Top bar (header dentro do main) --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
    border: 1px solid var(--border-color);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.top-bar .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-red);
    font-size: 1.5rem;
}

.top-bar .user-greeting {
    font-size: .85rem;
    color: var(--text-muted);
}

.top-bar .user-name {
    font-weight: 700;
    font-size: 1rem;
}

.top-bar .status-box {
    text-align: right;
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}

.top-bar .status-label {
    font-size: .75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
}

.top-bar .status-online {
    font-size: .85rem;
    color: #2e7d32;
    font-weight: 600;
}

.top-bar .status-dot {
    font-size: .6rem;
}

.top-bar .date-badge {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text-color);
    background: var(--bg-color);
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

/* --- Page header --- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

/* --- Cards --- */
.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .05);
    border: 1px solid var(--border-color);
    margin-bottom: 25px;
}

/* --- Botões --- */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: .2s;
}

.btn-primary {
    background: var(--primary-red);
    color: #fff;
}

.btn-primary:hover {
    opacity: .9;
    transform: translateY(-1px);
}

.btn-back {
    background: #6c757d;
    color: #fff;
}

.btn-edit {
    padding: 5px 10px;
    background: #ffc107;
    color: #000;
}

.btn-delete {
    padding: 5px 10px;
    background: #dc3545;
    color: #fff;
}

/* --- Formulários --- */
.form-group {
    margin-bottom: 15px;
}

.form-group-last {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    /* Increased padding */
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.form-actions {
    text-align: right;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.form-check input {
    width: 18px;
    height: 18px;
}

.form-check label {
    font-weight: 600;
    cursor: pointer;
}

/* --- Tabelas --- */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th {
    text-align: left;
    padding: 15px;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: rgba(0, 0, 0, .02);
}

.text-center {
    text-align: center;
}

/* --- Badges --- */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
}

.city-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .85rem;
}

.sala-badge {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: .85rem;
}

/* --- Dashboard --- */
.dashboard-home .welcome-banner {
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, .1);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.stat-card .stat-icon i {
    font-size: 1.5rem;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: .85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-card .stat-link {
    display: inline-block;
    margin-top: 12px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--primary-red);
    text-decoration: none;
}

.stat-card .stat-link:hover {
    text-decoration: underline;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dash-section {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
    border: 1px solid var(--border-color);
    overflow: hidden;
    padding: 12px;
}

.dash-section-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dash-section-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-section-body {
    padding: 20px 24px;
}

.dash-table {
    width: 100%;
    border-collapse: collapse;
}

.dash-table th {
    padding: 12px 20px;
    background: var(--bg-color);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.dash-table td {
    padding: 12px 20px;
}

.dash-table .td-time {
    font-weight: 800;
    color: var(--primary-red);
}

.dash-table .td-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.dash-table .td-empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    opacity: .4;
}

/* --- Filter bar --- */
.filter-bar {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-weight: 600;
    min-width: 180px;
}

/* --- City list --- */
.city-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.city-list-item:last-child {
    border-bottom: none;
}

.city-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

/* --- Export buttons --- */
.btn-export {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    transition: .2s;
}

.btn-export:hover {
    opacity: .85;
}

.btn-export-excel {
    background: #217346;
    color: #fff;
    border-color: #1a5c38;
}

.btn-export-powerbi {
    background: #f2c811;
    color: #000;
    border-color: #d4a800;
}

.export-group {
    margin-left: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.export-label {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

/* --- Alert info (planejamento) --- */
.alert-info {
    background: rgba(237, 28, 36, .05);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-red);
    margin-bottom: 25px;
    font-size: .9rem;
    color: var(--text-muted);
}

/* --- Conflito card --- */
.conflict-card {
    border-top: 5px solid var(--primary-red);
}

.conflict-item {
    background: rgba(237, 28, 36, .05);
    padding: 12px 15px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-red);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* --- Sidebar column (dashboard) --- */
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Readonly field (vigência) --- */
.form-input-readonly {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: #f8f9fa;
    color: #666;
}

/* ==========================================
   Gantt Chart — Disponibilidade de Professores
   ========================================== */

.gantt-section {
    margin-top: 40px;
    width: 100%;
    overflow: hidden;
}

.gantt-section h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gantt-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow-x: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
    position: relative;
}

.gantt-legend {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 15px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: .85rem;
    font-weight: 600;
}

.gantt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.gantt-legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 4px;
}

.gantt-legend-dot.busy {
    background: #ef5350;
}

.gantt-legend-dot.free {
    background: #66bb6a;
}

.gantt-chart {
    min-width: 1200px;
    overflow: visible;
}

/* Header row with months */
.gantt-header {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background: var(--bg-color);
}

.gantt-header-label {
    width: 180px;
    min-width: 180px;
    padding: 10px 15px;
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
}

.gantt-header-timeline {
    flex: 1;
    display: flex;
}

.gantt-month {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
}

.gantt-month:last-child {
    border-right: none;
}

/* Each professor row */
.gantt-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    transition: background .15s;
}

.gantt-row:last-child {
    border-bottom: none;
}

.gantt-row:hover {
    background: rgba(0, 0, 0, .02);
}

.gantt-label {
    width: 180px;
    min-width: 180px;
    padding: 14px 15px;
    font-weight: 600;
    font-size: .88rem;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid var(--border-color);
    color: var(--text-color);
}

.gantt-label i {
    color: var(--primary-red);
    font-size: .9rem;
}

.gantt-bars {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 8px 4px;
    position: relative;
    min-height: 50px;
}

/* Bar segments */
.gantt-bar {
    position: absolute;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    font-weight: 700;
    color: #fff;
    transition: transform .15s, box-shadow .15s;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 0 6px;
}

.gantt-bar-busy {
    background: linear-gradient(135deg, #ef5350, #c62828);
    cursor: default;
    z-index: 2;
}

.gantt-bar-free {
    background: linear-gradient(135deg, #66bb6a, #2e7d32);
    cursor: pointer;
    z-index: 1;
}

.gantt-bar-free:hover {
    transform: scaleY(1.15);
    box-shadow: 0 4px 12px rgba(46, 125, 50, .3);
}

.gantt-bar-busy:hover {
    transform: scaleY(1.1);
    box-shadow: 0 4px 12px rgba(198, 40, 40, .3);
}

/* Tooltip */
.gantt-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .78rem;
    pointer-events: none;
    z-index: 9999;
    max-width: 250px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
    display: none;
}

/* ==========================================
   Modal
   ========================================== */

/* --- Modal Simulation Specifics --- */
.form-grid-simulation {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.sim-checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-color);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 0.8rem;
    transition: 0.2s;
}

.sim-checkbox-label:hover {
    border-color: var(--primary-red);
}

.sim-checkbox-label input {
    margin: 0;
}

.sim-period-selector .sim-period {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.sim-period-selector .sim-period.active {
    background: #2e7d32;
    color: white;
    border-color: #1b5e20;
    box-shadow: 0 4px 10px rgba(46, 125, 50, 0.2);
}

.sim-period-selector .sim-period.active {
    color: white;
}

.sim-resource-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sim-resource-item {
    background: var(--sim-item-bg);
    border: 1px solid var(--sim-item-border);
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: 0.2s;
}

.item-suggestion-main {
    border-left: 4px solid #4caf50;
    background: rgba(76, 175, 80, 0.05);
}

.sim-badge-avail {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.sim-badge-high {
    background: #e8f5e9;
    color: #2e7d32;
}

.sim-badge-mid {
    background: #fff3e0;
    color: #ef6c00;
}

.sim-badge-low {
    background: #ffebee;
    color: #c62828;
}

.sim-btn-swap {
    background: none;
    border: none;
    color: #1976d2;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.sim-btn-swap:hover {
    text-decoration: underline;
}

/* --- Modal Logic --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 11000;
    backdrop-filter: blur(8px);
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg, #ffffff);
    width: 100%;
    max-width: 580px;
    border-radius: 24px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    animation: modalSlideUp 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 16px 32px;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.modal-header h3 {
    color: var(--corTxt3);
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.5px;
}

.modal-header h3 i {
    color: var(--primary-red);
    font-size: 1.2rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #ef5350;
    color: #fff;
    transform: rotate(90deg);
}

.modal-body {
    padding: 20px 32px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-info {
    background: rgba(237, 28, 36, 0.05);
    border-left: 4px solid var(--primary-red);
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    color: var(--text-color);
}

.modal-info strong {
    color: var(--primary-red);
    font-weight: 700;
}

/* Day Checkboxes (Modern Compact Tiles) */
.dias-checkboxes {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 5px;
}

.dia-checkbox-label {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.dia-checkbox-label input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.dia-checkbox-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 4px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s ease;
    text-align: center;
    min-height: 40px;
}

.dia-checkbox-label:hover .dia-checkbox-text {
    border-color: var(--primary-red);
    background: rgba(237, 28, 36, 0.03);
    color: var(--primary-red);
}

.dia-checkbox-label input:checked~.dia-checkbox-text {
    background: linear-gradient(135deg, #ed1c24, #c41920);
    border-color: #c41920;
    color: #fff;
    box-shadow: 0 4px 8px rgba(237, 28, 36, 0.2);
}

/* Simulation Toggle UI Compact */
.sim-toggle-container {
    background: rgba(237, 28, 36, 0.03);
    border: 1px dashed rgba(237, 28, 36, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.sim-toggle-container:hover {
    background: rgba(237, 28, 36, 0.06);
    border-color: rgba(237, 28, 36, 0.4);
}

.sim-toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.sim-toggle-label input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-red);
}

.sim-toggle-text {
    font-weight: 800;
    color: var(--primary-red);
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================
   Professor Calendar
   ========================================== */

.agenda-professor-section {
    margin-top: 40px;
}

.agenda-professor-section>h3 {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-professor-controls {
    display: flex;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
}

.view-toggle-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: .2s;
}

.view-toggle-btn.active {
    background: var(--primary-red);
    color: #fff;
}

.view-toggle-btn:hover:not(.active) {
    background: var(--card-bg);
}

/* Professor Calendar Grid */
.professor-calendar {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .06);
}

.cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: var(--primary-red);
    color: #fff;
}

.cal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: .2s;
    padding: 4px 12px;
    border-radius: 8px;
}

.cal-header h3:hover {
    background: rgba(255, 255, 255, .15);
}

.cal-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .3);
    background: transparent;
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
}

.cal-nav-btn:hover {
    background: rgba(255, 255, 255, .2);
    border-color: #fff;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
}

.cal-day-header {
    padding: 10px;
    text-align: center;
    font-weight: 700;
    font-size: .8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.cal-day {
    min-height: 70px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-top: none;
    border-left: none;
    position: relative;
    transition: background .15s;
    cursor: default;
}

.cal-day:nth-child(7n+8) {
    border-left: 1px solid var(--border-color);
}

.cal-day.empty {
    background: var(--bg-color);
    opacity: .4;
}

.cal-day:hover:not(.empty) {
    background: rgba(237, 28, 36, .04);
}

.cal-day.today {
    background: rgba(237, 28, 36, .08);
}

.cal-day.today .cal-day-num {
    background: var(--primary-red);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.cal-day.has-aula {
    background: rgba(239, 83, 80, .08);
    border-bottom: 3px solid #ef5350;
}

.cal-day.has-aula:hover {
    background: rgba(239, 83, 80, .15);
}

.cal-day.reservado {
    background: rgba(255, 179, 0, .12);
    border-bottom: 3px solid #ffb300;
}

.cal-day.reservado:hover {
    background: rgba(255, 179, 0, .22);
}

.cal-day.reservado-remove {
    background: rgba(237, 28, 36, 0.18) !important;
    border-bottom: 3px solid #e53935 !important;
    box-shadow: inset 0 0 0 2px rgba(237, 28, 36, 0.35);
}

.cal-day.reservado-remove:hover {
    background: rgba(237, 28, 36, 0.28) !important;
}

.cal-day.domingo {
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 5px,
            rgba(0, 0, 0, .02) 5px,
            rgba(0, 0, 0, .02) 10px);
    opacity: .5;
    pointer-events: none;
}

.cal-sunday-label {
    display: block;
    font-size: .6rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 4px;
    font-style: italic;
}

.cal-day-num {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text-color);
}

.cal-prof-name {
    display: block;
    font-size: .65rem;
    font-weight: 600;
    color: #2e7d32;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-class-time {
    display: block;
    font-size: .6rem;
    font-weight: 700;
    margin-top: 2px;
    line-height: 1.3;
    letter-spacing: -0.3px;
}

/* Calendar Tooltip */
.cal-tooltip {
    position: fixed;
    background: #333;
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: .8rem;
    pointer-events: none;
    z-index: 9999;
    max-width: 280px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
    display: none;
    white-space: pre-line;
    line-height: 1.5;
}

/* Month Picker */
.cal-month-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 30px 24px;
}

.cal-month-item {
    padding: 14px;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    transition: .2s;
}

.cal-month-item:hover {
    background: rgba(237, 28, 36, .08);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.cal-month-item.active {
    background: var(--primary-red);
    color: #fff;
    border-color: var(--primary-red);
}

/* ==========================================
   Availability Bar
   ========================================== */

.availability-section {
    margin-bottom: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px 24px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .06);
}

.avail-legend {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.avail-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.avail-dot.free {
    background: #66bb6a;
}

.avail-dot.busy {
    background: #ef5350;
}

.avail-bar-container {
    margin-bottom: 12px;
}

.avail-bar-track {
    display: flex;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
}

.avail-bar-free {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s;
    height: 20px
}

.avail-bar-free:hover {
    filter: brightness(1.1);
}

.avail-bar-busy {
    background: linear-gradient(135deg, #ef5350, #c62828);
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: .2s;
    height: 20px;
}

.btn-agendar-bar:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, .3);
}

.period-selector-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.period-btns {
    display: flex;
    gap: 8px;
}

.period-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}

.period-btn:hover {
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.period-btn.active {
    background: #e1f5fe;
    color: #01579b;
    border-color: #01579b;
    border-width: 2px;
}

.period-btn.active .status-icon {
    /* Keep the icon color even when button is active */
    opacity: 1;
}

.status-icon {
    margin-right: 6px;
    font-size: 0.75rem;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.1));
}

.simulation-container {
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.simulation-success {
    background: #e8f5e9;
    border: 2px solid #2e7d32;
    color: #1b5e20;
}

.simulation-error {
    background: #ffebee;
    border: 2px solid var(--primary-red);
    color: #b71c1c;
}

.avail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================
   Toast Notification
   ========================================== */

.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    min-width: 350px;
    max-width: 600px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
    animation: toastIn .3s ease;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: .9rem;
}

.toast-success .toast-content {
    background: #2e7d32;
    color: #fff;
}

.toast-error .toast-content {
    background: #c62828;
    color: #fff;
}

.toast-info .toast-content {
    background: #1565c0;
    color: #fff;
}

.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255, 255, 255, .7);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}

.toast-close:hover {
    color: #fff;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast-exit {
    animation: toastOut .3s ease forwards;
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ==========================================
   Dashboard — Prof Resumo
   ========================================== */

.prof-resumo-list {
    padding: 0;
}

.prof-resumo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border-color);
    gap: 20px;
    transition: background .15s;
}

.prof-resumo-item:last-child {
    border-bottom: none;
}

.prof-resumo-item:hover {
    background: rgba(0, 0, 0, .02);
}

.prof-resumo-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.prof-resumo-info strong {
    font-size: .9rem;
    display: block;
}

.prof-resumo-meta {
    font-size: .75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

/* Mini availability bar (used in dashboard & tabela) */
.mini-avail-bar {
    flex: 1;
    display: flex;
    height: 22px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    min-width: 150px;
}

.mini-avail-free {
    background: linear-gradient(135deg, #66bb6a, #43a047);
    transition: width .3s ease;
}

.mini-avail-busy {
    background: linear-gradient(135deg, #ef5350, #c62828);
    transition: width .3s ease;
}

/* ==========================================
   Tabela Professores
   ========================================== */

.tabela-prof-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 350px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

.search-box input {
    padding-left: 35px;
    /* Ensure space for the icon */
}

.filter-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: .85rem;
    color: var(--text-muted);
}

.tabela-prof-card {
    padding: 0;
}

.tabela-prof-legend {
    display: flex;
    gap: 20px;
    padding: 15px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tabela-prof-table {
    width: 100%;
    border-collapse: collapse;
}

.tabela-prof-table th {
    padding: 14px 20px;
    background: var(--bg-color);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

.tabela-prof-table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.tabela-prof-table tr:last-child td {
    border-bottom: none;
}

.tabela-prof-table tr:hover {
    background: rgba(0, 0, 0, .02);
}

.tabela-prof-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

.pagination-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: .2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-red);
    color: #fff;
    border-color: var(--primary-red);
}

.pagination-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.pagination-info {
    font-weight: 600;
    font-size: .85rem;
    color: var(--text-muted);
}

/* Dias checkbox no modal */
.dias-checkboxes {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dia-checkbox-label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: .88rem;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    transition: .2s;
}

.dia-checkbox-label:has(input:checked) {
    background: rgba(237, 28, 36, .08);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.dia-checkbox-label input {
    accent-color: var(--primary-red);
}

/* Month Picker — Colored Dots */
.month-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 6px;
    vertical-align: middle;
}

.month-dot-busy {
    background: #ef5350;
    box-shadow: 0 0 4px rgba(239, 83, 80, .5);
}

.month-dot-free {
    background: #66bb6a;
    box-shadow: 0 0 4px rgba(102, 187, 106, .5);
}

.cal-month-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* Dashboard percentage badge */
.prof-pct-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 800;
    font-size: .85rem;
    color: #2e7d32;
    background: rgba(46, 125, 50, .1);
    white-space: nowrap;
}

/* Sunday cells — distinct gray + disabled */
.cal-day.domingo {
    opacity: .5 !important;
    pointer-events: none !important;
}

.cal-day.domingo .cal-day-num {
    color: var(--text-muted);
}

.links-sub.active-sub {
    background: rgba(255, 255, 255, 0.2);
    font-weight: 800;
    color: #fff;
}

/* --- Simulation Mode UI Updates --- */
.form-grid-simulation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: var(--sim-form-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.sim-resource-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
}

.sim-resource-item {
    padding: 12px 18px;
    border-bottom: 1px solid var(--sim-item-border);
    background: var(--sim-item-bg);
    font-size: 0.88rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}

.sim-resource-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-tema="escuro"] .sim-resource-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sim-resource-item:last-child {
    border-bottom: none;
}

.sim-resource-item small {
    color: var(--text-muted);
}

.item-suggestion-main {
    border-left: 4px solid #4caf50 !important;
    background: rgba(76, 175, 80, 0.05) !important;
}

.sim-btn-swap {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sim-btn-swap:hover {
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.sim-badge-avail {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.sim-badge-high {
    background: rgba(46, 125, 50, 0.1);
    color: #2e7d32;
}

.sim-badge-mid {
    background: rgba(255, 143, 0, 0.1);
    color: #ef6c00;
}

.sim-badge-low {
    background: rgba(198, 40, 40, 0.1);
    color: #c62828;
}

#dashboard-simulation-modal.active {
    display: flex !important;
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    background-color: rgba(0, 0, 0, 0.4) !important;
}

#dashboard-simulation-modal .modal-content {
    background: var(--card-bg) !important;
    color: var(--text-color) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2) !important;
    border-radius: 20px !important;
    max-width: 900px !important;
}

#dashboard-simulation-modal .modal-header {
    background: var(--card-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

#dashboard-simulation-modal .form-grid-simulation {
    background: var(--sim-form-bg) !important;
    border: 1px solid var(--border-color) !important;
}

/* ==========================================
   MODAL CADASTRAR HORÁRIO — Melhorias
   ========================================== */

#modal-agendar-calendar {
    z-index: 1000;
}

#modal-agendar-calendar .modal-content,
#scheduleModal .modal-content {
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    padding: 20px;
}

#modal-agendar-calendar .modal-header,
#scheduleModal .modal-header {
    background: linear-gradient(135deg, var(--primary-red) 0%, #c91c1c 100%);
    color: #fff;
    padding: 20px 25px;
    border-radius: 16px 16px 0 0;
}

#modal-agendar-calendar .modal-header h3,
#scheduleModal .modal-header h3 {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

#modal-agendar-calendar .modal-header .modal-close,
#scheduleModal .modal-header .modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transition: all 0.3s ease;
}

#modal-agendar-calendar .modal-header .modal-close:hover,
#scheduleModal .modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#modal-agendar-calendar .modal-info,
#scheduleModal .modal-info {
    background: rgba(237, 28, 36, 0.05);
    border-left: 4px solid var(--primary-red);
    margin-top: 10px;
    margin-bottom: 20px;
    padding: 12px 15px;
}

#form-agendar-calendar {
    display: flex;
    flex-direction: column;
    gap: 0;
}

#form-agendar-calendar .form-group {
    margin-bottom: 18px;
    background: var(--card-bg);
    padding: 0;
}

#form-agendar-calendar .form-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#form-agendar-calendar .form-input,
#form-agendar-calendar select {
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

#form-agendar-calendar .form-input:focus,
#form-agendar-calendar select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.15);
    background: var(--card-bg);
}

#form-agendar-calendar .form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 18px;
}

#form-agendar-calendar .form-group-last {
    margin-bottom: 18px;
}

/* Melhorados checkboxes de dias da semana */
#form-agendar-calendar .dias-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

#form-agendar-calendar .dia-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

#form-agendar-calendar .dia-checkbox-label:hover {
    border-color: var(--primary-red);
    background: rgba(237, 28, 36, 0.03);
    transform: translateY(-2px);
}

#form-agendar-calendar .dia-checkbox-label input {
    accent-color: var(--primary-red);
    cursor: pointer;
    width: 18px;
    height: 18px;
}

#form-agendar-calendar .dia-checkbox-label:has(input:checked) {
    background: linear-gradient(135deg, rgba(237, 28, 36, 0.1), rgba(237, 28, 36, 0.05));
    border-color: var(--primary-red);
    color: var(--primary-red);
    box-shadow: 0 2px 8px rgba(237, 28, 36, 0.15);
}

/* Simulação toggle */
#form-agendar-calendar .form-group[style*="margin-top: 15px"] {
    background: linear-gradient(135deg, rgba(237, 28, 36, 0.05), rgba(237, 28, 36, 0.02));
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(237, 28, 36, 0.1);
    margin-bottom: 18px;
}

#form-agendar-calendar .form-group[style*="margin-top: 15px"] .dia-checkbox-label {
    border: 2px solid var(--primary-red);
    background: rgba(237, 28, 36, 0.05);
    padding: 12px 15px;
    margin: 0;
    border-radius: 8px;
    width: 100%;
    justify-content: flex-start;
}

#form-agendar-calendar .form-group[style*="margin-top: 15px"] .dia-checkbox-label:hover {
    background: rgba(237, 28, 36, 0.1);
    transform: none;
    border-color: #c91c1c;
}

#form-agendar-calendar .form-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
}

#form-agendar-calendar .form-actions .btn {
    flex: 1;
    padding: 13px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#form-agendar-calendar .form-actions .btn-primary,
#scheduleModal .btn-primary {
    background: linear-gradient(135deg, var(--primary-red), #c91c1c);
    box-shadow: 0 4px 15px rgba(237, 28, 36, 0.3);
    width: 100%;
    justify-content: center;
    padding: 15px;
    font-size: 1rem;
}

#form-agendar-calendar .form-actions .btn-primary:hover,
#scheduleModal .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(237, 28, 36, 0.4);
}

/* Responsive para tablet/mobile */
@media (max-width: 768px) {
    #modal-agendar-calendar .modal-content {
        width: 95%;
        max-width: none;
    }

    #form-agendar-calendar .form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 15px;
    }

    #form-agendar-calendar .dias-checkboxes {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* ==========================================
   MODAL MODO SIMULAÇÃO — Melhorias
   ========================================== */

#dashboard-simulation-modal .modal-content {
    max-width: 850px;
    max-height: 90vh;
    overflow-y: auto;
}

#dashboard-simulation-modal .modal-header {
    background: linear-gradient(135deg, #2e7d32 0%, #1b5e20 100%);
    color: #fff;
    padding: 20px 25px;
}

#dashboard-simulation-modal .modal-header h3 {
    color: var(--corTxt3);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

#dashboard-simulation-modal .modal-header .modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    transition: all 0.3s ease;
}

#dashboard-simulation-modal .modal-header .modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

#dashboard-simulation-modal .form-grid-simulation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
}

#dashboard-simulation-modal .form-group {
    margin-bottom: 0;
}

#dashboard-simulation-modal .form-label {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-color);
    margin-bottom: 8px;
}

#dashboard-simulation-modal .form-input,
#dashboard-simulation-modal select {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

#dashboard-simulation-modal .form-input:focus,
#dashboard-simulation-modal select:focus {
    outline: none;
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

/* Checkboxes de dias da semana na simulação */
#dashboard-simulation-modal [style*="display: flex; gap: 8px; flex-wrap: wrap"] {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)) !important;
    gap: 10px !important;
    margin-top: 10px !important;
}

#dashboard-simulation-modal .sim-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#dashboard-simulation-modal .sim-checkbox-label:hover {
    border-color: #2e7d32;
    background: rgba(46, 125, 50, 0.03);
    transform: translateY(-2px);
}

#dashboard-simulation-modal .sim-checkbox-label input {
    accent-color: #2e7d32;
    cursor: pointer;
    width: 18px;
    height: 18px;
}

#dashboard-simulation-modal .sim-checkbox-label:has(input:checked) {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.1), rgba(46, 125, 50, 0.05));
    border-color: #2e7d32;
    color: #1b5e20;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

/* Buttons de período */
#dashboard-simulation-modal .sim-period-selector {
    display: flex !important;
    gap: 12px !important;
    margin-top: 10px !important;
}

#dashboard-simulation-modal .sim-period {
    flex: 1;
    padding: 12px 14px;
    border: 2px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#dashboard-simulation-modal .sim-period:hover {
    border-color: #2e7d32;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
}

#dashboard-simulation-modal .sim-period.active {
    background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
    color: #fff !important;
    border-color: #1b5e20 !important;
    box-shadow: 0 6px 15px rgba(46, 125, 50, 0.3) !important;
}

/* Layout do grid de 2 colunas para resultados */
#dashboard-simulation-modal [style*="display: grid; grid-template-columns: 1fr 1fr"] {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 25px !important;
}

#dashboard-simulation-modal .sim-resource-list {
    border: 2px solid var(--border-color) !important;
    border-radius: 12px !important;
    background: var(--card-bg) !important;
    max-height: 350px !important;
    overflow-y: auto !important;
}

#dashboard-simulation-modal .sim-resource-item {
    padding: 14px 16px !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: transparent !important;
    font-size: 0.9rem !important;
    transition: all 0.2s ease;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
}

#dashboard-simulation-modal .sim-resource-item:hover {
    background: rgba(46, 125, 50, 0.03) !important;
    padding-left: 18px !important;
}

#dashboard-simulation-modal .sim-resource-item:last-child {
    border-bottom: none !important;
}

#dashboard-simulation-modal .item-suggestion-main {
    border-left: 5px solid #2e7d32 !important;
    background: rgba(46, 125, 50, 0.08) !important;
    padding: 14px 16px !important;
    font-weight: 600;
}

#dashboard-simulation-modal .sim-badge-avail {
    padding: 4px 10px !important;
    border-radius: 6px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
}

#dashboard-simulation-modal .form-actions {
    display: flex !important;
    gap: 12px !important;
    margin-top: 25px !important;
    grid-column: span 2 !important;
}

#dashboard-simulation-modal .form-actions .btn-primary {
    flex: 1;
    padding: 13px 20px;
    background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
    transition: all 0.3s ease;
}

#dashboard-simulation-modal .form-actions .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

/* Responsive para tablet/mobile */
@media (max-width: 768px) {
    #dashboard-simulation-modal .modal-content {
        width: 95%;
        max-width: none;
    }

    #dashboard-simulation-modal .form-grid-simulation {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    #dashboard-simulation-modal [style*="display: grid; grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    #dashboard-simulation-modal .form-actions {
        grid-column: span 1 !important;
    }

    #dashboard-simulation-modal [style*="display: flex; gap: 8px; flex-wrap: wrap"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Alert Messages */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.alert-error {
    background: rgba(237, 28, 36, 0.08);
    border: 1px solid rgba(237, 28, 36, 0.2);
    color: #c62828;
}

.alert-success {
    background: rgba(46, 125, 50, 0.08);
    border: 1px solid rgba(46, 125, 50, 0.2);
    color: #2e7d32;
}

[data-tema="escuro"] .alert-error {
    background: rgba(237, 28, 36, 0.12);
    color: #ef5350;
}

[data-tema="escuro"] .alert-success {
    background: rgba(46, 125, 50, 0.12);
    color: #66bb6a;
}

/* Role Badges */
.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
}

.role-admin {
    background: rgba(237, 28, 36, 0.1);
    color: var(--primary-red);
}

.role-gestor {
    background: rgba(25, 118, 210, 0.1);
    color: #1976d2;
}

/* Hide reserva floating bar on pages without agenda_professores.css */
.reserva-floating-bar {
    display: none;
}