/*
|--------------------------------------------------------------------------
| File: public/assets/css/components.css
|--------------------------------------------------------------------------
|
| Description:
| Shared UI components:
| - hero sections
| - cards
| - section headers
| - buttons
| - alerts
| - badges
| - quick stat cards
| - global search
| - topbar user/avatar/mobile search widgets
|
|--------------------------------------------------------------------------
*/

.page-hero{
  background: var(--hero-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 24px;
}

.page-hero-title{
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.page-hero-subtitle{
  color: var(--text-secondary);
  max-width: 900px;
  line-height: 1.5;
}

.card,
.table-card,
.form-card{
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 16px;
}

.filter-card{
  margin-bottom: 16px;
}

.section-header{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header-tight{
  padding: 16px 16px 0;
}

.section-header-subtle{
  padding: 8px 16px 0;
}

.heading-reset{
  margin: 0;
}

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover{
  text-decoration: none;
}

.btn-primary{
  background: var(--accent-color);
  color: #fff;
}

.btn-primary:hover{
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary{
  background: #fff;
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover{
  background: #F9FAFB;
  color: var(--text-primary);
}

.btn-soft{
  background: #F9FAFB;
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-soft:hover{
  background: #F3F4F6;
  color: var(--text-primary);
}

.alert{
  border: 1px solid;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  line-height: 1.5;
}

.alert-success{
  background: var(--success-soft);
  border-color: #A7F3D0;
  color: #065F46;
}

.alert-danger{
  background: var(--danger-soft);
  border-color: #FECACA;
  color: #991B1B;
}

.badge{
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-success{
  background: var(--success-soft);
  color: #065F46;
}

.badge-danger{
  background: var(--danger-soft);
  color: #991B1B;
}

.badge-info{
  background: var(--info-soft);
  color: #1D4ED8;
}

.hero-quick-stats{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.hero-quick-stat{
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  min-height: 86px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-quick-stat-label{
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.hero-quick-stat-value{
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.results-meta{
  font-size: 13px;
  color: var(--text-secondary);
}

.filter-loading{
  display: none;
  font-size: 13px;
  color: var(--text-secondary);
  margin-left: auto;
}

.filter-loading.is-visible{
  display: inline-block;
}

.filter-actions{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/*-------------------------------------------------------------------------- 
| Global Search
|--------------------------------------------------------------------------*/

.global-search{
  position: relative;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.global-search-input{
  width: 100%;
  height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text-primary);
  font-size: 14px;
}

.global-search-dropdown{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  max-height: 420px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}

.global-search-dropdown.is-visible{
  display: block;
}

.global-search-item{
  display: block;
  padding: 10px 12px;
  text-decoration: none;
  border-bottom: 1px solid var(--border-color);
}

.global-search-item:last-child{
  border-bottom: none;
}

.global-search-item:hover{
  background: #F9FAFB;
  text-decoration: none;
}

.global-search-type{
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-color);
  margin-bottom: 4px;
  text-transform: uppercase;
}

.global-search-title{
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.global-search-subtitle{
  font-size: 12px;
  color: var(--text-secondary);
}

.global-search-empty{
  padding: 12px;
  font-size: 13px;
  color: var(--text-secondary);
}

/*-------------------------------------------------------------------------- 
| Topbar User / Avatar / Mobile Search Widgets
|--------------------------------------------------------------------------*/

.topbar-page-title{
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
}

.topbar-user{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  margin-left: auto;
}

.topbar-user-role{
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.2;
}

.topbar-user-name{
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.topbar-user-meta{
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.topbar-avatar-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.topbar-avatar{
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.topbar-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mobile-search-toggle{
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  outline: none;
}

.mobile-search-toggle:hover{
  background: transparent;
}

.mobile-search-toggle:focus,
.mobile-search-toggle:focus-visible{
  outline: none;
  box-shadow: none;
}

.mobile-search-toggle svg{
  width: 22px;
  height: 22px;
  display: block;
}

.mobile-search-overlay{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 1200;
  display: none;
}

.mobile-search-overlay.is-visible{
  display: block;
}

.mobile-search-panel{
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  z-index: 1201;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--card-shadow);
  padding: 12px;
  display: none;
}

.mobile-search-panel.is-visible{
  display: block;
}

.mobile-search-header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.mobile-search-close{
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: #fff;
  color: var(--text-primary);
  cursor: pointer;
}

/*-------------------------------------------------------------------------- 
| Responsive
|--------------------------------------------------------------------------*/

@media (max-width: 992px){
  .hero-quick-stats{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .global-search{
    max-width: 460px;
  }
}

@media (max-width: 768px){
  .mobile-search-toggle{
    display: inline-flex;
  }

  .topbar-user-meta{
    display: none;
  }
}

@media (max-width: 576px){
  .hero-quick-stats{
    grid-template-columns: 1fr;
  }

  .hero-quick-stat{
    min-height: auto;
  }

  .section-header{
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions{
    flex-direction: column;
    align-items: stretch;
  }

  .filter-loading{
    margin-left: 0;
  }
}