/* ============================================================
   SISIgreja — Estilos Principais
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── Variáveis Globais (Design Tokens) ─────────────── */
:root {
    /* Cores principais */
    --primary:       #1e3a5f;
    --primary-dark:  #142a45;
    --primary-light: #2a5080;
    --accent:        #c9a13b;
    --accent-light:  #d4b35c;
    --accent-dark:   #a8842e;

    /* Neutros */
    --bg-body:       #f0f2f5;
    --bg-card:       #ffffff;
    --bg-sidebar:    #111827;
    --text-primary:  #1f2937;
    --text-secondary:#6b7280;
    --text-light:    #9ca3af;
    --border-color:  #e5e7eb;
    --border-focus:  #1e3a5f;

    /* Status */
    --success:       #10b981;
    --danger:        #ef4444;
    --warning:       #f59e0b;
    --info:          #3b82f6;

    /* Sombras */
    --shadow-sm:     0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:     0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 10px -4px rgba(0,0,0,0.05);
    --shadow-xl:     0 20px 40px -5px rgba(0,0,0,0.12), 0 8px 15px -6px rgba(0,0,0,0.06);

    /* Bordas */
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     16px;
    --radius-xl:     24px;

    /* Transições */
    --transition:    all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Tipografia */
    --font-family:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background-color: var(--bg-body);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    list-style: none;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
}

button {
    cursor: pointer;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    position: relative;
    overflow: hidden;
}

/* Partículas animadas de fundo */
.login-page::before,
.login-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    opacity: 0.06;
    animation: floatBubble 20s infinite ease-in-out;
}

.login-page::before {
    width: 500px;
    height: 500px;
    background: var(--accent);
    top: -150px;
    right: -100px;
    animation-delay: 0s;
}

.login-page::after {
    width: 350px;
    height: 350px;
    background: var(--accent-light);
    bottom: -100px;
    left: -80px;
    animation-delay: -10s;
}

@keyframes floatBubble {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25%      { transform: translate(30px, -30px) scale(1.05); }
    50%      { transform: translate(-20px, 20px) scale(0.95); }
    75%      { transform: translate(15px, 10px) scale(1.02); }
}

/* ── Card de Login ─────────────────────────────────── */
.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl), 0 0 60px rgba(30, 58, 95, 0.3);
    position: relative;
    z-index: 1;
    animation: cardSlideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes cardSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Imagem do topo ────────────────────────────────── */
.login-header {
    width: 100%;
    height: 180px;
    overflow: hidden;
    position: relative;
}

.login-header img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to top, rgba(15, 23, 42, 0.9), transparent);
}

/* ── Corpo do Login ────────────────────────────────── */
.login-body {
    padding: 32px 36px 40px;
}

.login-title {
    text-align: center;
    margin-bottom: 8px;
}

.login-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.login-title p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

/* ── Formulário ────────────────────────────────────── */
.login-form {
    margin-top: 28px;
}

.login-card .form-group {
    margin-bottom: 20px;
    position: relative;
}

.login-card .form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.login-card .form-group .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-card .form-group .input-wrapper i {
    position: absolute;
    left: 14px;
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.3);
    transition: var(--transition);
    z-index: 2;
}

.login-card .form-group input {
    width: 100%;
    padding: 13px 14px 13px 44px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.login-card .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-card .form-group input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(201, 161, 59, 0.15);
}

.login-card .form-group input:focus + i,
.login-card .form-group .input-wrapper:focus-within i {
    color: var(--accent);
}

/* Botão de toggle da senha */
.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    font-size: 1.15rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 2;
    padding: 4px;
}

.toggle-password:hover {
    color: var(--accent);
}

/* ── Botão de Login ────────────────────────────────── */
.btn-login {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(201, 161, 59, 0.35);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-login .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-login.loading .spinner {
    display: inline-block;
}

.btn-login.loading .btn-text {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Link de Cadastro ──────────────────────────────── */
.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.login-footer p {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.45);
}

.login-footer a {
    color: var(--accent);
    font-weight: 600;
    transition: var(--transition);
}

.login-footer a:hover {
    color: var(--accent-light);
    text-decoration: underline;
}

/* ============================================================
   LAYOUT PRINCIPAL (Sidebar + Content)
   Será usado pelas páginas internas
   ============================================================ */

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
    border-right: 1px solid rgba(255,255,255,0.06);
}

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

.sidebar-brand img {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
}

.sidebar-brand h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-brand span {
    font-size: 0.6875rem;
    color: var(--accent);
    font-weight: 500;
}

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

.sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255,255,255,0.3);
    letter-spacing: 0.08em;
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-item i {
    font-size: 1.25rem;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #ffffff;
}

.nav-item.active {
    background: rgba(201, 161, 59, 0.15);
    color: var(--accent);
}

.nav-item.active i {
    color: var(--accent);
}

/* ── Sidebar User Info ─────────────────────────────── */
.sidebar-user {
    padding: 16px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user .user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-role {
    font-size: 0.6875rem;
    color: rgba(255,255,255,0.4);
}

.sidebar-user .btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.35);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-user .btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ── Main Content ──────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 0;
    transition: var(--transition);
}

/* ── Top Bar ───────────────────────────────────────── */
.topbar {
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

.topbar-title h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
}

.content-area {
    padding: 28px;
}

/* ── Overlay para mobile ───────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* ============================================================
   COMPONENTES REUTILIZÁVEIS
   ============================================================ */

/* ── Cards ─────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.card-header h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 24px;
}

/* ── Botões ────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    white-space: nowrap;
}

.btn i {
    font-size: 1.125rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 95, 0.35);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #ffffff;
}

.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 161, 59, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #ffffff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #ffffff;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: var(--primary);
    color: var(--primary);
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* ── Formulários ───────────────────────────────────── */
.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-control::placeholder {
    color: var(--text-light);
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: var(--transition);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

/* ── Tabelas ───────────────────────────────────────── */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    background: var(--bg-body);
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: rgba(30, 58, 95, 0.03);
}

.data-table .actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* ── Paginação ─────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination .page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.pagination .page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* ── Grid Helpers ──────────────────────────────────── */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Utilitários ───────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }

/* ── Animações ─────────────────────────────────────── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
.spin { display: inline-block; animation: spin 1s linear infinite; }
.text-danger { color: var(--danger); }
