/* RESET GLOBAL PARA CORRIGIR BUGS DE MARGEM/PADDING */
* {
    box-sizing: border-box;
}

:root {
    /* Paleta de Cores Refinada */
    --primary-color: #E11D48; /* Rose 600 */
    --primary-gradient: linear-gradient(135deg, #E11D48 0%, #BE123C 100%);
    
    --bg-body: #F1F5F9; /* Slate 100 */
    --bg-card: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    
    --text-main: #0F172A; /* Slate 900 */
    --text-muted: #64748B; /* Slate 500 */
    --border-color: #E2E8F0; /* Slate 200 */
    
    --radius-md: 12px;
    --radius-input: 8px;
    --radius-btn: 50px; /* Botões bem arredondados */
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    
    --sidebar-width: 280px;
    --header-height: 70px;
}

body {
    background-color: var(--bg-body);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    margin: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- LAYOUT PRINCIPAL --- */
.app-container { 
    display: flex; 
    min-height: 100vh; 
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed; 
    top: 0; 
    bottom: 0; 
    left: 0;
    display: flex; 
    flex-direction: column; 
    z-index: 50;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center; /* Centraliza o logo */
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    padding: 0 20px;
}

.sidebar-logo { 
    height: 36px; 
    width: auto; 
    display: block; 
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding: 20px;
    background-color: #fff;
    flex-shrink: 0;
}

.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    display: flex; 
    flex-direction: column;
    min-height: 100vh;
}

/* Ajuste Mobile */
@media (max-width: 992px) {
    .sidebar { 
        transform: translateX(-100%); 
        width: 280px;
    }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; width: 100%; }
}

/* --- HEADER / TOPBAR --- */
.topbar {
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 0 30px;
    position: sticky; 
    top: 0; 
    z-index: 40;
}

/* --- COMPONENTES GERAIS --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

/* Inputs Modernos */
.form-control, input[type="text"], textarea, select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #CBD5E1;
    border-radius: var(--radius-input);
    font-size: 0.95rem;
    color: var(--text-main);
    background: #FFF;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}
.form-control:focus, input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
}

/* Tabelas Limpas */
.clean-table { 
    width: 100%; 
    border-collapse: collapse; 
}
.clean-table th {
    text-align: left; 
    padding: 12px 16px;
    font-size: 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.05em;
    color: var(--text-muted); 
    background: #F8FAFC; 
    border-bottom: 1px solid var(--border-color);
}
.clean-table td {
    padding: 14px 16px; 
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem; 
    color: var(--text-main); 
    vertical-align: middle;
}
.clean-table tr:last-child td { 
    border-bottom: none; 
}

/* Tags */
.tag {
    background: #FFF1F2; 
    color: #BE123C;
    padding: 4px 10px; 
    border-radius: 6px;
    font-size: 0.85rem; 
    font-weight: 600;
    display: inline-flex; 
    align-items: center; 
    gap: 6px;
    border: 1px solid #FECDD3;
}

/* --- NAVEGAÇÃO LATERAL (SIDEBAR) --- */
.nav-section {
    padding: 0;
    margin-bottom: 5px;
}

.nav-section-title {
    padding: 12px 20px 8px 20px;
    color: #64748B;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.nav-link {
    display: flex; 
    align-items: center; 
    gap: 12px;
    padding: 12px 20px; 
    color: var(--text-muted);
    font-weight: 500; 
    font-size: 0.95rem;
    text-decoration: none; 
    border-radius: 0;
    margin: 0;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover { 
    background: #F8FAFC; 
    color: var(--text-main);
    border-left-color: var(--primary-color);
}

.nav-link.active { 
    background: #FFF1F2; 
    color: var(--primary-color); 
    font-weight: 600;
    border-left-color: var(--primary-color);
}

.nav-link svg { 
    width: 20px; 
    height: 20px;
    flex-shrink: 0;
}

/* --- PERFIL DO UTILIZADOR (FOOTER) --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.user-avatar {
    width: 40px; 
    height: 40px; 
    min-width: 40px;
    background: linear-gradient(135deg, #E11D48 0%, #BE123C 100%);
    border-radius: 50%;
    color: white;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

.user-info {
    flex: 1; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    justify-content: center;
}

.user-name {
    font-weight: 600; 
    font-size: 0.9rem; 
    line-height: 1.2; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    color: #1E293B;
}

.user-role {
    font-size: 0.75rem; 
    color: #64748B;
}

.logout-btn {
    color: #64748B;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    padding: 8px;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.logout-btn:hover {
    color: var(--primary-color);
    background-color: #FFF1F2;
}

.logout-btn svg {
    width: 18px;
    height: 18px;
}

/* --- BOTÕES GLOBAIS (Força estilo arredondado) --- */
button, .btn, .submit-btn {
    font-family: 'Inter', sans-serif;
    border: none;
    border-radius: var(--radius-btn) !important; /* 50px */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 0.95rem;
    line-height: 1;
    text-decoration: none !important;
}

/* Botão Primário */
.btn-primary, .submit-btn {
    background: var(--primary-gradient) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(228, 26, 25, 0.25);
}

.btn-primary:hover, .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(228, 26, 25, 0.35);
    filter: brightness(1.05);
    color: white !important;
}

/* Botão Secundário */
.btn-secondary {
    background: white !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-secondary:hover {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
    background: #FFF1F2 !important;
}

/* --- AREA DE UPLOAD --- */
.upload-zone {
    border: 2px dashed #CBD5E1 !important;
    border-radius: 16px !important;
    background-color: #F8FAFC;
    transition: all 0.2s;
}
.upload-zone:hover {
    border-color: var(--primary-color) !important;
    background-color: #FFF1F2 !important;
}

/* --- GRID DO HUB DE FERRAMENTAS --- */
.hub-container-limit {
    max-width: 1400px;
    margin: 0 auto;
}

.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    padding-bottom: 40px;
}

/* Estilos Específicos dos Cards do Hub */
.tool-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    height: 100%;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.tool-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.tool-title {
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 10px 0;
}

.tool-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.tool-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid #F1F5F9;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}