/* ==========================================================================
   AD Companheirismo - Portal Pastoral, Missões & EAD Theme
   ========================================================================== */

/* DEFAULT THEME: LIGHT MODE */
:root {
  --navy-deep: #0F2547;
  --navy-main: #1A365D;
  --navy-light: #2B4C7E;
  --navy-card: #FFFFFF;

  --gold-main: #D97706;
  --gold-hover: #B45309;
  --gold-light: #D97706;
  --gold-bg: #FEF3C7;
  --gold-glow: rgba(217, 119, 6, 0.2);

  --danger-bg: #FEE2E2;
  --danger-text: #DC2626;
  --danger-border: #FCA5A5;

  --success-bg: #DCFCE7;
  --success-text: #166534;
  --success-border: #86EFAC;

  --warning-bg: #FEF9C3;
  --warning-text: #854D0E;
  --warning-border: #FDE047;

  --bg-page: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-input: #F1F5F9;
  --bg-header: #0F2547;

  --text-primary: #0F172A;
  --text-secondary: #334155;
  --text-muted: #475569;
  --header-text: #FFFFFF;

  --border-color: #E2E8F0;
  --border-gold: rgba(217, 119, 6, 0.35);

  --font-sans: 'Plus Jakarta Sans', sans-serif;
  --font-serif: 'Playfair Display', serif;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 0 15px rgba(217, 119, 6, 0.15);
}

/* OPTIONAL THEME: DARK MODE */
body.dark-theme {
  --navy-deep: #081226;
  --navy-main: #0F2547;
  --navy-light: #1A365D;
  --navy-card: #13284B;

  --gold-main: #D97706;
  --gold-hover: #B45309;
  --gold-light: #F59E0B;
  --gold-bg: #FEF3C7;
  --gold-glow: rgba(217, 119, 6, 0.25);

  --bg-page: #0B172C;
  --bg-card: #101F3C;
  --bg-input: #091325;
  --bg-header: rgba(8, 18, 38, 0.95);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --header-text: #F8FAFC;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-gold: rgba(217, 119, 6, 0.4);

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 0 20px rgba(217, 119, 6, 0.2);
}

html, body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

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

img, iframe, video, svg {
  max-width: 100%;
  height: auto;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  overflow-x: hidden;
}

/* Helpers */
.hidden { display: none !important; }
.text-gold { color: var(--gold-light) !important; }
.text-danger { color: #EF4444 !important; }
.text-success { color: #22C55E !important; }
.text-warning { color: #F59E0B !important; }
.bold { font-weight: 700; }
.margin-top-xs { margin-top: 8px; }
.margin-top-sm { margin-top: 12px; }
.margin-top-md { margin-top: 20px; }
.margin-top-lg { margin-top: 32px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  touch-action: manipulation;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-main) 0%, var(--gold-hover) 100%);
  color: #FFFFFF;
  box-shadow: var(--shadow-glow);
}

.btn-gold:hover, .btn-gold:active {
  background: var(--gold-hover);
  transform: translateY(-1px);
}

.btn-outline-gold {
  background: transparent;
  border: 1.5px solid var(--gold-main);
  color: var(--gold-light);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  border-color: var(--gold-main);
  color: var(--gold-main);
}

/* Auth / Login Page */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  background: var(--bg-page);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 28px 18px;
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  box-sizing: border-box;
}

.auth-header {
  text-align: center;
  margin-bottom: 28px;
}

.logo-circle {
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--gold-main), var(--gold-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  color: #FFF;
  font-size: 24px;
  box-shadow: var(--shadow-glow);
}

.auth-header h2 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  color: var(--text-primary);
}

.auth-header .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-group input, .form-control, select, textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus, select:focus, textarea:focus {
  border-color: var(--gold-main);
}

/* Demo Profiles Section */
.demo-profiles-container {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--border-color);
}

.demo-title {
  font-size: 0.82rem;
  color: var(--gold-light);
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.demo-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-demo {
  background: var(--bg-card);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: left;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-demo:hover {
  background: rgba(217, 119, 6, 0.1);
  border-color: var(--gold-main);
}

.btn-demo strong {
  display: block;
  font-size: 0.82rem;

}

.btn-demo small {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  margin-top: 14px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}

.alert-danger {
  background-color: #FEF2F2;
  border: 1.5px solid #FCA5A5;
  color: #991B1B;
}

.alert-danger strong {
  color: #7F1D1D;
}

.alert-danger i.fa-triangle-exclamation {
  color: #DC2626;
  font-size: 1.1rem;
}

.alert-warning {
  background-color: #FFFBEB;
  border: 1.5px solid #FDE68A;
  color: #92400E;
}

.alert-warning strong {
  color: #78350F;
}

.alert-warning i.fa-triangle-exclamation {
  color: #D97706;
  font-size: 1.1rem;
}

.alert-success {
  background-color: #F0FDF4;
  border: 1.5px solid #BBF7D0;
  color: #166534;
}

.alert .alert-btn {
  margin-top: 4px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.alert-danger .alert-btn {
  background: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.alert-danger .alert-btn:hover {
  background: #B91C1C;
}

.alert-warning .alert-btn {
  background: #D97706;
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.alert-warning .alert-btn:hover {
  background: #B45309;
}

/* Dark Mode Alert Overrides */
body.dark-theme .alert-danger {
  background-color: rgba(153, 27, 27, 0.35);
  border: 1.5px solid rgba(239, 68, 68, 0.5);
  color: #FECACA;
}

body.dark-theme .alert-danger strong {
  color: #FCA5A5;
}

body.dark-theme .alert-warning {
  background-color: rgba(146, 64, 14, 0.35);
  border: 1.5px solid rgba(245, 158, 11, 0.5);
  color: #FEF08A;
}

body.dark-theme .alert-warning strong {
  color: #FDE047;
}

body.dark-theme .alert-success {
  background-color: rgba(22, 101, 52, 0.35);
  border: 1.5px solid rgba(34, 197, 94, 0.5);
  color: #BBF7D0;
}

/* App Shell Structure */
.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 75px; /* space for bottom nav */
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-primary);
  max-width: 100vw;
  box-sizing: border-box;
  gap: 8px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.logo-mini {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold-main), var(--gold-light));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF;
  font-size: 16px;
}

.header-title {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-serif);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--gold-bg);
  color: var(--gold-hover);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex-shrink: 0;
}

.header-action-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-info {
  text-align: right;
  line-height: 1.2;
  margin-top: 3px;
}

.user-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}

.user-subtext {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.btn-logout-prominent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-logout-prominent:hover {
  background: #dc2626;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 3px 10px rgba(220, 38, 38, 0.25);
}

body.dark-theme .btn-logout-prominent {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.45);
}

body.dark-theme .btn-logout-prominent:hover {
  background: #ef4444;
  color: #ffffff;
}

.nav-item-logout {
  color: #ef4444 !important;
}

.nav-item-logout:hover,
.nav-item-logout:active {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #dc2626 !important;
}

/* App Main */
.app-main {
  flex: 1;
  padding: 18px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.section-title-wrapper h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.sub-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.date-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Dashboard Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  width: 100%;
}

.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
  overflow: hidden;
}

.metric-card.interactive-card {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.metric-card.interactive-card:hover {
  border-color: var(--gold-main);
  transform: translateY(-3px);
  box-shadow: 0 0 20px var(--gold-glow);
}

.metric-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(217, 119, 6, 0.15);
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.metric-info {
  min-width: 0;
  overflow: hidden;
}

.metric-info strong {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-info span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  word-break: break-word;
}

/* Cards Grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  width: 100%;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  border-color: var(--border-gold);
  transform: translateY(-2px);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-sub {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Church Card Specifics */
.church-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sector-pill {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--gold-bg);
  padding: 4px 10px;
  border-radius: 6px;
  color: #B45309;
  border: 1px solid #FDE68A;
}

body.dark-theme .sector-pill {
  background: rgba(217, 119, 6, 0.2);
  color: #F59E0B;
  border: 1px solid rgba(217, 119, 6, 0.4);
}

.visit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 8px;
}

.visit-badge.overdue {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FCA5A5;
}

.visit-badge.ok {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #86EFAC;
}

body.dark-theme .visit-badge.overdue {
  background: rgba(153, 27, 27, 0.35);
  color: #FECACA;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

body.dark-theme .visit-badge.ok {
  background: rgba(22, 101, 52, 0.35);
  color: #BBF7D0;
  border: 1px solid rgba(34, 197, 94, 0.5);
}

/* Evolution Box */
.evolution-box {
  background: var(--bg-card);
  border: 1.5px solid var(--gold-main);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

body.dark-theme .evolution-box {
  background: #101F3C;
  border: 1.5px solid var(--gold-main);
}

.evolution-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
  text-align: center;
}

.evo-card {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  padding: 12px;
  border-radius: var(--radius-sm);
}

.evo-card span {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.evo-card strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Member List & Prontuário */
.members-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.member-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.member-item.alert-needed {
  border-left: 4px solid var(--danger-text);
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.08) 0%, var(--bg-card) 100%);
}

.member-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.member-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
}

.status-tag.ativo {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #86EFAC;
}

.status-tag.afastado {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}

.status-tag.em_visita {
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FDE68A;
}

body.dark-theme .status-tag.ativo {
  background: rgba(22, 101, 52, 0.35);
  color: #BBF7D0;
  border: 1px solid rgba(34, 197, 94, 0.5);
}

body.dark-theme .status-tag.afastado {
  background: rgba(153, 27, 27, 0.35);
  color: #FECACA;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

body.dark-theme .status-tag.em_visita {
  background: rgba(146, 64, 14, 0.35);
  color: #FEF08A;
  border: 1px solid rgba(245, 158, 11, 0.5);
}

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-box input {
  padding-left: 36px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-md);
}

.modal-card.modal-lg {
  max-width: 750px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.video-container iframe {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
}

.box-inset {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text-primary);
}

body.dark-theme .box-inset {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.88rem;
  color: var(--text-primary);
}

body.dark-theme .history-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  color: var(--gold-light);
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 4px;
}

/* Bottom Navigation Bar (Mobile) */
.app-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-item i {
  font-size: 18px;
}

.nav-item.active, .nav-item:hover {
  color: var(--gold-main);
}

/* Responsive adjustments */
@media (min-width: 768px) {
  .app-wrapper {
    padding-bottom: 20px;
  }
  .app-nav {
    position: static;
    height: auto;
    background: transparent;
    border-top: none;
    box-shadow: none;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 18px 14px;
  }
  .nav-item {
    flex-direction: row;
    font-size: 0.9rem;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
  }
  .nav-item.active {
    background: var(--gold-bg);
    border-color: var(--gold-main);
    color: var(--gold-hover);
  }
}

/* Mobile Responsiveness Improvements */
@media (max-width: 576px) {
  .app-header {
    padding: 6px 10px;
    gap: 6px;
  }
  .header-left {
    gap: 6px;
  }
  .header-title {
    font-size: 0.85rem;
  }
  .role-badge {
    display: none;
  }
  .header-right {
    gap: 2px;
  }
  .user-info {
    display: block;
    max-width: 130px;
    overflow: hidden;
    margin-top: 2px;
  }
  .user-name {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .user-subtext {
    font-size: 0.62rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .btn-logout-prominent {
    padding: 4px 8px;
    font-size: 0.75rem;
    gap: 3px;
  }
  .btn-icon {
    width: 30px;
    height: 30px;
    font-size: 13px;
  }
  .app-main {
    padding: 12px 10px;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .metric-card {
    padding: 12px 10px;
    gap: 8px;
  }
  .metric-icon {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .metric-info strong {
    font-size: 1.2rem;
  }
  .metric-info span {
    font-size: 0.72rem;
  }
  .demo-buttons-grid {
    grid-template-columns: 1fr;
  }
  .section-title-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .modal-card {
    padding: 18px 12px;
  }
}

/* ==================== ENHANCED SEARCH STYLES ==================== */
.header-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  max-width: 320px;
  margin: 0 12px;
}
.header-search-bar:hover {
  border-color: var(--gold-main);
  box-shadow: 0 0 10px rgba(217, 119, 6, 0.15);
}
.header-search-bar .search-icon {
  color: var(--gold-main);
  font-size: 14px;
}
.header-search-bar .search-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-search-bar .search-shortcut {
  display: flex;
  gap: 3px;
}
.header-search-bar kbd, .search-modal-footer kbd {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 0.7rem;
  font-family: inherit;
  color: var(--text-secondary);
}

/* Enhanced Tab Search Boxes */
.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-box input {
  width: 100%;
  padding-left: 38px;
  padding-right: 32px;
  height: 42px;
  border-radius: 10px;
  transition: all 0.2s ease;
}
.search-box input:focus {
  border-color: var(--gold-main);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18);
}
.search-box .search-clear-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 50%;
  line-height: 1;
  transition: color 0.2s;
}
.search-box .search-clear-icon:hover {
  color: #ef4444;
}

.count-badge {
  display: inline-block;
  background: var(--gold-bg);
  color: var(--gold-main);
  border: 1px solid var(--border-color);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  margin-left: 8px;
}

/* Modal Search Card */
.modal-search-card {
  max-width: 680px;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.search-modal-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  gap: 12px;
  background: var(--bg-surface);
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  flex: 1;
  position: relative;
}

.search-modal-icon {
  color: var(--gold-main);
  font-size: 18px;
  position: absolute;
  left: 4px;
}

.search-input-wrapper input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 8px 36px 8px 32px;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
}

.btn-clear-search {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.search-close-btn {
  position: static;
  font-size: 24px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.search-filter-pills {
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  background: var(--card-bg);
}

.search-filter-pills .pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.search-filter-pills .pill.active,
.search-filter-pills .pill:hover {
  background: var(--gold-bg);
  border-color: var(--gold-main);
  color: var(--gold-hover);
}

.pill-badge {
  background: rgba(217, 119, 6, 0.2);
  color: var(--gold-main);
  font-size: 0.72rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.global-results-list {
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 16px;
}

.search-section-header {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold-main);
  margin: 12px 8px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--bg-surface);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.search-result-item:hover {
  border-color: var(--gold-main);
  background: var(--gold-bg);
  transform: translateX(3px);
}

.result-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.result-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(217, 119, 6, 0.15);
  color: var(--gold-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.result-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.result-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-title mark {
  background: rgba(217, 119, 6, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.result-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.search-empty-state i {
  font-size: 40px;
  color: var(--gold-main);
  margin-bottom: 12px;
}

.search-modal-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .header-search-bar {
    max-width: 150px;
    margin: 0 4px;
    padding: 4px 8px;
  }
  .header-search-bar .search-shortcut {
    display: none;
  }
}
