/* ============================================================
   assets/css/app.css — Sistema Jurídico
   Design moderno, limpo, responsivo
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:          #f8f9fb;
    --bg-card:     #ffffff;
    --sidebar-bg:  #0f172a;
    --sidebar-w:   240px;
    --accent:      #2563eb;
    --accent-dark: #1d4ed8;
    --text:        #1e293b;
    --text-muted:  #64748b;
    --border:      #e2e8f0;
    --radius:      10px;
    --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

/* ── App Shell ─────────────────────────────────────────────── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}

.brand-icon { font-size: 22px; }
.brand-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: .3px;
    line-height: 1.3;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 7px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover  { background: rgba(255,255,255,.07); color: #e2e8f0; }
.nav-item.active { background: var(--accent); color: #fff; }

.nav-icon { font-size: 15px; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
    flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-nome  { font-size: 12px; font-weight: 600; color: #e2e8f0;
              white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-perfil{ font-size: 11px; color: #64748b; text-transform: capitalize; }

.btn-logout {
    color: #64748b; font-size: 18px; text-decoration: none;
    padding: 4px; border-radius: 5px; transition: color .15s;
}
.btn-logout:hover { color: #ef4444; }

/* ── Main content ──────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}

.btn-menu {
    display: none;
    background: none; border: none;
    font-size: 20px; cursor: pointer; color: var(--text-muted);
}

.topbar-hora { font-size: 13px; color: var(--text-muted); }

.page-body {
    padding: 28px 28px;
    flex: 1;
}

/* ── Tipografia de página ──────────────────────────────────── */
.page-header   { margin-bottom: 24px; }
.page-header h1{ font-size: 22px; font-weight: 600; color: var(--text); }
.text-muted    { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--text-muted);
                 text-transform: uppercase; letter-spacing: .6px; margin-bottom: 12px; }

/* ── Stat cards ────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}
.stat-card--destaque {
    background: var(--accent);
    border-color: var(--accent);
}
.stat-card--destaque .stat-value,
.stat-card--destaque .stat-label { color: #fff; }

.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ── Módulos grid ──────────────────────────────────────────── */
.modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.modulo-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 16px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: box-shadow .15s, border-color .15s, transform .15s;
    display: block;
}
.modulo-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.modulo-icone {
    width: 38px; height: 38px;
    background: #eff6ff;
    color: var(--accent);
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
    margin-bottom: 12px;
}
.modulo-nome { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.modulo-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* ── Tabelas ───────────────────────────────────────────────── */
.table-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th {
    background: #f8fafc;
    padding: 11px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfd; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
}
.badge--agendado  { background: #dbeafe; color: #1e40af; }
.badge--realizado { background: #d1fae5; color: #065f46; }
.badge--cancelado { background: #fee2e2; color: #991b1b; }
.badge--pendente  { background: #fef3c7; color: #92400e; }

/* ── Formulários ───────────────────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.form-card h2 {
    font-size: 15px; font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.col-span-2 { grid-column: span 2; }
.col-span-3 { grid-column: span 3; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-group .required::after { content: ' *'; color: #ef4444; }

input, select, textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
input::placeholder { color: #cbd5e1; }
textarea { resize: vertical; min-height: 90px; }

/* Checkbox com label inline */
.check-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
}
.check-group input[type="checkbox"] {
    width: 16px; height: 16px;
    border-radius: 4px;
    cursor: pointer;
    accent-color: var(--accent);
}
.check-group label { font-size: 13px; color: var(--text); cursor: pointer; margin: 0; }

/* Input com botão inline */
.input-group { position: relative; }
.input-group input { padding-right: 40px; }
.btn-eye {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); padding: 4px;
}

/* ── Botões ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background .15s, border-color .15s, opacity .15s;
}
.btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-secondary{ background: var(--bg-card); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger   { background: #ef4444; color: #fff; border-color: #ef4444; }
.btn-danger:hover { background: #dc2626; }
.btn-sm       { padding: 5px 10px; font-size: 12px; }
.btn-block    { width: 100%; justify-content: center; }

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

/* ── Paginação ─────────────────────────────────────────────── */
.paginacao {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
}
.paginacao a, .paginacao span {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    border: 1px solid var(--border);
    color: var(--text);
    text-decoration: none;
    transition: background .15s;
}
.paginacao a:hover  { background: #f1f5f9; }
.paginacao .atual   { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Flash messages ────────────────────────────────────────── */
.flash-container { margin-bottom: 20px; }
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 13px;
}

/* ── Toolbar de listagem ───────────────────────────────────── */
.list-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
    position: relative;
}
.search-box input { padding-left: 34px; }
.search-box::before {
    content: '🔍';
    position: absolute;
    left: 10px; top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
}

/* ── Login ─────────────────────────────────────────────────── */
.login-body {
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.login-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-icon   { font-size: 40px; display: block; margin-bottom: 12px; }
.login-header h1 { font-size: 20px; font-weight: 700; color: var(--text); }
.login-header p  { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form .btn { margin-top: 8px; }

/* ── Responsivo ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .btn-menu {
        display: block;
    }
    .page-body {
        padding: 16px;
    }
    .form-grid.cols-2,
    .form-grid.cols-3 {
        grid-template-columns: 1fr;
    }
    .col-span-2, .col-span-3 {
        grid-column: span 1;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}
