/* ===== EduCheck — Professional Teacher Management System ===== */

/* === Reset & Variables === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0f1117;
    --bg-secondary: #161923;
    --bg-card: #1c1f2e;
    --bg-card-hover: #222639;
    --bg-sidebar: #12141e;
    --bg-input: #1a1d2b;
    --border: #2a2d3e;
    --border-light: #353849;
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa8;
    --text-muted: #5c6080;
    --accent: #6c5ce7;
    --accent-hover: #7d6ff0;
    --accent-glow: rgba(108, 92, 231, 0.25);
    --green: #00d68f;
    --green-bg: rgba(0, 214, 143, 0.12);
    --red: #ff6b7a;
    --red-bg: rgba(255, 107, 122, 0.12);
    --blue: #4da6ff;
    --blue-bg: rgba(77, 166, 255, 0.12);
    --yellow: #ffcb57;
    --yellow-bg: rgba(255, 203, 87, 0.12);
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.12);
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --transition: 0.2s ease;
}

html {
    font-size: 14px;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.brand-name {
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--text-primary);
    display: block;
}

.brand-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    cursor: pointer;
}

.nav-item:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    font-weight: 600;
}

.nav-item .material-icons-round {
    font-size: 20px;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border);
}

/* === Mobile Topbar === */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    z-index: 999;
}

.mobile-title {
    flex: 1;
    font-weight: 700;
    font-size: 1.1rem;
}

.user-avatar-sm {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

/* === Main Content === */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 32px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Page Header === */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* === Buttons === */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 16px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary .material-icons-round {
    font-size: 18px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-ghost:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-icon:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 16px;
}

.btn-action:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.btn-action .material-icons-round {
    font-size: 16px;
}

/* === Stats Row === */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.si-blue {
    background: var(--blue-bg);
    color: var(--blue);
}

.si-purple {
    background: var(--purple-bg);
    color: var(--purple);
}

.si-green {
    background: var(--green-bg);
    color: var(--green);
}

.si-red {
    background: var(--red-bg);
    color: var(--red);
}

.si-yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.stat-data {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* === Filters === */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    transition: border-color var(--transition);
}

.search-box:focus-within {
    border-color: var(--accent);
}

.search-box .material-icons-round {
    color: var(--text-muted);
    font-size: 20px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 12px 0;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition);
    appearance: auto;
}

.filter-select:focus {
    border-color: var(--accent);
}

/* === Card / Table === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.table-card {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.87rem;
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--bg-card-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

.th-num {
    width: 50px;
    text-align: center;
}

.th-turma {
    width: 100px;
}

.th-points {
    width: 100px;
    text-align: center;
}

.th-actions {
    width: 150px;
    text-align: center;
}

.th-score {
    width: 80px;
    text-align: center;
}

.th-falta {
    width: 100px;
    text-align: center;
}

td:first-child {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
}

.td-name {
    font-weight: 500;
}

.td-name-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.table-avatar-initials {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.6rem;
    color: #fff;
    flex-shrink: 0;
}

.td-turma {
    color: var(--text-secondary);
}

.td-points {
    text-align: center;
    font-weight: 700;
}

.td-points.positive {
    color: var(--green);
}

.td-points.negative {
    color: var(--red);
}

.td-points.zero {
    color: var(--text-muted);
}

.actions-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.no-results {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.no-results .material-icons-round {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.no-results p {
    font-size: 0.9rem;
}

/* === Selector Bar (Atividades/Presença) === */
.selector-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.selector-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selector-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* === Activity Header Bar === */
.ativ-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 16px 0;
    flex-wrap: wrap;
    gap: 12px;
}

.summary-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.chip .material-icons-round {
    font-size: 16px;
}

.chip-accent {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 700;
}

.chip-green {
    background: var(--green-bg);
    color: var(--green);
    border-color: rgba(0, 214, 143, 0.3);
}

.chip-red {
    background: var(--red-bg);
    color: var(--red);
    border-color: rgba(255, 107, 122, 0.3);
}

.activity-count-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-count {
    width: 30px;
    height: 30px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-count:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-count .material-icons-round {
    font-size: 18px;
}

.count-display {
    font-weight: 800;
    font-size: 1.1rem;
    min-width: 24px;
    text-align: center;
}

.page-actions {
    margin-top: 24px;
    display: flex;
    justify-content: center;
}

/* === Checkboxes === */
.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-checkbox {
    cursor: pointer;
    display: flex;
}

.custom-checkbox input {
    display: none;
}

.checkmark-box {
    width: 28px;
    height: 28px;
    background: var(--bg-input);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkmark-box .material-icons-round {
    font-size: 18px;
    color: transparent;
    transition: all 0.15s ease;
}

.custom-checkbox input:checked+.checkmark-box {
    background: var(--green);
    border-color: var(--green);
}

.custom-checkbox input:checked+.checkmark-box .material-icons-round {
    color: #fff;
}

.custom-checkbox:hover .checkmark-box {
    border-color: var(--accent);
}

/* Falta checkbox */
.falta-checkbox input:checked+.checkmark-box {
    background: var(--red);
    border-color: var(--red);
}

.falta-checkbox:hover .checkmark-box {
    border-color: var(--red);
}

/* Score badges */
.score-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.78rem;
}

.score-none {
    background: var(--red-bg);
    color: var(--red);
}

.score-low {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.score-mid {
    background: var(--blue-bg);
    color: var(--blue);
}

.score-full {
    background: var(--green-bg);
    color: var(--green);
}

/* === Modals === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    animation: modalSlide 0.25s ease;
    box-shadow: var(--shadow);
    margin: auto;
}

.modal-sm {
    max-width: 440px;
}

.modal-lg {
    max-width: 720px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-weight: 700;
    font-size: 1.1rem;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition);
}

.btn-close:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}

.btn-close-abs {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-group .optional {
    text-transform: none;
    font-weight: 400;
    color: var(--text-muted);
}

.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
}

.toggle-group {
    display: flex;
    gap: 8px;
}

.toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all var(--transition);
}

.toggle-btn:hover {
    border-color: var(--border-light);
}

.toggle-btn.active[data-tipo="atribuir"] {
    background: var(--green-bg);
    color: var(--green);
    border-color: var(--green);
}

.toggle-btn.active[data-tipo="tirar"] {
    background: var(--red-bg);
    color: var(--red);
    border-color: var(--red);
}

.toggle-btn .material-icons-round {
    font-size: 18px;
}

.points-student-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.points-current {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.points-current strong {
    color: var(--accent);
    font-weight: 800;
}

/* === Profile Modal === */
.profile-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 28px 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.profile-avatar-wrapper {
    position: relative;
    width: 68px;
    height: 68px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
}

.profile-avatar-wrapper:hover .avatar-overlay {
    opacity: 1;
}

.profile-avatar-lg {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.4rem;
    color: #fff;
    flex-shrink: 0;
}

.profile-avatar-img {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.avatar-overlay .material-icons-round {
    font-size: 22px;
    color: #fff;
}

.btn-remove-foto {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 10px;
    background: var(--red-bg);
    border: 1px solid rgba(255, 107, 122, 0.3);
    border-radius: 8px;
    color: var(--red);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-remove-foto:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

.btn-remove-foto .material-icons-round {
    font-size: 14px;
}

.profile-hero-info h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-purple {
    background: var(--purple-bg);
    color: var(--purple);
}

.profile-points-display {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--yellow);
    font-weight: 700;
}

.profile-points-display .material-icons-round {
    font-size: 18px;
}

.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 20px 24px;
}

.pstat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pstat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pstat-icon .material-icons-round {
    font-size: 18px;
}

.psi-green {
    background: var(--green-bg);
    color: var(--green);
}

.psi-red {
    background: var(--red-bg);
    color: var(--red);
}

.psi-blue {
    background: var(--blue-bg);
    color: var(--blue);
}

.psi-yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.pstat-val {
    font-weight: 800;
    font-size: 1rem;
    display: block;
    line-height: 1.2;
}

.pstat-lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: block;
}

.profile-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 0 24px 16px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
}

.chart-card h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chart-card canvas {
    max-height: 180px;
}

.profile-section {
    padding: 0 24px 20px;
}

.profile-section h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Ranking Bars */
.ranking-bars {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ranking-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ranking-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 80px;
    flex-shrink: 0;
}

.ranking-bar {
    flex: 1;
    height: 24px;
    background: var(--bg-input);
    border-radius: 12px;
    overflow: hidden;
}

.ranking-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.6s ease;
    min-width: 8px;
}

.rf-green {
    background: linear-gradient(90deg, var(--green), #00e6a0);
}

.rf-blue {
    background: linear-gradient(90deg, var(--blue), #6dc0ff);
}

.rf-yellow {
    background: linear-gradient(90deg, var(--yellow), #ffe082);
}

.ranking-pos {
    font-weight: 800;
    font-size: 0.85rem;
    min-width: 50px;
    text-align: right;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 240px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    gap: 12px;
}

.history-item .hi-date {
    color: var(--text-muted);
    font-weight: 500;
    min-width: 80px;
}

.history-item .hi-valor {
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

.history-item .hi-valor.hi-pos {
    color: var(--green);
}

.history-item .hi-valor.hi-neg {
    color: var(--red);
}

.history-item .hi-obs {
    flex: 1;
    color: var(--text-secondary);
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item .hi-faltou {
    color: var(--red);
    font-weight: 600;
}

.history-item .hi-presente {
    color: var(--green);
    font-weight: 600;
}

.empty-state {
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    z-index: 5000;
    font-weight: 500;
    font-size: 0.85rem;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* === Animations === */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes bounceCheck {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(0.9);
    }

    70% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-16px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* Page entrance animations */
.page {
    animation: fadeIn 0.3s ease;
}

.page-header {
    animation: fadeInUp 0.4s ease;
}

.stats-row .stat-card {
    animation: fadeInUp 0.5s ease backwards;
}

.stats-row .stat-card:nth-child(1) {
    animation-delay: 0.05s;
}

.stats-row .stat-card:nth-child(2) {
    animation-delay: 0.1s;
}

.stats-row .stat-card:nth-child(3) {
    animation-delay: 0.15s;
}

/* Card hover effects */
.stat-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.05), transparent);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.1);
}

.stat-card:hover::after {
    opacity: 1;
}

.students-table tbody tr,
.ativ-row {
    transition: background 0.1s ease;
}

.students-table tbody tr:hover,
.ativ-row:hover {
    background: var(--bg-card-hover) !important;
}

/* Button glow effects */
.btn-primary {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Checkbox bounce animation */
.custom-checkbox input:checked+.checkmark-box {
    animation: bounceCheck 0.35s ease;
}

/* === New Activities Page === */
.ativ-create-card {
    padding: 24px 28px;
    animation: fadeInUp 0.5s ease 0.1s backwards;
}

.card-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.card-section-title .material-icons-round {
    color: var(--accent);
    font-size: 22px;
}

.ativ-create-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.ativ-name-group {
    flex: 1;
    min-width: 200px;
}

.ativ-name-group input {
    width: 100%;
}

/* Activity Edit Section */
.ativ-edit-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ativ-edit-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-purple {
    background: var(--purple-bg);
    color: var(--purple);
}

/* Table scroll for wide tables */
.table-scroll {
    overflow-x: auto;
    margin: -1px;
}

/* Activity header columns */
.th-prev-ativ,
.th-current-ativ,
.th-total {
    text-align: center !important;
    min-width: 80px;
    max-width: 110px;
}

.th-ativ-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 0;
}

.th-ativ-name {
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 90px;
}

.th-ativ-date {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-muted);
}

.th-ativ-current {
    color: var(--accent);
}

.th-ativ-current .th-ativ-date {
    color: var(--accent);
    font-weight: 700;
    background: var(--accent-glow);
    padding: 1px 6px;
    border-radius: 4px;
}

.th-total {
    font-weight: 700;
}

/* Previous activity checks */
.td-prev-check {
    text-align: center !important;
}

.prev-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.prev-check .material-icons-round {
    font-size: 20px;
}

.prev-done {
    color: var(--green);
    opacity: 0.7;
}

.prev-miss {
    color: var(--red);
    opacity: 0.35;
}

/* Total badge */
.td-total {
    text-align: center !important;
}

.total-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 10px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--purple-bg);
    color: var(--purple);
    border: 1px solid rgba(167, 139, 250, 0.2);
}

/* Activity List Section */
.ativ-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ativ-list-header .card-section-title {
    margin-bottom: 0;
}

.ativ-list-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ativ-list-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    animation: slideIn 0.4s ease backwards;
    transition: all 0.2s ease;
    overflow: hidden;
}

.ativ-list-item:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.ativ-list-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ativ-list-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ativ-list-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--purple-bg);
    color: var(--purple);
}

.ativ-list-icon .material-icons-round {
    font-size: 20px;
}

.ativ-list-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.ativ-list-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 3px 10px;
    border-radius: 12px;
}

.ativ-list-item-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ativ-list-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
}

.ativ-list-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.ativ-list-bar-fill.pct-high {
    background: var(--green);
}

.ativ-list-bar-fill.pct-mid {
    background: var(--yellow);
}

.ativ-list-bar-fill.pct-low {
    background: var(--red);
}

/* Current check column highlight */
.td-current-check {
    text-align: center !important;
    background: rgba(108, 92, 231, 0.06);
}

.th-current-ativ {
    background: rgba(108, 92, 231, 0.08) !important;
}

/* Badge green */
.badge-green {
    background: var(--green-bg);
    color: var(--green);
}

/* Modal md size */
.modal-md {
    max-width: 600px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlide 0.25s ease;
    box-shadow: var(--shadow);
    padding: 28px 32px;
    width: 100%;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    z-index: 10;
}

.modal-close:hover {
    background: var(--red-bg);
    border-color: var(--red);
    color: var(--red);
}

.modal-close .material-icons-round {
    font-size: 18px;
}

/* Activity Detail Modal */
.ativ-detail-header {
    margin-bottom: 24px;
}

.ativ-detail-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.ativ-detail-meta {
    display: flex;
    gap: 8px;
}

.ativ-detail-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ativ-detail-col h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.ativ-detail-col h4 .material-icons-round {
    font-size: 18px;
}

.ativ-detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 400px;
    overflow-y: auto;
}

.ativ-detail-list li {
    padding: 10px 14px;
    font-size: 0.85rem;
    border-radius: var(--radius-xs);
    animation: fadeInUp 0.2s ease backwards;
    margin-bottom: 2px;
}

.ativ-detail-list li:nth-child(even) {
    background: var(--bg-input);
}

.ativ-detail-list .empty-li {
    color: var(--text-muted);
    font-style: italic;
}

.ativ-list-pct {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 90px;
    text-align: right;
}

.pct-high {
    color: var(--green);
}

.pct-mid {
    color: var(--yellow);
}

.pct-low {
    color: var(--red);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    color: var(--text-muted);
    text-align: center;
    animation: fadeIn 0.4s ease;
}

.empty-state .material-icons-round {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Sidebar animation */
.nav-item {
    transition: all 0.2s ease;
}

.nav-item:hover {
    transform: translateX(4px);
}

/* Card entrance animation */
.card {
    transition: all 0.2s ease;
}

.table-card {
    animation: fadeInUp 0.5s ease 0.15s backwards;
}

/* Refined table styling */
.students-table tbody tr,
#ativ-tbody tr,
#pres-tbody tr {
    transition: background 0.15s ease;
}

/* Action buttons subtle animation */
.action-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* === Responsive === */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 80px 16px 24px;
    }

    .profile-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
    }

    .page-header h1 {
        font-size: 1.4rem;
    }
}

/* === Observation Card (Presença) === */
.obs-card {
    padding: 24px 28px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.obs-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.obs-card-title .material-icons-round {
    font-size: 20px;
    color: var(--accent);
}

.obs-textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
    min-height: 80px;
}

.obs-textarea:focus {
    border-color: var(--accent);
}

.obs-textarea::placeholder {
    color: var(--text-muted);
}

/* === Chamada Detail Modal === */
.chamada-obs-display {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: var(--accent-glow);
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.chamada-obs-display .material-icons-round {
    font-size: 18px;
    color: var(--accent);
    margin-top: 2px;
    flex-shrink: 0;
}

.chamada-obs-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.chamada-list-info {
    display: flex;
    flex-direction: column;
}

/* === Detail Student (with avatar in detail lists) === */
.detail-student {
    display: flex;
    align-items: center;
    gap: 10px;
}

.list-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.list-avatar-initials {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.5rem;
    color: #fff;
    flex-shrink: 0;
}

/* === Sidebar Avatar Image === */
.user-avatar-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-sm-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar-user:hover {
    background: var(--bg-card);
    transition: background var(--transition);
}

/* === Professor Profile Modal === */
.prof-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

/* ===== BIMESTRE SELECTOR (Sidebar) ===== */
.bimestre-selector-block {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.bimestre-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.bimestre-label .material-icons-round {
    font-size: 14px;
}

.bimestre-pills {
    display: flex;
    gap: 4px;
}

.bim-pill {
    flex: 1;
    padding: 6px 4px;
    border-radius: var(--radius-xs);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    text-align: center;
}

.bim-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.bim-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 10px var(--accent-glow);
}

/* ===== BIMESTRE BADGE (Page header) ===== */
.page-header-badge {
    display: flex;
    align-items: center;
}

.bimestre-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--accent-glow);
    border: 1px solid var(--accent);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    animation: fadeIn 0.3s ease;
}

/* ===== BIMESTRE GROUP (Lists) ===== */
.bimestre-group {
    margin-bottom: 28px;
    animation: fadeIn 0.3s ease;
}

.bimestre-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 12px;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 16px;
}

.bimestre-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--accent);
}

.bimestre-group-title .material-icons-round {
    font-size: 18px;
}

.bimestre-group-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 3px 10px;
    border-radius: 12px;
}

/* ===== LIST FILTERS (multi-select row) ===== */
.list-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* ===== ATIV LIST ITEM REWORK (with actions) ===== */
.ativ-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: all var(--transition);
    animation: slideInCard 0.35s ease both;
    display: flex;
    flex-direction: column;
}

@keyframes slideInCard {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ativ-list-item:hover {
    border-color: var(--border-light);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.ativ-list-item-main {
    cursor: pointer;
    padding: 14px 16px 12px;
    flex: 1;
}

.ativ-list-item-actions {
    display: flex;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.btn-list-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition);
    color: var(--text-muted);
}

.btn-list-action .material-icons-round {
    font-size: 15px;
}

.btn-list-edit:hover {
    background: var(--accent-glow);
    color: var(--accent);
}

.btn-list-delete:hover {
    background: var(--red-bg);
    color: var(--red);
}

.btn-list-action + .btn-list-action {
    border-left: 1px solid var(--border);
}

/* ===== BTN-ACTION-DANGER (delete in table) ===== */
.btn-action-danger:hover {
    border-color: var(--red);
    color: var(--red);
    background: var(--red-bg);
}

/* ===== BTN-DANGER (confirm delete button) ===== */
.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-danger:hover {
    background: #e8556a;
    box-shadow: 0 4px 16px rgba(255, 107, 122, 0.35);
    transform: translateY(-1px);
}

.btn-danger .material-icons-round {
    font-size: 18px;
}

/* ===== MODAL DANGER (confirm delete) ===== */
.modal-danger .modal-header {
    border-bottom-color: rgba(255, 107, 122, 0.2);
}

.danger-icon-wrap {
    width: 70px;
    height: 70px;
    margin: 8px auto 16px;
    background: var(--red-bg);
    border: 2px solid rgba(255, 107, 122, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dangerPulse 1.5s ease-in-out infinite;
}

@keyframes dangerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 122, 0.3); }
    50% { box-shadow: 0 0 0 10px rgba(255, 107, 122, 0); }
}

.danger-icon {
    font-size: 32px !important;
    color: var(--red);
}

.confirm-msg {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.confirm-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ============================================================
   VISUAL OVERHAUL — Professional Effects & Animations
   ============================================================ */

/* ── Glassmorphism Modal Overlay ── */
.modal-overlay {
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal-box {
    background: rgba(28, 31, 46, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(108, 92, 231, 0.08);
    animation: modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.93) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-overlay.active .modal-box {
    animation: modalIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Full-Record Edit Modal ── */
.modal-edit-full {
    width: min(680px, 96vw);
    max-width: min(680px, 96vw);
    display: flex;
    flex-direction: column;
}

.modal-edit-full .modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px 24px;
}

.edit-full-meta {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.edit-full-meta .form-group {
    flex: 1;
    min-width: 160px;
}

/* ── Student Record Section ── */
.student-record-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.student-record-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.student-record-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.student-record-title .material-icons-round {
    font-size: 16px;
    color: var(--accent);
}

.student-record-bulk {
    display: flex;
    gap: 6px;
}

.btn-bulk {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
}

.btn-bulk .material-icons-round {
    font-size: 13px;
}

.btn-bulk:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.student-toggle-list {
    padding: 6px 0;
}

/* ── Student Toggle Row ── */
.student-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    transition: background var(--transition);
    animation: fadeInRow 0.3s ease both;
    gap: 12px;
}

@keyframes fadeInRow {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.student-toggle-row:hover {
    background: var(--bg-card-hover);
}

.student-toggle-row + .student-toggle-row {
    border-top: 1px solid rgba(255,255,255,0.04);
}

.student-toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.student-toggle-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent) 0%, #8b6cf6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.7rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.student-toggle-name {
    font-size: 0.86rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Toggle Switch ── */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.toggle-switch input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.toggle-slider {
    display: flex;
    align-items: center;
    width: 92px;
    height: 32px;
    background: rgba(255, 107, 122, 0.18);
    border: 1px solid rgba(255, 107, 122, 0.3);
    border-radius: 16px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    width: 26px;
    height: 26px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 1;
}

.toggle-label-on,
.toggle-label-off {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    position: absolute;
    transition: opacity 0.2s ease;
}

.toggle-label-on {
    right: 9px;
    color: var(--green);
    opacity: 0;
}

.toggle-label-off {
    right: 9px;
    color: var(--red);
    opacity: 1;
}

/* Checked (presente/fez) state */
.toggle-switch input:checked + .toggle-slider {
    background: rgba(0, 214, 143, 0.18);
    border-color: rgba(0, 214, 143, 0.4);
}

.toggle-switch input:checked + .toggle-slider::before {
    left: calc(100% - 29px);
    background: var(--green);
    box-shadow: 0 2px 10px rgba(0, 214, 143, 0.4);
}

.toggle-switch input:checked + .toggle-slider .toggle-label-on {
    opacity: 1;
    right: auto;
    left: 9px;
}

.toggle-switch input:checked + .toggle-slider .toggle-label-off {
    opacity: 0;
}

.toggle-switch:hover .toggle-slider {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Skeleton Loaders ── */
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}

.skeleton-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
}

.skeleton-text-wrap {
    flex: 1;
}

.skeleton-text {
    height: 13px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
}

.skeleton-text.wide { width: 60%; }

.skeleton-toggle {
    width: 92px;
    height: 32px;
    border-radius: 16px;
    flex-shrink: 0;
    background: linear-gradient(90deg, var(--border) 25%, var(--border-light) 50%, var(--border) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
}

/* ── Micro-interactions: Buttons ── */
.btn-primary:active,
.btn-danger:active,
.btn-ghost:active,
.btn-action:active {
    transform: scale(0.96) !important;
    transition: transform 0.08s ease !important;
}

.btn-primary:hover {
    box-shadow: 0 4px 18px var(--accent-glow), 0 0 0 1px var(--accent);
}

/* ── Spinning icon for loading state ── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.btn-spin {
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

/* ── Enhanced Stat Cards ── */
.stat-card {
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-light);
}

/* Coloured top-border on stat icons */
.stat-card:nth-child(1) { border-top: 2px solid var(--blue); }
.stat-card:nth-child(2) { border-top: 2px solid var(--green); }
.stat-card:nth-child(3) { border-top: 2px solid var(--yellow); }
.stat-card:nth-child(4) { border-top: 2px solid var(--purple); }

.stat-card:nth-child(1):hover { box-shadow: 0 8px 32px rgba(77,166,255,0.15); }
.stat-card:nth-child(2):hover { box-shadow: 0 8px 32px rgba(0,214,143,0.15); }
.stat-card:nth-child(3):hover { box-shadow: 0 8px 32px rgba(255,203,87,0.15); }
.stat-card:nth-child(4):hover { box-shadow: 0 8px 32px rgba(167,139,250,0.15); }

/* ── Sidebar Brand Gradient Accent ── */
.sidebar-brand {
    background: linear-gradient(135deg, rgba(108,92,231,0.08) 0%, transparent 100%);
    border-bottom: 1px solid rgba(108,92,231,0.15);
}

/* ── Toast animation overhaul ── */
/* Remove the always-on animation from .toast - keep show/hide via transform */
/* Override the base transform so .show works with the spring animation */
.toast.show {
    transform: translateX(-50%) translateY(0) !important;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(30px) scale(0.9); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

/* Override the base transition when hiding so it slides back down */
.toast:not(.show) {
    transform: translateX(-50%) translateY(100px) !important;
    transition: transform 0.3s ease, opacity 0.3s ease !important;
    opacity: 0;
}

/* ── Table row hover lift ── */
.table-row:hover {
    background: var(--bg-card-hover);
    transform: translateX(2px);
    transition: all 0.15s ease;
}

/* ── NavItem slide-in animation ── */
.nav-item {
    animation: navSlideIn 0.4s ease both;
}

.nav-item:nth-child(1) { animation-delay: 0.05s; }
.nav-item:nth-child(2) { animation-delay: 0.10s; }
.nav-item:nth-child(3) { animation-delay: 0.15s; }
.nav-item:nth-child(4) { animation-delay: 0.20s; }

@keyframes navSlideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Card grid stagger ── */
.stat-card {
    animation: cardFadeUp 0.5s ease both;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }

@keyframes cardFadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Reduce motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Score Input (tabela de criação) ── */
.td-score {
    width: 80px;
    padding: 4px 6px;
}

.score-input {
    width: 78px;
    padding: 5px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--yellow);
    font-size: 0.82rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    text-align: right;
    letter-spacing: 0.03em;
    transition: all var(--transition);
    cursor: text;
}

.score-input:focus {
    outline: none;
    border-color: var(--yellow);
    box-shadow: 0 0 0 2px rgba(255, 203, 87, 0.18);
    background: rgba(255, 203, 87, 0.05);
}

.score-input:hover {
    border-color: var(--border-light);
}

/* Score input compact (inside edit modal rows) */
.score-input-sm {
    width: 72px;
    padding: 4px 7px;
    font-size: 0.78rem;
}

/* Student toggle row with score */
.student-toggle-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ===== BIMESTRE CURRENT DISPLAY ===== */
.bim-current-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
}

.bim-current-display .material-icons-round {
    font-size: 16px;
}

.btn-finalizar-bimestre {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-finalizar-bimestre:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(139, 92, 246, 0.08);
}

.btn-finalizar-bimestre:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-finalizar-bimestre .material-icons-round {
    font-size: 16px;
}

/* Logout nav item */
.nav-logout {
    color: var(--text-muted) !important;
}

.nav-logout:hover {
    color: #f87171 !important;
    background: rgba(248, 113, 113, 0.08) !important;
}

/* Score header column */
.th-score-col {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ===================================================================
   NOVOS ESTILOS — Back button, bimestre chips, animações premium
   =================================================================== */

/* ── Back Button ── */
.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-back:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateX(-3px);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-back:active {
    transform: scale(0.9) translateX(-2px);
    transition: transform 0.08s ease;
}

.btn-back .material-icons-round {
    font-size: 18px;
}

/* ── Bimestre chips in table headers ── */
.th-bim-chip {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    background: var(--accent-glow);
    border: 1px solid rgba(108,92,231,0.3);
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.04em;
    white-space: nowrap;
    margin-bottom: 3px;
}

.th-bim-chip-current {
    background: linear-gradient(135deg, var(--accent), #8b6cf6);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(108,92,231,0.35);
}

/* ── Toggle bimestre button ── */
.btn-bim-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-bim-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-glow);
}

.btn-bim-toggle.active {
    background: var(--accent-glow);
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 0 2px rgba(108,92,231,0.2);
}

.btn-bim-toggle .material-icons-round {
    font-size: 16px;
}

/* ── Ativ header right (flex container) ── */
.ativ-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ── Enhanced table scroll ── */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.table-scroll::-webkit-scrollbar {
    height: 4px;
}

.table-scroll::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 2px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 2px;
}

.table-scroll table {
    min-width: max-content;
}

/* ── Current bimestre group highlight ── */
.bimestre-group-current .bimestre-group-header {
    border-bottom-color: var(--accent);
    background: linear-gradient(90deg, rgba(108,92,231,0.04) 0%, transparent 100%);
    border-radius: var(--radius-xs) var(--radius-xs) 0 0;
    padding: 10px 4px 12px;
}

.bimestre-group-current .bimestre-group-title {
    color: var(--accent);
}

/* ── "Atual" tag inside bimestre title ── */
.bim-atual-tag {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
}

/* ── Unsaved modal icon ── */
.unsaved-icon-wrap {
    width: 64px;
    height: 64px;
    background: var(--yellow-bg);
    border: 2px solid rgba(255,203,87,0.35);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: dangerPulse 2s ease-in-out infinite;
}

/* ── Nav item active indicator bar ── */
.nav-item {
    position: relative;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

/* ── Modal overlay transition ── */
.modal-overlay:not(.active) {
    display: none;
}

/* ── Premium card hover ── */

/* ── Premium card hover ── */
.ativ-create-card {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ativ-create-card:hover {
    border-color: rgba(108,92,231,0.25);
    box-shadow: 0 4px 28px rgba(108,92,231,0.06);
}

/* ── Filter select hover ── */
.filter-select {
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.filter-select:hover {
    border-color: var(--border-light);
}

.filter-select:focus {
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Search box focus glow ── */
.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Toast icon bounce ── */
#toast.show .material-icons-round {
    animation: bounceCheck 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* ── Table avatar hover scale ── */
.table-avatar,
.table-avatar-initials {
    transition: transform 0.18s ease;
}

tbody tr:hover .table-avatar,
tbody tr:hover .table-avatar-initials {
    transform: scale(1.1);
}

/* ── Sidebar user hover ── */
.sidebar-user {
    border-radius: var(--radius-sm);
    margin: 4px 8px;
    padding: 12px;
    transition: background 0.2s ease, transform 0.2s ease;
}

.sidebar-user:hover {
    background: var(--bg-card);
    transform: translateX(2px);
}

/* ── Ativ list item premium hover ── */
.ativ-list-item {
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.ativ-list-item:hover {
    border-color: rgba(108,92,231,0.3);
    box-shadow: 0 6px 24px rgba(108,92,231,0.08);
    transform: translateY(-2px);
}

/* ── Bimestre badge subtle glow ── */
.bimestre-badge {
    animation: fadeIn 0.3s ease, badgePulse 3s ease-in-out 1s;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 14px var(--accent-glow); }
}

/* ── Profile avatar wrapper ring ── */
.profile-avatar-wrapper {
    transition: box-shadow 0.2s ease;
}

.profile-avatar-wrapper:hover {
    box-shadow: 0 0 0 3px var(--accent);
}

/* ── Btn ripple ── */
.btn-primary::after,
.btn-ghost::after,
.btn-danger::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.08);
    opacity: 0;
    transition: opacity 0.12s ease;
    border-radius: inherit;
}

.btn-primary:active::after,
.btn-ghost:active::after,
.btn-danger:active::after {
    opacity: 1;
}

/* ── Summary chips stagger ── */
.summary-chips .chip {
    animation: fadeInUp 0.3s ease both;
}
.summary-chips .chip:nth-child(1) { animation-delay: 0.05s; }
.summary-chips .chip:nth-child(2) { animation-delay: 0.10s; }
.summary-chips .chip:nth-child(3) { animation-delay: 0.15s; }

/* ── Bimestre group entrance ── */
.bimestre-group {
    animation: cardFadeUp 0.35s ease both;
}
.bimestre-group:nth-child(2) { animation-delay: 0.06s; }
.bimestre-group:nth-child(3) { animation-delay: 0.12s; }
.bimestre-group:nth-child(4) { animation-delay: 0.18s; }

/* ── Responsive adjustments ── */
@media (max-width: 900px) {
    .btn-back {
        width: 34px;
        height: 34px;
    }

    .ativ-header-right {
        gap: 8px;
    }

    .btn-bim-toggle {
        padding: 6px 10px;
    }

    .btn-bim-toggle #btn-toggle-bim-text {
        display: none;
    }
}

@media (max-width: 600px) {
    .ativ-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .ativ-header-right {
        width: 100%;
    }
}

/* ── Reduced motion override ── */
@media (prefers-reduced-motion: reduce) {
    .btn-back:hover { transform: none; }
    .ativ-list-item:hover { transform: none; }
    .stat-card:hover { transform: none; }
}

/* ===================================================================
   TABELA DE ATIVIDADES — rodapé com nomes de colunas sincronizado
   =================================================================== */

#ativ-edit-content .table-scroll {
    max-height: 62vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Footer fora do table-scroll: não rola verticalmente, rola junto horizontalmente */
.ativ-col-footer {
    overflow: hidden;
    border-top: 2px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    background: var(--bg-secondary);
}

.ativ-col-footer-inner {
    display: flex;
    overflow: hidden;
    min-width: max-content;
}

.ativ-col-footer-cell {
    padding: 10px 16px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* ===================================================================
   PERFIL — Atividades detalhadas por bimestre
   =================================================================== */

.prof-ativ-bim-group {
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    animation: cardFadeUp 0.3s ease both;
}

.prof-ativ-bim-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.prof-ativ-bim-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.prof-ativ-bim-summary {
    font-size: 0.75rem;
    font-weight: 700;
}

.prof-ativ-list {
    display: flex;
    flex-direction: column;
}

.prof-ativ-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 0.82rem;
    transition: background 0.15s ease;
    animation: fadeInRow 0.3s ease both;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.prof-ativ-item:last-child {
    border-bottom: none;
}

.prof-ativ-item:hover {
    background: var(--bg-card-hover);
}

/* Check icon */
.prof-ativ-check {
    font-size: 16px !important;
    flex-shrink: 0;
}

.ativ-feita .prof-ativ-check {
    color: var(--green);
}

.ativ-nao-feita .prof-ativ-check {
    color: var(--red);
    opacity: 0.5;
}

/* Nome da atividade */
.prof-ativ-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.ativ-nao-feita .prof-ativ-name {
    color: var(--text-muted);
}

/* Data */
.prof-ativ-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* % da turma (bem discreto) */
.prof-ativ-turma-pct {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.15s ease;
}

.prof-ativ-item:hover .prof-ativ-turma-pct {
    opacity: 1;
}

.turma-high { color: var(--green); }
.turma-mid  { color: var(--yellow); }
.turma-low  { color: var(--red); }

/* ===================================================================
   MODAL SCROLL LOCK — iOS/iPad
   =================================================================== */

body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

.modal-content,
.profile-modal-content {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* ===================================================================
   NOTA AUTOMÁTICA DE ATIVIDADES
   =================================================================== */

.notas-calculator {
    margin-top: 18px;
    padding: 24px 28px;
}

.notas-calculator-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.notas-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.notas-title-row h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-wrap: balance;
}

.notas-title-icon {
    color: var(--green);
    font-size: 23px !important;
}

.notas-auto-badge,
.notas-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    background: var(--green-bg);
    color: var(--green);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 4px 9px;
    white-space: nowrap;
}

.notas-auto-badge .material-icons-round,
.notas-status .material-icons-round {
    font-size: 14px;
}

.notas-calculator-header p {
    max-width: 72ch;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.55;
    text-wrap: pretty;
}

.notas-controls {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.notas-controls .selector-group {
    min-width: 145px;
}

.notas-value-group {
    flex: 1;
    min-width: 220px !important;
}

.notas-value-input-wrap {
    display: flex;
    align-items: center;
    min-height: 42px;
    overflow: hidden;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.notas-value-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.notas-value-input-wrap > span {
    align-self: stretch;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    font-size: 0.76rem;
    font-weight: 700;
}

.notas-value-input-wrap input {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 13px;
    color: var(--text-primary);
    background: transparent;
    border: 0;
    outline: 0;
    font: inherit;
    font-weight: 700;
}

.notas-value-input-wrap input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
    opacity: 1;
}

.notas-help {
    display: flex;
    align-items: center;
    min-height: 20px;
    margin-top: 9px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.notas-results {
    margin-top: 20px;
}

.notas-loading,
.notas-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 88px;
    padding: 18px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.notas-loading .material-icons-round,
.notas-empty > .material-icons-round {
    color: var(--accent);
    font-size: 24px;
    flex-shrink: 0;
}

.notas-empty {
    justify-content: flex-start;
}

.notas-empty strong {
    display: block;
    margin-bottom: 3px;
    color: var(--text-primary);
    font-size: 0.84rem;
}

.notas-empty p {
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.45;
}

.notas-empty-inline {
    margin-top: 14px;
}

.notas-error {
    background: var(--red-bg);
}

.notas-error > .material-icons-round,
.notas-error strong {
    color: var(--red);
}

.notas-summary {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 68px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.notas-summary-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    min-width: 160px;
    padding: 13px 18px;
    border-right: 1px solid var(--border);
}

.notas-summary-item span {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.notas-summary-item strong {
    color: var(--text-primary);
    font-size: 0.96rem;
    font-variant-numeric: tabular-nums;
}

.notas-summary .notas-status {
    align-self: center;
    margin: 14px 16px 14px auto;
}

.notas-status-preview {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.notas-table-wrap {
    margin-top: 14px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.notas-table {
    width: 100%;
    min-width: 670px;
    border-collapse: collapse;
}

.notas-table th {
    padding: 11px 14px;
    text-align: left;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.notas-table th:last-child,
.notas-table td:last-child {
    text-align: right;
}

.notas-table td {
    padding: 11px 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    vertical-align: middle;
}

.notas-table tbody tr:last-child td {
    border-bottom: 0;
}

.notas-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.notas-student {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 230px;
    font-weight: 600;
}

.notas-student-index {
    width: 20px;
    color: var(--text-secondary);
    font-size: 0.72rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.notas-progress-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    font-variant-numeric: tabular-nums;
}

.notas-progress {
    display: block;
    width: 64px;
    height: 5px;
    overflow: hidden;
    background: var(--bg-input);
    border-radius: 999px;
}

.notas-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    transition: width 0.22s ease-out;
}

.notas-progress .nota-high { background: var(--green); }
.notas-progress .nota-mid { background: var(--yellow); }
.notas-progress .nota-low { background: var(--red); }

.notas-formula {
    color: var(--text-secondary) !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.notas-final-value {
    color: var(--green) !important;
    font-size: 0.92rem !important;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 760px) {
    .notas-calculator {
        padding: 20px;
    }

    .notas-controls {
        align-items: stretch;
    }

    .notas-controls .selector-group,
    .notas-value-group {
        flex: 1 1 calc(50% - 8px);
        min-width: 145px !important;
    }

    .notas-controls .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .notas-summary {
        flex-wrap: wrap;
    }

    .notas-summary-item {
        flex: 1 1 33.333%;
        min-width: 130px;
    }

    .notas-summary .notas-status {
        width: calc(100% - 28px);
        justify-content: center;
        margin: 10px 14px 14px;
    }
}

@media (max-width: 520px) {
    .notas-calculator {
        padding: 18px 16px;
    }

    .notas-controls .selector-group,
    .notas-value-group {
        flex-basis: 100%;
    }

    .notas-summary-item {
        flex-basis: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .notas-summary-item:last-of-type {
        border-bottom: 0;
    }

    .notas-table {
        min-width: 0;
    }

    .notas-table thead {
        display: none;
    }

    .notas-table tbody,
    .notas-table tr,
    .notas-table td {
        display: block;
        width: 100%;
    }

    .notas-table tr {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 9px 16px;
        padding: 14px;
        border-bottom: 1px solid var(--border);
    }

    .notas-table tbody tr:last-child {
        border-bottom: 0;
    }

    .notas-table td,
    .notas-table td:last-child {
        padding: 0;
        border: 0;
        text-align: left;
    }

    .notas-table td::before {
        display: block;
        margin-bottom: 3px;
        content: attr(data-label);
        color: var(--text-secondary);
        font-size: 0.66rem;
        font-weight: 600;
    }

    .notas-table .notas-student {
        grid-column: 1 / -1;
        min-width: 0;
        padding-bottom: 9px;
        border-bottom: 1px solid var(--border);
    }

    .notas-table .notas-student::before {
        display: none;
    }

    .notas-table .notas-formula {
        display: none;
    }

    .notas-table .notas-final-value {
        text-align: right;
    }

    .notas-progress-cell {
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .notas-progress > span {
        transition: none;
    }
}
.turma-low  { color: var(--red); }

/* ===== Refinamento de acabamento — identidade e estrutura originais ===== */
:root {
    --text-secondary: #a0a5bc;
    --text-muted: #838aa5;
    --border: rgba(163, 173, 218, 0.12);
    --border-light: rgba(163, 173, 218, 0.22);
    --premium-highlight: rgba(255, 255, 255, 0.045);
    --premium-depth: 0 2px 4px rgba(0, 0, 0, 0.12), 0 12px 28px rgba(0, 0, 0, 0.12);
    --premium-focus: rgba(167, 139, 250, 0.65);
    --transition: 180ms cubic-bezier(0.23, 1, 0.32, 1);
    color-scheme: dark;
}

body { line-height: 1.5; }
.page-header h1 { font-weight: 700; letter-spacing: -0.035em; }
.page-subtitle { line-height: 1.6; }
.brand-name { font-weight: 700; letter-spacing: -0.025em; }
.brand-icon { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(108, 92, 231, 0.16); }
.brand-sub { letter-spacing: 0.035em; }
.user-avatar, .user-avatar-sm, .user-avatar-img { box-shadow: 0 0 0 1px var(--premium-highlight); }

.sidebar { border-right-color: var(--border); }
.nav-item { transition: background var(--transition), color var(--transition); }
.nav-item.active { color: #b9afff; background: rgba(108, 92, 231, 0.17); box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.13); }
.nav-item:hover:not(.active) { background: rgba(163, 173, 218, 0.055); }
.bim-current-display { color: #b9afff; border-color: rgba(167, 139, 250, 0.22); background: rgba(108, 92, 231, 0.12); }
.btn-finalizar-bimestre { min-height: 36px; }

.card, .settings-card, .stat-card { box-shadow: inset 0 1px 0 var(--premium-highlight), var(--premium-depth); }
.stats-row .stat-card { padding: 22px; animation: none; opacity: 1 !important; transform: none !important; }
.stats-row .stat-card:nth-child(1) { border-top-color: rgba(77, 166, 255, 0.55); }
.stats-row .stat-card:nth-child(2) { border-top-color: rgba(167, 139, 250, 0.55); }
.stats-row .stat-card:nth-child(3) { border-top-color: rgba(0, 214, 143, 0.55); }
.stats-row .stat-card:hover { border-color: var(--border-light); box-shadow: inset 0 1px 0 var(--premium-highlight), var(--premium-depth); }
.stat-card::before, .stat-card::after { display: none; }
.stat-icon { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035); }
.stat-number { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.stat-label { margin-top: 7px; font-size: 0.8rem; }
/* CSS and GSAP both animate these elements in the original page. */
.sidebar .nav-item, .sidebar-user { animation: none; opacity: 1 !important; }

.btn-primary, .btn-ghost, .btn-danger, .filter-select { min-height: 40px; }
.btn-primary, .btn-ghost, .btn-danger, .btn-action, .btn-icon, .btn-close {
    transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.btn-primary { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 3px 8px rgba(0, 0, 0, 0.18); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 4px 12px rgba(108, 92, 231, 0.2); }
.btn-primary:active:not(:disabled), .btn-danger:active:not(:disabled), .btn-ghost:active:not(:disabled), .btn-action:active:not(:disabled) { transform: scale(0.98) !important; }
.btn-primary:disabled, .btn-ghost:disabled, .btn-action:disabled { opacity: 0.45; box-shadow: none; transform: none; cursor: not-allowed; }
.btn-ghost { background: rgba(255, 255, 255, 0.018); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.045); }
.btn-action { width: 34px; height: 34px; background: rgba(255, 255, 255, 0.018); border-color: rgba(163, 173, 218, 0.09); }
.btn-action:hover { background: rgba(108, 92, 231, 0.14); border-color: rgba(167, 139, 250, 0.3); color: #b9afff; }
.btn-action-danger:hover { background: var(--red-bg); border-color: rgba(255, 107, 122, 0.3); color: var(--red); }
.btn-close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; }

.search-box, .filter-select, .form-group input, .form-group select, .obs-textarea {
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.search-box:hover, .filter-select:hover { border-color: var(--border-light); }
.search-box:focus-within { border-color: var(--premium-focus); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--premium-focus); outline-offset: 3px;
}
.search-box input:focus-visible { outline: none; }

.table-card { border-color: var(--border); }
thead th { padding-top: 15px; padding-bottom: 15px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.065em; color: var(--text-secondary); }
tbody td { border-bottom-color: rgba(163, 173, 218, 0.075); }
#students-table tbody td { padding-top: 13px; padding-bottom: 13px; }
#students-table tbody tr:hover { background: rgba(108, 92, 231, 0.065); }
.td-name { font-weight: 500; letter-spacing: -0.012em; }
.td-name-wrapper { gap: 12px; }
.td-points, .score-input, .pstat-number { font-variant-numeric: tabular-nums; }
.table-avatar { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08); }
.table-avatar-initials { background: rgba(108, 92, 231, 0.2); color: #c3b9ff; box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.16); font-size: 0.64rem; }
.actions-cell { gap: 6px; }

.modal-overlay { background: rgba(5, 7, 14, 0.72); backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px); }
.modal-box { background: var(--bg-card); border-color: var(--border-light); border-radius: 14px; box-shadow: inset 0 1px 0 var(--premium-highlight), 0 24px 64px rgba(0, 0, 0, 0.4); }
.modal-header h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.025em; }
.modal-body { padding-top: 24px; padding-bottom: 24px; }
.modal-footer { background: rgba(0, 0, 0, 0.06); border-radius: 0 0 14px 14px; }
.form-group label { font-size: 0.75rem; letter-spacing: 0.045em; margin-bottom: 8px; }
.form-group input, .form-group select { min-height: 42px; }
.danger-icon-wrap { animation: none; }

@media (max-width: 600px) {
    .stats-row .stat-card { padding: 18px 20px; }
    .stat-number { font-size: 1.7rem; }
    .modal-body { padding-top: 20px; padding-bottom: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
