/**
 * public/assets/css/app.css
 * Estilos gerais do sistema: layout base (sidebar + topbar), cards de KPI,
 * quadro Kanban, linha do tempo (timeline), telas de autenticação e dark mode.
 */

:root {
    --sidebar-width: 250px;
    --sidebar-width-collapsed: 72px;
    --topbar-height: 60px;
}

body {
    background-color: #f4f6f9;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- Layout base ---------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-left: var(--sidebar-width);
    transition: margin-left .2s ease;
}

.app-sidebar.collapsed ~ .app-content,
.app-sidebar.collapsed + .app-content {
    margin-left: var(--sidebar-width-collapsed);
}

.app-main { flex: 1; }

/* ---------- Sidebar ---------- */
.app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: #1e2a3a;
    color: #cfd8e3;
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: width .2s ease;
    overflow-x: hidden;
}

.app-sidebar.collapsed { width: var(--sidebar-width-collapsed); }
.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .sidebar-heading,
.app-sidebar.collapsed .nav-link span { display: none; }

.sidebar-brand {
    display: flex; align-items: center; gap: .5rem;
    padding: 1rem; font-weight: 600; color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    white-space: nowrap;
}

.sidebar-nav { flex: 1; padding: .5rem 0; overflow-y: auto; }

.sidebar-nav .nav-link {
    color: #cfd8e3; padding: .65rem 1.1rem; display: flex; align-items: center; gap: .75rem;
    white-space: nowrap; border-left: 3px solid transparent;
}
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: rgba(13,110,253,.15); color: #fff; border-left-color: #0d6efd; }

.sidebar-divider { border-top: 1px solid rgba(255,255,255,.08); margin: .5rem 0; }
.sidebar-heading { padding: .5rem 1.1rem; font-size: .7rem; text-transform: uppercase; color: #7d8ea3; }

.sidebar-toggle {
    border: none; background: rgba(255,255,255,.06); color: #cfd8e3;
    padding: .6rem; width: 100%;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.12); }

/* ---------- Topbar ---------- */
.app-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1rem;
    position: sticky; top: 0; z-index: 1020;
}

.topbar-search { position: relative; flex: 1; max-width: 420px; }
.topbar-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #adb5bd; }
.topbar-search input { padding-left: 32px; }
.busca-resultados {
    position: absolute; top: 110%; left: 0; right: 0; background: #fff;
    border: 1px solid #e9ecef; border-radius: .4rem; box-shadow: 0 4px 14px rgba(0,0,0,.08);
    max-height: 320px; overflow-y: auto; z-index: 1050;
}
.busca-resultados a { display: block; padding: .5rem .75rem; color: #333; text-decoration: none; border-bottom: 1px solid #f1f3f5; }
.busca-resultados a:hover { background: #f8f9fa; }

.topbar-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.notif-dropdown { max-height: 350px; overflow-y: auto; }

/* ---------- KPI cards ---------- */
.kpi-card .kpi-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
}

/* ---------- Kanban ---------- */
.kanban-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; }
.kanban-coluna { min-width: 270px; max-width: 270px; background: #eef1f5; border-radius: .5rem; display: flex; flex-direction: column; max-height: 75vh; }
.kanban-coluna-header { padding: .6rem .8rem; font-weight: 600; border-radius: .5rem .5rem 0 0; }
.kanban-lista { flex: 1; overflow-y: auto; padding: .5rem; min-height: 60px; }
.kanban-card { background: #fff; border-radius: .4rem; padding: .6rem .7rem; margin-bottom: .6rem; box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: grab; }
.kanban-card:active { cursor: grabbing; }
.kanban-card a { color: #222; text-decoration: none; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding-left: 1.2rem; margin: 0; border-left: 2px solid #e9ecef; }
.timeline-item { position: relative; padding-bottom: 1.2rem; padding-left: 1rem; }
.timeline-marker { position: absolute; left: -1.45rem; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #0d6efd; }
.timeline-content { background: #f8f9fa; border-radius: .4rem; padding: .6rem .8rem; }

/* ---------- Autenticação ---------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #1e2a3a 100%);
}
.auth-card {
    background: #fff; padding: 2rem; border-radius: .8rem; width: 100%; max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

/* ---------- Dark mode ---------- */
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] { background-color: #12181f; }
[data-bs-theme="dark"] .app-topbar,
[data-bs-theme="dark"] .card,
[data-bs-theme="dark"] .kanban-card { background-color: #1c2530; color: #dee2e6; }
[data-bs-theme="dark"] .kanban-coluna { background-color: #171f28; }
[data-bs-theme="dark"] .busca-resultados { background: #1c2530; }

/* ---------- Responsivo ---------- */
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.mobile-open { transform: translateX(0); }
    .app-content { margin-left: 0 !important; }
}
