/* ==========================================================================
   1. ESTILO BASE E VARIÁVEIS
   ========================================================================== */
:root {
    --bg: #f1f5f9;
    --fg: #0f172a;
    --muted: #64748b;
    --accent: #0ea5e9;
    --accent-2: #22c55e;
    --card: #ffffff;
    --radius: 14px;
    --container: 1200px;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
    --border-color: #e5e7eb;

    /* Variáveis Adicionadas */
    --danger-color: #ef4444;
    --border-radius-lg: 16px;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
    --background-color: #f8fafc;
    --background-color-light: #f1f5f9;
    --background-gradient-light: linear-gradient(120deg, #e0f2fe, #f0fdf4);
    --text-color-dark: #1e293b;
    --text-color-secondary: #64748b;
    --card-bg-color: #ffffff; /* Variável para fundo do modal */
    --text-color-primary: #0f172a;
    --text-color-heading: #0f172a;
}

html.dark {
    --bg: #111827;
    --fg: #f3f4f6;
    --card: #1f2937;
    --muted: #9ca3af;
    --border-color: #4b5563;
    
    /* Variáveis Adicionadas (Modo Escuro) */
    --danger-color: #f87171;
    --background-color: #111827;
    --background-color-light: #374151;
    --background-gradient-light: linear-gradient(120deg, #1e3a8a, #14532d);
    --text-color-dark: #f9fafb;
    --text-color-secondary: #9ca3af;
    --card-bg-color: #1f2937; /* Variável para fundo do modal */
    --text-color-primary: #f3f4f6;
    --text-color-heading: #f3f4f6;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Inter, system-ui, Arial;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
    min-height: 100vh;
}

/* ==========================================================================
   2. LAYOUT PRINCIPAL DA APLICAÇÃO (SAAS)
   ========================================================================== */
.app-layout {
    display: flex;
}

.sidebar {
    width: 250px;
    background-color: var(--card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    transition: transform 0.3s ease-in-out;
}

.sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.sidebar-header .brand {
    font-size: 1.5rem;
    color: var(--accent);
}

.sidebar-nav {
    flex-grow: 1;
    padding: 1rem 0;
    overflow-y: auto;
}
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    margin: 0.25rem 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    color: var(--muted);
    transition: all 0.2s ease;
}
.sidebar-nav .nav-link:hover {
    background-color: var(--bg);
    color: var(--fg);
}
.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: white;
    font-weight: 600;
}
.sidebar-nav .nav-link .icon {
    font-size: 1.2rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.main-content {
    flex-grow: 1;
    margin-left: 250px;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease-in-out;
    min-height: 100vh;
}
.main-header {
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: var(--card);
    position: sticky;
    top: 0;
    z-index: 100;
}

main {
    overflow-y: auto;
    flex-grow: 1;
    padding: 2rem;
}

/* --- Layout Responsivo --- */
#mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}
#mobile-menu-toggle svg {
    width: 30px;
    height: 30px;
    color: var(--fg);
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.is-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    #mobile-menu-toggle {
        display: block;
    }
}

/* ==========================================================================
   3. CONTROLES DO CABEÇALHO E MENUS
   ========================================================================== */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* --- Botão de Tema (Sol/Lua) --- */
#theme-toggle {
    background: none;
    border: 2px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .3s ease;
    padding: 0;
}
#theme-toggle:hover {
    border-color: var(--accent);
    transform: rotate(15deg) scale(1.1);
}
#theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--muted);
    transition: color .3s ease;
}
#theme-toggle:hover svg {
    color: var(--accent);
}

/* --- Imagem e Dropdown de Perfil --- */
#profile-menu-container {
    position: relative;
}
.profile-menu-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    position: relative;
    overflow: visible;
    cursor: pointer;
}
.profile-menu-button::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--accent), var(--accent-2));
    z-index: -1;
    filter: blur(5px);
    transition: all .3s ease;
    opacity: 0.8;
}
.profile-menu-button:hover::before {
    opacity: 1;
    filter: blur(8px);
}
.profile-menu-button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--card);
}
#profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    background-color: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    z-index: 100;
    overflow: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform-origin: top right;
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    pointer-events: none;
}
#profile-dropdown:not(.hidden) {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}
.profile-dropdown-userinfo {
    padding: 1rem;
}
.profile-dropdown-userinfo p {
    margin: 0;
    line-height: 1.4;
}
.profile-dropdown-userinfo .user-name {
    font-weight: 600;
    color: var(--fg);
}
.profile-dropdown-userinfo .user-email {
    font-size: 0.85rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.profile-dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}
#profile-dropdown a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    font-size: 0.95rem;
    color: var(--fg);
    transition: background-color .2s;
}
#profile-dropdown a:hover {
    background-color: var(--bg);
}
#profile-dropdown #logout-btn {
    color: #ef4444;
}

/* ==========================================================================
   4. COMPONENTES REUTILIZÁVEIS
   ========================================================================== */
.page {
    animation: fade .5s ease-in-out;
}
@keyframes fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
.page h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--fg);
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.page-subtitle {
    font-size: 1rem;
    color: var(--muted);
    margin-top: -0.5rem;
}
.button {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    color: white;
    font-size: 15px;
    line-height: 1.5; /* Garante alinhamento vertical */
}
.button:hover {
    opacity: .9;
    transform: translateY(-2px);
}
.button-primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.button-secondary {
    background-color: #f59e0b;
}
.button-danger {
    background-color: #ef4444;
}
.button-info {
    background-color: #3b82f6;
}
.button-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.list-item {
    background-color: var(--card);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.list-item-content {
    flex-grow: 1;
}
.list-item-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--fg);
    margin: 0;
}
.list-item-subtitle {
    font-size: .9rem;
    color: var(--muted);
    margin: .25rem 0 0;
}
.list-item-actions {
    display: flex;
    gap: .5rem;
    flex-shrink: 0;
}
.empty-list-message {
    color: var(--muted);
    text-align: center;
    padding: 2rem;
    background-color: var(--card);
    border-radius: var(--radius);
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: .5rem;
    color: var(--fg);
}
.form-input, select.form-input, textarea.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg);
    color: var(--fg);
    font-size: 1rem;
    font-family: inherit;
    transition: box-shadow .2s;
}
.form-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.3);
}
.form-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.form-radio-group label {
    display: flex;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
}
.widget {
    background-color: var(--card);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}
.widget h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    margin-top: 0;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.results-table th, .results-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.results-table th {
    font-weight: 600;
    color: var(--muted);
}

/* ==========================================================================
   5. ESTILOS FUNCIONAIS E ESPECÍFICOS
   ========================================================================== */
.loader {
    border: 4px solid var(--bg);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.answer-cell {
    transition: background-color 0.2s ease-in-out;
    border: 1px solid var(--border-color);
    padding: 8px;
    text-align: center;
    cursor: pointer;
}
.answer-cell.selected {
    background-color: #4ade80;
    color: #fff;
    font-weight: 700;
}
.answer-cell.selected-key {
    background-color: #3b82f6;
    color: #fff;
    font-weight: 700;
}
.correct-answer {
    background-color: rgba(74,222,128,.4)!important;
}
.incorrect-answer {
    background-color: rgba(248,113,113,.4)!important;
}
.answer-cell.selected.incorrect-answer {
    background-color: #ef4444!important;
    color: #fff;
}

/* --- Página de Início (Home/Dashboard) --- */
.dashboard-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; gap: 1rem; color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.kpi-section { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.kpi-card { background-color: var(--card); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; text-align: center; }
.kpi-value { font-size: 2.5rem; font-weight: 700; color: var(--accent); line-height: 1; }
.kpi-label { font-size: 1rem; color: var(--muted); margin-top: 0.5rem; }
@media (min-width: 992px) { .main-section { grid-template-columns: 2fr 1fr; align-items: start; } }
.chart-container { position: relative; height: 300px; }

/* --- Página Turmas --- */
.turmas-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.5rem; }
.turma-card { background-color: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; transition: all 0.2s ease; cursor: pointer; }
.turma-card:hover { transform: translateY(-5px); box-shadow: 0 12px 28px rgba(0,0,0,0.12); }
.turma-card h2 { font-size: 1.25rem; margin-top: 0; color: var(--accent); }

/* --- Página do Corretor --- */
.file-dropzone { border: 2px dashed var(--border-color); border-radius: var(--radius); padding: 2rem; text-align: center; transition: background-color .2s; }
.file-dropzone:hover { background-color: var(--bg); }
.file-dropzone label { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .5rem; color: var(--muted); }
.file-dropzone svg { stroke: var(--muted); }
.roi-canvas { border: 2px solid var(--border-color); max-width: 100%; height: auto; cursor: crosshair; margin: 1rem auto; }
#status { width: 100%; display: flex; justify-content: center; }
.status-indicator { display: flex; justify-content: center; align-items: center; gap: 1rem; padding: 2rem; font-size: 1.1rem; width: 100%; }
.status-indicator p { margin: 0; }
.corrector-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: start; }
@media (min-width: 1024px) { .corrector-layout { grid-template-columns: 1fr 1fr; } }
.corrector-column { display: flex; flex-direction: column; gap: 1.5rem; }
.score-display { text-align: center; font-size: 1.2rem; font-weight: 600; margin-bottom: 2rem; background-color: var(--card); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.score-display span { color: var(--accent-2); font-size: 1.5rem; }
.form-group-inline { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 500px) { .form-group-inline { grid-template-columns: 1fr 1fr; } }
.answers-widget h3, .preview-widget h3 { text-align: center; font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.preview-container { border: 1px solid var(--border-color); border-radius: var(--radius); max-height: 400px; overflow: auto; background-color: var(--bg); }
.preview-container canvas, .preview-container img { max-width: none; }
.zoom-controls { display: flex; justify-content: center; align-items: center; gap: .5rem; margin-top: .5rem; }
.zoom-controls .button { padding: 0; width: 32px; height: 32px; line-height: 32px; background-color: var(--bg); color: var(--fg); border: 1px solid var(--border-color); }
.zoom-controls span { font-weight: 500; width: 50px; text-align: center; }
.answers-widget { background-color: var(--card); padding: 1rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.interactive-grid { display: grid; grid-template-columns: repeat(var(--grid-cols, 2), 1fr); gap: 1.5rem; justify-content: stretch; }
.interactive-table { width: 100%; text-align: center; border-collapse: collapse; }
.interactive-table td, .interactive-table th { padding: 8px 10px; border: 1px solid var(--border-color); }
.interactive-table th { font-weight: 700; }
.interactive-table td:first-child { font-weight: 700; }
.corrector-actions { margin-top: 2rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.page-indicator { font-weight: 600; }

/* --- Página de Configurações --- */
.settings-layout { display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 768px) { .settings-layout { grid-template-columns: 1fr 1fr; align-items: start; } }
.settings-column { display: flex; flex-direction: column; gap: 2rem; }
.settings-section h2 { font-size: 1.25rem; font-weight: 600; padding-bottom: .5rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.settings-preview-container { background-color: var(--card); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); overflow-x: auto; }
.preview-grid { display: grid; grid-template-columns: repeat(var(--preview-cols, 2), 1fr); gap: 1rem; }
.preview-table { width: 100%; text-align: center; font-size: .75rem; }
.preview-table td, .preview-table th { padding: 2px; }
.preview-table th { font-weight: 700; }

/* --- Página de Tutorial --- */
.tutorial-container { margin-top: 2rem; display: flex; flex-direction: column; gap: 2rem; }
.tutorial-step { background-color: var(--card); padding: 1.5rem; border-radius: var(--radius); box-shadow: var(--shadow); border-left: 5px solid var(--accent); }
.tutorial-step h2 { font-size: 1.25rem; font-weight: 600; margin-bottom: .5rem; color: var(--fg); }
.tutorial-step p { margin-bottom: 0; color: var(--muted); }
main a { color: var(--accent); text-decoration: none; font-weight: 600; }
main a:hover { text-decoration: underline; }

/* ============================================= */
/* --- Página de Perfil (NOVO DESIGN) ---        */
/* ============================================= */

/* Cabeçalho do Perfil */
.profile-header-card {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--background-gradient-light);
    border-radius: var(--border-radius-lg);
    margin-bottom: 24px;
}

.profile-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

#profile-avatar-img {
    width: 128px;
    height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--background-color);
    box-shadow: var(--shadow-sm);
    background-color: var(--accent-2); /* Cor de fundo para o avatar */
}

.profile-header-info h2 {
    margin: 0 0 8px 0;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-color-dark);
}

.profile-header-info p {
    margin: 0;
    font-size: 1rem;
    color: var(--text-color-secondary);
}

/* Layout dos cartões de informação */
.profile-info-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.widget-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color-dark);
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.widget-header svg {
    color: var(--accent);
}

.profile-card-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Itens de informação (Modo de Visualização) */
.profile-info-item p {
    margin: 0;
    color: var(--text-color-secondary);
    line-height: 1.6;
}

.profile-info-item p strong {
    color: var(--text-color-dark);
    font-weight: 500;
    margin-right: 8px;
}

/* Desabilita input de email */
#profile-email[disabled] {
    cursor: not-allowed;
    background-color: var(--background-color-light);
}

/* Responsividade do Perfil */
@media (max-width: 992px) {
    .profile-info-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .profile-header-card {
        flex-direction: column;
        text-align: center;
    }
}

/* ==========================================================================
   AJUSTES FINAIS DE LAYOUT E BOTÕES
   ========================================================================== */

/* Remove o cabeçalho superior e o espaço que ele ocupava */
.main-header {
    display: none;
}
.main-content {
    position: relative; /* Necessário para posicionar os controles */
}
main {
    padding: 1.5rem; /* Ajusta o padding do conteúdo principal */
}

/* Posiciona os botões de menu e tema no canto superior direito */
.main-content-controls {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    gap: 0.5rem;
}
#mobile-menu-toggle {
    position: fixed;
    top: 0.75rem;
    left: 1rem;
}

/* Corrige o estilo do botão de Configurações e outros no rodapé da sidebar */
.sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 0.25rem 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    color: var(--muted);
    transition: all 0.2s ease;
}
.sidebar-footer .nav-link:hover {
    background-color: var(--bg);
    color: var(--fg);
}
.sidebar-footer .nav-link.active {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: white;
    font-weight: 600;
}
.sidebar-footer #profile-menu-container {
    margin-top: 0.5rem;
}

/* ==========================================================================
   ATUALIZAÇÃO DA SIDEBAR (Perfil no Topo, Controles no Rodapé)
   ========================================================================== */

/* Garante que o botão de menu mobile fique visível e posicionado */
#mobile-menu-toggle {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 250; /* Fica acima da sidebar quando ela está fechada */
    background: var(--card);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    box-shadow: var(--shadow);
    display: none; /* Só aparece no mobile */
}
@media (max-width: 992px) {
    #mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}


/* Área de Perfil no Topo da Sidebar */
.sidebar-profile {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.profile-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--fg);
    transition: background-color 0.2s;
}
.profile-link:hover {
    background-color: var(--bg);
}
#profile-avatar-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}
#profile-avatar-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
#profile-name-container {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Rodapé da Sidebar Aprimorado */
.sidebar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}
/* O estilo do #theme-toggle já está correto e será aplicado aqui */

.logout-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--muted);
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
}
.logout-button:hover {
    color: var(--danger-color);
    background-color: var(--bg);
}
/* Esconde elementos marcados como "hidden" */
.hidden {
  display: none !important;
}

/* ==========================================================================
   NOVO: ESTILOS DO MODAL DE RECORTE E AJUSTES FINAIS
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--card-bg-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    color: var(--text-color-primary);
}

.modal-content h2 {
    color: var(--text-color-heading);
    margin: 0;
}

.modal-content p {
    color: var(--text-color-secondary);
    margin: 0;
}

.crop-container {
    max-width: 100%;
    max-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-color: #333;
}

.crop-container img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Ajuste para o botão de editar avatar --- */
.avatar-edit-button {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 36px;
    height: 36px;
    background-color: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid var(--background-color);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
    opacity: 0;
    visibility: hidden;
}
.avatar-edit-button:hover {
    transform: scale(1.1);
}

.avatar-edit-button.is-visible {
    opacity: 1;
    visibility: visible;
}

/* --- Media Queries para o Modal --- */
@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
        max-width: 95%;
    }
    .modal-content .button-group {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Em style.css */

/* ============================================= */
/* --- ESTILOS DO MODAL GENÉRICO ---             */
/* ============================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000; /* Z-index alto para ficar sobre tudo */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-overlay .modal-content {
    transform: scale(0.95);
    transition: transform 0.2s ease-in-out;
}

.modal-overlay:not(.hidden) .modal-content {
    transform: scale(1);
}

#modal-title {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--fg);
}

#modal-message {
    margin: 1rem 0;
    color: var(--muted);
    line-height: 1.7;
}