/* =============================================
   Sermão HUB — style.css
   Design moderno, elegante, responsivo
   Fonte: Inter | Cores: Azul e Branco
============================================= */

/* ── Variáveis ─────────────────────────────── */
:root {
  --blue-700:   #1a4f9e;
  --blue-600:   #1d5dbf;
  --blue-500:   #2563eb;
  --blue-400:   #3b82f6;
  --blue-100:   #dbeafe;
  --blue-50:    #eff6ff;

  --gray-900:   #111827;
  --gray-800:   #1f2937;
  --gray-700:   #374151;
  --gray-600:   #4b5563;
  --gray-500:   #6b7280;
  --gray-400:   #9ca3af;
  --gray-300:   #d1d5db;
  --gray-200:   #e5e7eb;
  --gray-100:   #f3f4f6;
  --gray-50:    #f9fafb;

  --white:      #ffffff;
  --danger:     #ef4444;
  --danger-lt:  #fee2e2;
  --success:    #16a34a;
  --success-lt: #dcfce7;

  --sidebar-w:  260px;
  --topbar-h:   60px;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.13);

  --transition: .2s ease;
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Auth Layout ────────────────────────────── */
.auth-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--gray-50);
  position: relative;
  overflow: hidden;
}

.auth-bg {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.auth-bg-shapes .shape {
  position: absolute;
  border-radius: 50%;
  opacity: .08;
  background: var(--blue-500);
}
.shape-1 { width: 500px; height: 500px; top: -150px; right: -100px; }
.shape-2 { width: 300px; height: 300px; bottom: -80px; left: -60px; }
.shape-3 { width: 200px; height: 200px; top: 40%; left: 30%; opacity: .04; }

.auth-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 440px;
  padding: 24px 16px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px;
  background: var(--blue-500);
  border-radius: 16px;
  color: var(--white);
  font-size: 1.5rem;
  margin-bottom: 12px;
  box-shadow: 0 4px 16px rgba(37,99,235,.3);
}
.auth-logo-text {
  font-size: 1.5rem; font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -.5px;
}
.auth-logo-sub {
  font-size: .875rem; color: var(--gray-500); margin-top: 4px;
}

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1; text-align: center;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: .875rem; font-weight: 500;
  color: var(--gray-600);
  transition: var(--transition);
}
.auth-tab.active {
  background: var(--white);
  color: var(--blue-600);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ── App Layout ─────────────────────────────── */
.app-layout { display: block; }

/* Sidebar */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex; flex-direction: column;
  z-index: 200;
  transition: transform var(--transition);
}

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 36px; height: 36px;
  background: var(--blue-500);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-size: .9rem;
}
.logo-text { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); letter-spacing: -.3px; }

.sidebar-toggle {
  display: none; background: none; border: none;
  font-size: 1.1rem; color: var(--gray-500); padding: 4px;
}

.sidebar-nav { flex: 1; padding: 12px 12px; overflow-y: auto; }
.sidebar-nav ul { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500;
  color: var(--gray-600);
  transition: var(--transition);
}
.nav-item:hover { background: var(--gray-100); color: var(--gray-900); }
.nav-item.active {
  background: var(--blue-50);
  color: var(--blue-600);
  font-weight: 600;
}
.nav-item i { width: 18px; text-align: center; font-size: .9rem; }

.sidebar-footer {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px;
  border-top: 1px solid var(--gray-100);
}
.user-avatar {
  width: 36px; height: 36px; min-width: 36px;
  background: var(--blue-100);
  color: var(--blue-600);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem;
}
.user-details { flex: 1; min-width: 0; }
.user-name {
  display: block; font-size: .85rem; font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-email {
  display: block; font-size: .75rem; color: var(--gray-500);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-logout {
  color: var(--gray-400); font-size: 1rem;
  padding: 6px; border-radius: 6px;
  transition: var(--transition);
}
.btn-logout:hover { color: var(--danger); background: var(--danger-lt); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 199;
}

/* Main */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* Topbar (mobile) */
.topbar {
  display: none;
  align-items: center; gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 100;
}
.menu-btn {
  background: none; border: none;
  font-size: 1.1rem; color: var(--gray-600); padding: 4px;
}
.topbar-title { flex: 1; font-weight: 600; font-size: .95rem; color: var(--gray-800); }
.btn-topbar-new {
  width: 32px; height: 32px;
  background: var(--blue-500); color: var(--white);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
}

.page-content { flex: 1; padding: 28px 32px; max-width: 900px; }

/* ── Shared Components ──────────────────────── */

/* Page Header */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); letter-spacing: -.5px; }
.page-subtitle { font-size: .875rem; color: var(--gray-500); margin-top: 3px; }
.page-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 600;
  border: 1.5px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--blue-500); color: var(--white);
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}
.btn-primary:hover { background: var(--blue-600); }
.btn-outline {
  background: var(--white); color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover { border-color: var(--blue-400); color: var(--blue-600); background: var(--blue-50); }
.btn-ghost { background: none; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }
.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }
.btn-danger-outline {
  background: var(--white); color: var(--danger); border-color: var(--danger);
}
.btn-danger-outline:hover { background: var(--danger-lt); }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: .95rem; }

/* Forms */
.auth-form, .sermon-form { display: flex; flex-direction: column; gap: 16px; }
.form-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  padding: 28px 28px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--grow { flex: 1; }
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-row .form-group { min-width: 0; }
label {
  font-size: .8rem; font-weight: 600;
  color: var(--gray-700); letter-spacing: .2px;
}
.required { color: var(--blue-500); }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: .9rem; color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  outline: none;
}
input:focus, textarea:focus {
  border-color: var(--blue-400);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
textarea { resize: vertical; min-height: 200px; line-height: 1.6; }

.input-icon { position: relative; }
.input-icon > i:first-child {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: .85rem; pointer-events: none;
}
.input-icon input { padding-left: 36px; }
.input-password input { padding-right: 40px; }
.toggle-pass {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--gray-400); font-size: .85rem; padding: 4px;
}
.toggle-pass:hover { color: var(--gray-600); }

.textarea-toolbar {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  background: var(--gray-50);
  border: 1.5px solid var(--gray-200);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.textarea-toolbar + textarea {
  border-top-left-radius: 0; border-top-right-radius: 0;
}
.toolbar-btn {
  padding: 4px 8px; background: none; border: 1px solid transparent;
  border-radius: 4px; color: var(--gray-600); font-size: .8rem;
  transition: var(--transition);
}
.toolbar-btn:hover { background: var(--gray-200); border-color: var(--gray-300); }
.toolbar-sep { width: 1px; height: 18px; background: var(--gray-300); margin: 0 4px; }
.char-count { font-size: .75rem; color: var(--gray-400); margin-left: auto; }

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 8px; border-top: 1px solid var(--gray-100); margin-top: 4px;
}

/* Alerts */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: .875rem; font-weight: 500; margin-bottom: 16px;
}
.alert-error  { background: var(--danger-lt);  color: #991b1b; }
.alert-success{ background: var(--success-lt); color: #166534; }
.alert-dismissible { position: relative; }
.alert-close {
  margin-left: auto; background: none; border: none;
  color: inherit; opacity: .7; font-size: .85rem; padding: 2px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.stat-card {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 20px;
  border-radius: var(--radius);
  background: var(--white);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}
.stat-card--blue  { border-left: 4px solid var(--blue-500); }
.stat-card--light { border-left: 4px solid var(--blue-300); }
.stat-card--accent{ border-left: 4px solid #7c3aed; }
.stat-icon {
  width: 44px; height: 44px; min-width: 44px;
  background: var(--blue-50);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--blue-500); font-size: 1.1rem;
}
.stat-value { display: block; font-size: 1.6rem; font-weight: 800; color: var(--gray-900); letter-spacing: -1px; }
.stat-label { display: block; font-size: .78rem; color: var(--gray-500); font-weight: 500; margin-top: 2px; }

/* Section header */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.section-link { font-size: .8rem; font-weight: 600; color: var(--blue-500); display: flex; align-items: center; gap: 4px; }
.section-link:hover { color: var(--blue-700); }

/* Sermon Cards */
.sermons-list { display: flex; flex-direction: column; gap: 10px; }
.sermon-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.sermon-card:hover {
  border-color: var(--blue-300);
  box-shadow: 0 2px 12px rgba(37,99,235,.1);
  transform: translateY(-1px);
}
.sermon-card-body { flex: 1; min-width: 0; }
.sermon-card-top {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.sermon-title {
  font-size: .95rem; font-weight: 700; color: var(--gray-900);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 400px;
}
.sermon-date { font-size: .78rem; color: var(--gray-500); white-space: nowrap; }
.sermon-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.sermon-tema {
  font-size: .78rem; font-weight: 500; color: var(--blue-600);
  background: var(--blue-50); padding: 2px 8px; border-radius: 20px;
}
.sermon-ref { font-size: .78rem; color: var(--gray-600); display: flex; align-items: center; gap: 4px; }
.sermon-created { font-size: .73rem; color: var(--gray-400); }
.sermon-card-arrow { color: var(--gray-300); font-size: .8rem; }
.sermon-card-actions { display: flex; gap: 4px; align-items: center; }

/* Icon buttons */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: none; border: none;
  color: var(--gray-500); font-size: .8rem;
  transition: var(--transition);
}
.icon-btn:hover { background: var(--gray-100); color: var(--gray-800); }
.icon-btn--danger:hover { background: var(--danger-lt); color: var(--danger); }

/* Empty state */
.empty-state {
  text-align: center; padding: 56px 24px;
  background: var(--white);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius);
}
.empty-icon {
  width: 60px; height: 60px; margin: 0 auto 16px;
  background: var(--gray-100); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: var(--gray-400);
}
.empty-state h4 { font-size: 1rem; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p  { font-size: .875rem; color: var(--gray-500); margin-bottom: 20px; }

/* Search bar */
.search-bar {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.search-input-wrap {
  flex: 1; position: relative; min-width: 200px;
}
.search-input-wrap > i {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: .85rem;
}
.search-input-wrap input {
  padding-left: 36px; padding-right: 36px;
}
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); font-size: .85rem; padding: 3px;
}

/* Pagination */
.pagination {
  display: flex; justify-content: center; gap: 6px; margin-top: 24px; flex-wrap: wrap;
}
.page-btn {
  min-width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-size: .85rem; font-weight: 500; color: var(--gray-700);
  transition: var(--transition);
}
.page-btn:hover { border-color: var(--blue-400); color: var(--blue-600); }
.page-btn.active { background: var(--blue-500); color: var(--white); border-color: var(--blue-500); }

/* Sermon View */
.sermon-view {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 36px 40px;
}
.breadcrumb-back {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .85rem; font-weight: 600; color: var(--gray-500);
  transition: var(--transition);
}
.breadcrumb-back:hover { color: var(--blue-600); }
.sermon-view-title {
  font-size: 1.75rem; font-weight: 800;
  color: var(--gray-900); letter-spacing: -.5px;
  line-height: 1.25; margin-bottom: 16px;
}
.sermon-view-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 20px;
  font-size: .78rem; font-weight: 500;
}
.meta-chip--blue  { background: var(--blue-50);  color: var(--blue-700); }
.meta-chip--gray  { background: var(--gray-100); color: var(--gray-600); }
.meta-chip--light { background: var(--gray-50);  color: var(--gray-500); border: 1px solid var(--gray-200); }

.sermon-view-divider { height: 1px; background: var(--gray-200); margin-bottom: 28px; }
.sermon-view-content {
  font-size: .975rem; line-height: 1.85;
  color: var(--gray-700);
  white-space: pre-wrap;
}
.sermon-view-footer {
  display: flex; gap: 10px; margin-top: 32px;
  padding-top: 20px; border-top: 1px solid var(--gray-100);
}

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 500;
  align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white); border-radius: var(--radius);
  padding: 32px 28px; max-width: 400px; width: 100%;
  box-shadow: var(--shadow-lg); text-align: center;
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
}
.modal-icon--danger { background: var(--danger-lt); color: var(--danger); }
.modal-title { font-size: 1.05rem; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.modal-text  { font-size: .875rem; color: var(--gray-600); margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }

/* Print */
@media print {
  .sidebar, .topbar, .page-header, .sermon-view-footer { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .sermon-view { box-shadow: none; border: none; padding: 0; }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay.open { display: block; }
  .topbar { display: flex; }
  .main-wrapper { margin-left: 0; }
  .page-content { padding: 20px 16px; }
  .auth-card { padding: 28px 20px; }
  .form-card { padding: 20px 16px; }
  .sermon-view { padding: 20px 16px; }
  .form-row { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .sermon-title { max-width: 200px; }
  .page-header { flex-direction: column; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column; }
}