/* --- Variáveis de Estilo --- */
:root {
  --cor-fundo: #f4f7f9;
  --cor-container: #ffffff;
  --cor-texto-principal: #2c3e50;
  --cor-texto-secundario: #5a738b;
  --cor-borda: #dee7f0;
  --sombra: 0 8px 24px rgba(21, 48, 71, 0.08);
  --cor-primaria: #3498db;
  --cor-sucesso: #2ecc71;
  --cor-aviso: #f1c40f;
  --cor-perigo: #e74c3c;
  
  /* Variáveis do Sidebar */
  --sidebar-width: 280px;
  --sidebar-bg: #2c3e50; 
  --sidebar-text: #ececf1;
}

/* --- Estilos Globais --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--cor-fundo);
    color: var(--cor-texto-principal);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden; 
}

/* --- Wrapper de Página (Empurra conteúdo) --- */
.page-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: margin-left 0.3s ease-in-out;
    padding: 20px; 
    min-height: 100vh;
}
body.sidebar-open .page-wrapper {
    margin-left: var(--sidebar-width);
}
main {
    width: 100%;
    max-width: 1200px;
}

/* --- Header --- */
.site-header {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: row; 
    align-items: center; 
    justify-content: space-between;
    margin-bottom: 30px;
    text-align: left; 
    background: linear-gradient(to right, #2c3e50, #34495e);
    padding: 20px 25px; 
    border-radius: 12px;
    box-shadow: var(--sombra);
}
.brand-wrapper {
    display: flex;
    align-items: center;
}
.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin-right: 15px;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}
.sidebar-toggle:hover {
    background-color: rgba(255,255,255,0.1);
}
.logo {
    max-height: 50px; 
    margin-bottom: 0; 
    margin-right: 20px; 
}
.site-header h1 {
    font-size: 1.8em; 
    font-weight: 700;
    color: #ffffff;
}

/* --- Controles do Usuário (Header) --- */
.user-controls {
    display: flex;
    align-items: center;
    gap: 20px; 
}
.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: #ecf0f1;
    font-size: 0.9em;
}
.user-info .welcome-text {
    font-size: 0.85em;
    opacity: 0.8;
}
.user-info .user-name {
    font-weight: bold;
    font-size: 1.1em;
}

/* NOVO: Estilo do link de perfil no nome */
.profile-trigger {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
}
.profile-trigger:hover {
    color: var(--cor-primaria); /* Destaque azul ao passar o mouse */
    text-decoration-style: solid;
}

.btn-logout {
    text-decoration: none;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
    background-color: rgba(255, 255, 255, 0.1);
}
.btn-logout:hover {
    background-color: var(--cor-perigo); 
    border-color: var(--cor-perigo);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.4);
}
@media (max-width: 768px) {
    .site-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    .brand-wrapper {
        flex-direction: column;
        margin-bottom: 10px;
    }
    .logo { margin-right: 0; margin-bottom: 10px; }
    .user-controls { width: 100%; justify-content: center; }
    .user-info { align-items: center; }
}

/* --- SIDEBAR (Menu Lateral) --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg); 
    color: var(--sidebar-text);
    box-shadow: 4px 0 15px rgba(0,0,0,0.2);
    transform: translateX(-100%); 
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-right: 1px solid rgba(255,255,255,0.1); 
}
.sidebar.open {
    transform: translateX(0); 
}
.sidebar-header {
    margin-bottom: 20px;
}
.btn-new-project {
    width: 100%;
    background-color: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}
.btn-new-project:hover {
    background-color: rgba(255,255,255,0.1);
}
.btn-new-project span {
    font-size: 1.2em;
    font-weight: bold;
}
.sidebar-content {
    flex-grow: 1;
    overflow-y: auto; 
}
.sidebar-title {
    font-size: 0.8em;
    text-transform: uppercase;
    color: #bdc3c7; 
    margin-bottom: 10px;
}
.project-list {
    list-style: none;
    padding: 0;
}

/* Item do Projeto na Sidebar */
.project-item {
    padding: 10px;
    margin-bottom: 5px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.project-item:hover {
    background-color: rgba(255, 255, 255, 0.1); 
}
.project-item:hover .btn-delete-project {
    opacity: 1;
}
.proj-info {
    overflow: hidden;
    flex-grow: 1;
}
.project-item .proj-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.project-item .proj-date {
    font-size: 0.75em;
    color: #bdc3c7;
}
.btn-delete-project {
    background: none;
    border: none;
    color: #bdc3c7;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}
.btn-delete-project:hover {
    color: #e74c3c;
    background-color: rgba(255,255,255,0.1);
}
@media (hover: none) {
    .btn-delete-project { opacity: 1; }
}
.no-projects {
    font-size: 0.9em;
    color: #bdc3c7;
    font-style: italic;
    margin-top: 10px;
}

/* --- Painéis e Formulários --- */
.panel {
    background-color: var(--cor-container);
    border: 1px solid var(--cor-borda);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--sombra);
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
}
.panel h2 {
    font-size: 1.5em;
    margin-bottom: 10px;
    color: var(--cor-texto-principal);
    border-bottom: 2px solid var(--cor-primaria);
    padding-bottom: 10px;
}
.panel-subtitle {
    font-size: 0.9em;
    color: var(--cor-texto-secundario);
    margin-bottom: 20px;
    text-align: left;
}
.form-group {
    display: flex;
    flex-direction: column;
}
.form-group label {
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--cor-texto-secundario);
}
.form-group textarea {
    width: 100%;
    min-height: 150px;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--cor-borda);
    font-size: 1.1em; 
    font-family: monospace;
    line-height: 1.6;
}

/* Botões Normalizados */
.btn {
    padding: 15px 20px; 
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px; 
    line-height: 1.2;
}
.btn-primary {
    background-color: var(--cor-primaria);
    color: white;
    margin-top: 0; 
}
.btn-primary:hover {
    background-color: #2980b9;
}
.btn-success {
    background-color: var(--cor-sucesso);
    color: white;
    margin-top: 0;
}
.btn-success:hover {
    background-color: #27ae60;
}
.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* --- Área de Upload --- */
.upload-section {
    margin-top: 20px;
    margin-bottom: 20px;
    border-top: 1px dashed #ccc;
    padding-top: 20px;
}
.upload-title {
    font-size: 1.2em;
    color: var(--cor-texto-principal);
    margin-bottom: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.drop-zone {
    border: 2px dashed var(--cor-primaria);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background-color: #fcfcfc;
    transition: background-color 0.3s, border-color 0.3s;
    position: relative;
}
.drop-zone:hover, .drop-zone.dragover {
    background-color: #eaf6ff;
    border-color: #2980b9;
}
.drop-zone-text {
    color: var(--cor-texto-secundario);
    font-size: 1.1em;
}
.drop-zone-text strong {
    color: var(--cor-primaria);
}
.file-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.file-card {
    display: flex;
    align-items: center;
    background-color: #fff;
    border: 1px solid var(--cor-borda);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    animation: slideIn 0.3s ease-out;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.file-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f4f8;
    border-radius: 50%;
    margin-right: 15px;
    color: var(--cor-texto-secundario);
    font-size: 1.2em;
}
.file-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.file-name {
    font-weight: 600;
    color: var(--cor-texto-principal);
    font-size: 0.95em;
    word-break: break-all;
}
.file-size {
    font-size: 0.8em;
    color: #999;
    margin-top: 2px;
}
.file-remove-btn {
    background: none;
    border: none;
    color: var(--cor-perigo); 
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}
.file-remove-btn:hover {
    background-color: #ffeaea;
}

/* --- Footer --- */
.site-footer {
    width: 100%;
    max-width: 1200px; 
    text-align: center;
    margin-top: auto; 
    background: linear-gradient(to right, #2c3e50, #34495e);
    padding: 20px 25px; 
    border-radius: 12px;
    box-shadow: var(--sombra);
    color: #ffffff; 
    border-top: none; 
}
.site-footer p {
    color: #ffffff;
    font-weight: 500; 
}

/* --- Login --- */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 60vh;
}
.login-panel {
    width: 100%;
    max-width: 450px;
    text-align: center;
}
.login-header {
    margin-bottom: 20px;
}
.login-header .logo {
    max-height: 60px;
    margin-right: 0; 
    margin-bottom: 15px;
}
.login-header h1 {
    font-size: 1.5em;
    color: var(--cor-texto-principal);
}
.login-input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--cor-borda);
    border-radius: 6px;
    font-size: 1em;
}
.login-alert {
    background-color: #fde8e8;
    color: var(--cor-perigo);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.95em;
    border: 1px solid #f8b4b4;
}
