:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --bg-color: #f3f4f6;
    --surface: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 10px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Typography */
h1, h2, h3 {
    color: var(--text-main);
    font-weight: 600;
}

h1 { font-size: 2rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }

/* Cards & Forms */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.form-group {
    margin-bottom: 1.25rem;
}

/* Modals Overlay & Styling */
.card.hidden { display: none !important; }

#gradeModal, #editSubmissionModal, #editUserModal, #editSubjectModal, #editClassModal, #editAssignModal, #editNoticeModal, #newChatModal, #studentDetailModal, #editStudentModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* Modal Grande (Ficha do Aluno) */
#studentDetailModal {
    width: 95% !important;
    max-width: 1200px !important;
    height: 95vh;
    display: flex;
    flex-direction: column;
}

#studentDetailModal form {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

/* Background Overlay when modal is open */
.modal-open-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    border-color: var(--primary);
    box-shadow: none;
    outline: 2px solid rgba(79, 70, 229, 0.4);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    font-family: inherit;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background-color: var(--primary); color: white; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary { background-color: var(--secondary); color: white; }
.btn-secondary:hover { background-color: var(--secondary-hover); }

.btn-danger { background-color: var(--danger); color: white; }
.btn-danger:hover { background-color: var(--danger-hover); }

.btn-block { width: 100%; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
    display: none;
}
.alert.show { display: block; }
.alert-success { background-color: #d1fae5; color: #065f46; border: 1px solid #34d399; }
.alert-warning { background-color: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-danger { background-color: #fee2e2; color: #991b1b; border: 1px solid #f87171; }

/* Navbar */
.navbar {
    background: var(--primary);
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}
.navbar-brand { font-size: 1.25rem; font-weight: 600; color: white; text-decoration: none; }
.nav-links { display: flex; align-items: center; }
.nav-links a { color: white; text-decoration: none; margin-left: 1.5rem; font-weight: 500; opacity: 0.9; transition: opacity 0.2s;}
.nav-links a:hover { opacity: 1; }
.hamburger { display: none; background: none; border: none; font-size: 1.8rem; cursor: pointer; color: white; }

@media (max-width: 768px) {
    .hamburger { display: block; }
    .nav-links { display: none; width: 100%; flex-direction: column; text-align: center; margin-top: 1rem; }
    .nav-links.active { display: flex; }
    .nav-links a { margin: 0.5rem 0; margin-left: 0; width: 100%; padding: 0.5rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* Tables */
.table-container { overflow-x: auto; margin-top: 1.5rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); overflow: hidden; }
thead { background-color: #f9fafb; border-bottom: 2px solid var(--border); }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.05em; }
tbody tr:hover { background-color: #f9fafb; }

/* Table Utilities */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.table-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

table th, table td {
    vertical-align: middle;
}
/* Layout Grid */
.dashboard-grid { display: grid; grid-template-columns: 250px 1fr; gap: 2rem; min-height: calc(100vh - 64px); }

.sidebar { background: var(--surface); padding: 2rem; border-right: 1px solid var(--border); }
.sidebar-nav { list-style: none; }
.sidebar-nav li { margin-bottom: 0.5rem; }
.sidebar-nav a { display: block; padding: 0.75rem 1rem; color: var(--text-main); text-decoration: none; border-radius: var(--radius); transition: background 0.2s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--primary); color: white; }

.main-content { padding: 2rem; }

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.align-end { align-items: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.hidden { display: none !important; }

/* Margins */
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Badges & Status */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.badge-pending { background-color: #fef3c7; color: #92400e; border: 1px solid #fcd34d; } /* Amarelo para Em Andamento */
.badge-resolved { background-color: #d1fae5; color: #065f46; border: 1px solid #34d399; } /* Verde para Concluído */

/* Utilities Extra */
.flex-wrap { flex-wrap: wrap; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }

/* Loading Spinner */
.loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Chat Styles */
.conversation-item:hover {
    background-color: var(--bg-color);
}
.conversation-item.active {
    background-color: #eef2ff !important;
    border-left: 4px solid var(--primary);
}
#chatMessages::-webkit-scrollbar {
    width: 6px;
}
#chatMessages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}
#chatMessages {
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
/* Student Mural Styles */
.mural-header {
    margin-bottom: 2rem;
    text-align: center;
}

.search-container {
    max-width: 600px;
    margin: 0 auto 2rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 50px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.student-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.student-card {
    background: var(--surface);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    text-align: center;
}

.student-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.student-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    border: 4px solid var(--bg-color);
}

.student-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.student-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.student-ra {
    background: var(--bg-color);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.student-email {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
}

.student-email:hover {
    text-decoration: underline;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* Photo Preview Styles */
.preview-container {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--border);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--bg-color);
    position: relative;
}

.preview-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 0.5rem;
}
