/* =============================================
   SiMembro — Sistema de Gestão de Membros
   Estilos Principais
   ============================================= */

:root {
    --primary: #1a3a5c;
    --primary-light: #2563a8;
    --primary-dark: #0f2339;
    --accent: #ec7a28;
    --accent-dark: #ec7a28;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #ec7a28;
    --bg: #f0f4f8;
    --card: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ---- AUTH PAGES ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}

.auth-card {
    background: var(--card);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.auth-card.wide { max-width: 640px; }

.auth-header {
    background: linear-gradient(135deg, #ffffff 0%, #fefefe 100%);
    padding: 32px 36px 28px;
    text-align: center;
    color: #fff;
}

.auth-header .logo {
    width: 64px; height: 64px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; margin: 0 auto 16px;
    border: 2px solid rgba(255,255,255,0.3);
}

.auth-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.auth-header p  { font-size: 13px; opacity: 0.8; }

.auth-body { padding: 32px 36px; }

/* ---- FORM ELEMENTS ---- */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group label span { color: var(--danger); }

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(37,99,168,0.12);
}

.form-control:disabled {
    background: #f8fafc;
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .2s;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    width: 100%;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(26,58,92,0.35); }

.btn-accent {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent));
    color: #fff;
}
.btn-accent:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(232,160,32,0.35); }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: 12px; }

/* ---- ALERTS ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.alert-danger  { background: #fef2f2; border: 1px solid #fca5a5; color: var(--danger); }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: var(--success); }
.alert-warning { background: #fffbeb; border: 1px solid #ec7a28; color: var(--warning); }

/* ---- DIVIDER ---- */
.divider {
    text-align: center;
    position: relative;
    margin: 20px 0;
    font-size: 12px;
    color: var(--text-muted);
}
.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}
.divider::before { left: 0; }
.divider::after  { right: 0; }

/* ---- NIVEL BADGE ---- */
.nivel-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.nivel-admin    { background: #fee2e2; color: #991b1b; }
.nivel-gestor_provincia { background: #dbeafe; color: #1e40af; }
.nivel-gestor_bairro    { background: #d1fae5; color: #065f46; }
.nivel-membro   { background: #f3f4f6; color: #374151; }

/* ---- NAVBAR ---- */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 111px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none; color: #fff;
}
.navbar-brand .brand-icon {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.navbar-brand span { font-size: 18px; font-weight: 700; }

.navbar-nav {
    display: flex; align-items: center; gap: 8px;
}

.nav-link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: all .2s;
    display: flex; align-items: center; gap: 6px;
}
.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-user {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}
.nav-user .avatar {
    width: 32px; height: 32px;
    background: var(--accent);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
}
.nav-user .info { line-height: 1.2; }
.nav-user .info .name { font-size: 13px; font-weight: 600; }
.nav-user .info .role { font-size: 10px; opacity: 0.7; text-transform: uppercase; letter-spacing:.5px; }

/* ---- LAYOUT ---- */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h2 {
    font-size: 22px; font-weight: 700;
    display: flex; align-items: center; gap: 10px;
}

/* ---- CARD ---- */
.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 24px; }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}
table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}
table tr:hover td { background: #f8fafc; }

/* ---- STATS CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-card .icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}
.stat-card .number { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ---- LOADING ---- */
.spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- SECTION TITLE ---- */
.section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: var(--primary-light);
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- AUTH FOOTER ---- */
.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-muted);
}
.auth-footer a { color: var(--primary-light); text-decoration: none; font-weight: 600; }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .auth-body, .auth-header { padding: 24px 20px; }
    .form-row { grid-template-columns: 1fr; }
    .page-container { padding: 16px; }
    .navbar { padding: 0 16px; }
    .navbar-nav .nav-link span { display: none; }
}
