/* ─── Reset e base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Arial, sans-serif;
    font-size: 14px;
    background: #f0f0f0;
    color: #333;
}

/* ─── Login ─── */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: #fff;
    border: 1px solid #ccc;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    border-radius: 4px;
}

.login-box h1 { font-size: 22px; margin-bottom: 4px; color: #222; }
.login-subtitle { font-size: 12px; color: #888; margin-bottom: 24px; }

/* ─── Formulário ─── */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-size: 14px;
    background: #fafafa;
}

.form-group input:focus { outline: none; border-color: #888; background: #fff; }

/* ─── Botões ─── */
.btn { padding: 9px 18px; border: none; border-radius: 3px; cursor: pointer; font-size: 14px; }
.btn-primary { background: #444; color: #fff; }
.btn-primary:hover { background: #222; }
.btn-primary:disabled { background: #999; cursor: not-allowed; }
.btn-block { display: block; width: 100%; margin-top: 8px; }

/* ─── Alertas ─── */
.alert { padding: 10px 14px; border-radius: 3px; margin-bottom: 16px; font-size: 13px; }
.alert-error { background: #fdecea; border: 1px solid #f5c6c2; color: #a00; }

/* ─── Layout principal ─── */
.layout { display: flex; min-height: 100vh; position: relative; }

/* ─── Sidebar ─── */
.sidebar {
    width: 240px;
    min-width: 240px;
    background: #2c2c2c;
    color: #ddd;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 18px 16px;
    border-bottom: 1px solid #444;
    flex-shrink: 0;
}

.sidebar-title { font-size: 16px; font-weight: bold; color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-placeholder { padding: 12px 16px; color: #777; font-size: 12px; }

/* ─── Grupos do menu ─── */
.nav-group { border-bottom: 1px solid #3a3a3a; }

.nav-group-title {
    width: 100%;
    background: none;
    border: none;
    color: #bbb;
    padding: 10px 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-group-title:hover { background: #383838; color: #fff; }
.nav-arrow { font-size: 11px; }

.nav-group-list {
    list-style: none;
    display: none;
    background: #262626;
}

.nav-group-list.open { display: block; }

.nav-item {
    width: 100%;
    background: none;
    border: none;
    color: #ccc;
    padding: 9px 16px 9px 24px;
    text-align: left;
    cursor: pointer;
    font-size: 13px;
    display: block;
}

.nav-item:hover { background: #383838; color: #fff; }
.nav-item.active { background: #4a4a4a; color: #fff; border-left: 3px solid #aaa; padding-left: 21px; }

/* ─── Link de admin no menu ─── */
.nav-admin-link {
    padding: 14px 16px 8px;
    border-top: 1px solid #3a3a3a;
    margin-top: 8px;
}

.nav-admin-link a { color: #aaa; font-size: 12px; text-decoration: none; }
.nav-admin-link a:hover { color: #fff; }

/* ─── Rodapé da sidebar ─── */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #444;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

.user-name { font-size: 12px; color: #aaa; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-logout {
    font-size: 12px;
    color: #ccc;
    text-decoration: none;
    border: 1px solid #555;
    padding: 4px 10px;
    border-radius: 3px;
    white-space: nowrap;
}

.btn-logout:hover { background: #444; color: #fff; }

/* ─── Conteúdo principal ─── */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f0f0f0;
}

/* ─── Mensagem de boas-vindas ─── */
.welcome-msg { padding: 40px 32px; }
.welcome-msg h2 { font-size: 20px; margin-bottom: 8px; color: #333; }
.welcome-msg p { color: #666; }

/* ─── Container do dashboard ─── */
.dashboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.dashboard-header {
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.dashboard-header h2 { font-size: 16px; color: #333; }

.iframe-wrapper { flex: 1; overflow: hidden; }
.iframe-wrapper iframe { display: block; width: 100%; height: 100%; border: none; }

/* ─── Loading e erro ─── */
.loading-msg, .error-msg {
    padding: 40px 32px;
    color: #666;
}

.error-msg p { color: #a00; }

/* ─── Hamburguer (mobile) ─── */
.hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    background: #2c2c2c;
    color: #fff;
    border: none;
    padding: 8px 12px;
    font-size: 18px;
    border-radius: 4px;
    cursor: pointer;
}

/* ─── Overlay mobile ─── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.visible { display: block; }

/* ─── Responsivo mobile ─── */
@media (max-width: 700px) {
    .hamburger { display: block; }

    .sidebar {
        position: fixed;
        top: 0; left: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open { transform: translateX(0); }

    .main-content { padding-top: 48px; }

    .welcome-msg { padding: 24px 16px; }

    .dashboard-container { height: calc(100vh - 48px); }
}