/* ============================================================
   Plataforma Forma Simples — CSS Partilhado
   NG05 Unipessoal, Lda.
   ============================================================ */

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f1f5f9;
    color: #1e293b;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ── Variáveis de cor ── */
:root {
    --primary:      #1e3a5f;
    --primary-light:#1d4ed8;
    --primary-hover:#1e40af;
    --accent:       #38bdf8;
    --success:      #059669;
    --warning:      #d97706;
    --danger:       #dc2626;
    --purple:       #7c3aed;
    --orange:       #ea580c;
    --teal:         #0891b2;
    --bg:           #f1f5f9;
    --bg-card:      #ffffff;
    --border:       #e2e8f0;
    --text:         #1e293b;
    --text-muted:   #64748b;
    --text-light:   #94a3b8;
    --radius:       10px;
    --shadow:       0 1px 4px rgba(0,0,0,.08);
    --shadow-md:    0 4px 14px rgba(0,0,0,.10);
    --shadow-lg:    0 8px 30px rgba(0,0,0,.12);
}

/* ── Topbar ── */
.topbar {
    background: var(--primary);
    color: #fff;
    padding: 0 28px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-brand { font-size: 17px; font-weight: 700; color: #fff; text-decoration: none; }
.topbar-brand span { color: var(--accent); }
.topbar-nav { display: flex; align-items: center; gap: 6px; }
.topbar-nav a {
    color: #93c5fd;
    font-size: 13px;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all .2s;
}
.topbar-nav a:hover { color: #fff; background: rgba(255,255,255,.1); }
.topbar-nav .nav-sep { color: rgba(255,255,255,.2); }
.topbar-user { font-size: 13px; color: #cbd5e1; }

/* ── Hero banner ── */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 28px 32px;
    color: #fff;
}
.hero h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.hero p  { font-size: 14px; opacity: .8; }

/* ── Container ── */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.container-sm { max-width: 720px; margin: 0 auto; padding: 24px 20px; }
.container-lg { max-width: 1300px; margin: 0 auto; padding: 24px 20px; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.card-header h2,
.card-header h3 { font-size: 15px; font-weight: 700; color: var(--primary); margin: 0; }
.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

/* ── Section title ── */
.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 4px;
}

/* ── Grids ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; }
@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ── Formulários ── */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}
.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── Botões ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--primary-light); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-dark      { background: var(--primary); color: #fff; }
.btn-dark:hover{ background: #162d4a; }
.btn-success   { background: var(--success); color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-purple    { background: var(--purple); color: #fff; }
.btn-teal      { background: var(--teal); color: #fff; }
.btn-grey      { background: #e2e8f0; color: #475569; }
.btn-grey:hover{ background: #cbd5e1; box-shadow: none; }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary-light); color: var(--primary-light); }
.btn-outline:hover { background: var(--primary-light); color: #fff; }
.btn-sm { padding: 5px 12px; font-size: 12px; border-radius: 5px; }
.btn-lg { padding: 12px 28px; font-size: 15px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.badge-success   { background: var(--success); }
.badge-danger    { background: var(--danger); }
.badge-warning   { background: var(--warning); }
.badge-primary   { background: var(--primary-light); }
.badge-purple    { background: var(--purple); }
.badge-teal      { background: var(--teal); }
.badge-orange    { background: var(--orange); }
.badge-dark      { background: var(--primary); }
.badge-grey      { background: var(--text-light); }
.badge-green     { background: var(--success); }
.badge-red       { background: var(--danger); }

/* ── Alertas ── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── Tabelas ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
tr:hover td { background: #f8fafc; }

/* ── Avatar ── */
.avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}
.avatar-sm { width: 34px; height: 34px; border-width: 2px; }
.avatar-lg { width: 80px; height: 80px; border-width: 3px; }
.avatar-placeholder {
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

/* ── Stats ── */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: .2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.stat-val { font-size: 24px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Module cards ── */
.module-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: .2s;
    border-left: 4px solid var(--border);
}
.module-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.module-icon {
    width: 46px; height: 46px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.module-title { font-size: 14px; font-weight: 700; color: var(--primary); }
.module-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Field display ── */
.field-group { margin-bottom: 14px; }
.field-label { font-size: 11px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.field-value { font-size: 14px; color: var(--text); margin-top: 2px; }

/* ── Utility ── */
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 6px; }
.gap-2 { gap: 12px; }
.gap-3 { gap: 18px; }
.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 36px;
    font-size: 14px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
