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

:root {
    --primary: #1a6b3c;
    --primary-dark: #145530;
    --accent: #f5a623;
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #2d3748;
    --muted: #718096;
    --border: #e2e8f0;
    --danger: #e53e3e;
    --success: #38a169;
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 1rem; }

header.site-header {
    background: var(--primary);
    color: #fff;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,.15);
}
header.site-header .container { display: flex; align-items: center; justify-content: space-between; }
header.site-header h1 { font-size: 1.25rem; font-weight: 600; }
header.site-header nav a { color: #ffffffcc; margin-left: 1.25rem; font-size: .9rem; }
header.site-header nav a:hover { color: #fff; text-decoration: none; }

main { padding: 2rem 0; }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; color: var(--primary); }

/* Buttons */
.btn {
    display: inline-block;
    padding: .55rem 1.25rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .95rem;
    font-weight: 500;
    transition: opacity .15s;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.btn-sm { padding: .3rem .75rem; font-size: .85rem; }
.btn-action {
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
}
.btn-action svg { flex-shrink: 0; }

/* Forms */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .9rem; font-weight: 500; margin-bottom: .4rem; }
.form-control {
    width: 100%;
    padding: .55rem .85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .95rem;
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary); }
textarea.form-control { resize: vertical; min-height: 90px; }

/* Alerts */
.alert { padding: .85rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .95rem; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }
.alert-danger  { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.alert-info    { background: #ebf8ff; color: #2b6cb0; border: 1px solid #bee3f8; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--bg); font-weight: 600; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* Rating input */
.rating-group { display: flex; flex-direction: column; }
.professor-rating {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.professor-rating:last-child { border-bottom: none; }
.professor-rating .prof-name { min-width: 180px; font-weight: 500; }
.stars { display: flex; gap: .25rem; }
.stars input[type=radio] { display: none; }
.stars label {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 1.75rem;
    cursor: pointer;
    color: #cbd5e0;
    transition: color .1s;
    line-height: 1;
}
.stars label::after {
    content: attr(title);
    font-size: .6rem;
    color: var(--muted);
    margin-top: .15rem;
    line-height: 1;
}
.stars input[type=radio]:checked ~ label,
.stars label:hover,
.stars label:hover ~ label { color: #f6ad55; }
/* reverse trick */
.stars { flex-direction: row-reverse; }
.stars label:hover,
.stars label:hover ~ label,
.stars input[type=radio]:checked ~ label { color: #f6ad55; }

.nota-display { font-size: .9rem; color: var(--muted); min-width: 40px; }

/* Admin sidebar nav */
.admin-layout { display: flex; gap: 1.5rem; align-items: flex-start; }
.admin-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 0;
}
.admin-sidebar a {
    display: block;
    padding: .6rem 1.25rem;
    color: var(--text);
    font-size: .92rem;
}
.admin-sidebar a:hover, .admin-sidebar a.active {
    background: #edf7f1;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.admin-content { flex: 1; min-width: 0; }

/* Page title */
.page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 1.25rem; }

/* Misc */
.text-muted { color: var(--muted); font-size: .9rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 99px;
    font-size: .78rem;
    font-weight: 600;
}
.badge-green { background: #c6f6d5; color: #276749; }
.badge-red   { background: #fed7d7; color: #c53030; }

/* Side Panel */
.side-panel-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 200;
}
.side-panel-backdrop.open { display: block; }
.side-panel {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 420px; max-width: 100vw;
    background: var(--card);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    z-index: 201;
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform .25s ease;
}
.side-panel.open { transform: translateX(0); }
.side-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.side-panel-title { font-size: 1.05rem; font-weight: 600; color: var(--primary); }
.side-panel-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.25rem; color: var(--muted); line-height: 1;
    padding: .25rem .5rem; border-radius: 4px;
}
.side-panel-close:hover { background: var(--bg); color: var(--text); }
.side-panel-body { padding: 1.75rem; overflow-y: auto; flex: 1; }

/* Modal */
.modal-backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 300;
    align-items: center;
    justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
    background: var(--card);
    border-radius: 10px;
    padding: 1.75rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 30px rgba(0,0,0,.2);
}
.modal-title { font-size: 1.1rem; font-weight: 600; color: var(--primary); margin-bottom: 1.25rem; }

/* Questão de avaliação */
.questao-card { border-left: 4px solid var(--primary); }
.questao-card .card-title { font-size: 1rem; font-weight: 500; color: var(--text); margin-bottom: 1.1rem; }

/* Progress bar */
.progress-wrap { background: #e2e8f0; border-radius: 99px; height: 8px; overflow: hidden; margin-bottom: 1.5rem; }
.progress-bar  { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.filter-bar .form-control { width: auto; flex: 1; min-width: 160px; }
.filter-bar select.form-control { flex: 0 0 auto; width: auto; }

/* Sort links */
.sort-link {
    color: var(--muted);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}
.sort-link:hover { color: var(--primary); text-decoration: none; }
.sort-link.active { color: var(--primary); }

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .5rem;
    border-radius: 5px;
    font-size: .88rem;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    text-decoration: none;
    transition: background .12s, color .12s;
}
a.page-link:hover { background: var(--bg); color: var(--primary); text-decoration: none; }
.page-current { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-link.disabled { color: var(--border); cursor: not-allowed; }
.page-ellipsis { border: none; background: none; cursor: default; }

/* Import modal */
.modal-lg { max-width: 560px; }
.import-errors {
    max-height: 180px;
    overflow-y: auto;
    font-size: .85rem;
    margin: .75rem 0;
    padding: .5rem .75rem;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 6px;
    color: #c53030;
}

@media (max-width: 640px) {
    .admin-layout { flex-direction: column; }
    .admin-sidebar { width: 100%; }
    .professor-rating { flex-direction: column; align-items: flex-start; }
}
