/* ============================================================
   Pigeon Pedigree Pro — Layout System
   ============================================================ */

/* ── App Shell ──────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition-normal);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  flex-shrink: 0;
  min-height: var(--topbar-height);
}
.sidebar-brand-icon {
  width: 34px; height: 34px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}
.sidebar-brand-text {
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-md);
  color: var(--color-white);
  white-space: nowrap;
  line-height: 1.1;
}
.sidebar-brand-sub {
  font-size: var(--font-size-xs);
  color: var(--color-primary-light);
  font-weight: var(--font-weight-medium);
}
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .sidebar-brand-sub { display: none; }

.sidebar-nav {
  flex: 1;
  padding: var(--space-3) 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
}

.nav-section-label {
  padding: var(--space-3) var(--space-4) var(--space-1);
  font-size: 10px;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.3);
  white-space: nowrap;
}
.sidebar.collapsed .nav-section-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px var(--space-4);
  margin: 1px var(--space-2);
  border-radius: var(--radius-md);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
}
.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-active);
  text-decoration: none;
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
}
.nav-item-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 16px;
}
.nav-item-text { flex: 1; }
.sidebar.collapsed .nav-item-text { display: none; }

.nav-badge {
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: var(--font-weight-bold);
  padding: 1px 5px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}
.sidebar.collapsed .nav-badge {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  padding: 0;
  border-radius: 50%;
}

.sidebar-footer {
  padding: var(--space-4);
  border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.sidebar-user:hover { background: var(--sidebar-hover-bg); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: var(--font-size-xs);
  color: var(--sidebar-text);
}
.sidebar.collapsed .sidebar-user-info { display: none; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}
.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-height);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-xs);
}
.topbar-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-secondary);
  border: none; background: none;
  transition: background var(--transition-fast);
}
.topbar-toggle:hover { background: var(--color-bg); }

.topbar-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}
.topbar-breadcrumb-current {
  color: var(--color-text-primary);
  font-weight: var(--font-weight-medium);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-secondary);
  border: none; background: none;
  transition: background var(--transition-fast);
  position: relative;
}
.topbar-icon-btn:hover { background: var(--color-bg); }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--topbar-bg);
}

/* ── Page Content ───────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: var(--space-6);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}
.page-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin: 0;
  line-height: 1.2;
}
.page-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ── Grid ───────────────────────────────────────────────────── */
.grid { display: grid; gap: var(--space-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width:  900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width:  640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: var(--space-4); }
}

/* ── Auth Layout (new look, 2026-11-11) ─────────────────────────
   Login, register, password and activation pages: cream split page
   matching the home hero. Left aside on desktop, form card on the right. */
.auth-shell {
  --auth-ink:    #1C1917;
  --auth-stone:  #44403C;
  --auth-muted:  #78716C;
  --auth-border: #EFE3D5;
  --auth-serif:  'Source Serif 4', Georgia, 'Times New Roman', serif;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background:
    radial-gradient(900px 520px at 15% 20%, rgba(251,146,60,.20), transparent 65%),
    linear-gradient(180deg, #FFF9F2 0%, #FDF0E1 100%);
}
.auth-aside { display: flex; align-items: center; justify-content: center; padding: 48px 40px; border-inline-end: 1px solid var(--auth-border); }
.auth-aside-inner { max-width: 460px; }
.auth-eyebrow { display: flex; align-items: center; gap: 14px; color: var(--color-primary); font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; margin-bottom: 20px; }
.auth-eyebrow::before { content: ''; width: 40px; height: 2px; background: var(--color-primary); flex-shrink: 0; }
.auth-headline { font-family: var(--auth-serif); font-weight: 700; font-size: clamp(34px, 3.6vw, 52px); line-height: 1.06; color: var(--auth-ink); letter-spacing: -.01em; }
.auth-headline span { display: block; color: var(--color-primary); }
.auth-points { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--auth-stone); }
.auth-points i { font-size: 20px; color: var(--color-primary); }
.auth-bird { display: block; width: 230px; height: auto; margin: 30px 0 0 auto; mix-blend-mode: multiply; }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); padding: var(--space-8) var(--space-6); }
/* Way back to the public site from login, register, password and activation pages. */
.auth-back {
  align-self: center;
  width: 100%;
  max-width: 440px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--auth-stone);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}
.auth-back:hover { color: var(--color-primary); }
[dir=rtl] .auth-back .ph-arrow-left { transform: scaleX(-1); }
.auth-home-link { display: inline-flex; flex-direction: column; align-items: center; text-decoration: none; }
.auth-home-link:hover .auth-title { color: var(--color-primary-dark); }
.auth-links { font-size: var(--font-size-sm); color: var(--auth-muted); }
.auth-links a { color: var(--auth-stone); text-decoration: none; }
.auth-links a:hover { color: var(--color-primary); }
.auth-card {
  background: var(--color-white);
  border: 1px solid var(--auth-border);
  border-radius: 24px;
  box-shadow: 0 24px 60px rgba(120,53,15,.12);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
}
.auth-card-header { padding: var(--space-8) var(--space-6) var(--space-2); text-align: center; }
.auth-logo-img { width: 64px; height: 64px; border-radius: 50%; display: block; margin: 0 auto var(--space-3); }
.auth-title { font-family: var(--auth-serif); color: var(--auth-ink); font-size: 24px; font-weight: 700; margin: 0 0 var(--space-1); letter-spacing: -.01em; }
.auth-title em { font-style: normal; color: var(--color-primary); }
.auth-subtitle { color: var(--auth-muted); font-size: var(--font-size-md); }
.auth-card-body { padding: var(--space-5, 20px) var(--space-6) var(--space-6); }
.auth-card-body .form-control { border-radius: 10px; border-color: var(--auth-border); background: #FFFCF8; min-height: 44px; }
.auth-card-body .form-control:focus { border-color: var(--color-primary); background: #fff; box-shadow: 0 0 0 3px rgba(230,81,0,.12); }
.auth-card-body .btn-primary { background: linear-gradient(180deg, #EA580C 0%, #C2410C 100%); border: none; border-radius: 12px; min-height: 46px; font-size: 15px; box-shadow: 0 6px 18px rgba(194,65,12,.28); }
.auth-card-body .btn-primary:hover { background: #C2410C; }
.auth-card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--auth-border);
  text-align: center;
  font-size: var(--font-size-sm);
  color: var(--auth-muted);
  background: #FFF9F2;
}
.auth-card-footer a { color: var(--color-primary); font-weight: 600; }
/* ── Language switcher placements ───────────────────────────── */
.auth-lang { display: flex; justify-content: center; }
.auth-lang .lang-switch-label { color: var(--auth-muted); }
.auth-lang .lang-switch select { color: var(--auth-ink); border-color: var(--auth-border); background: #fff; }
.auth-lang .lang-switch select option { color: #0F172A; }
@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 480px) {
  .auth-main { padding: var(--space-6) var(--space-4); }
  .auth-card-header { padding-top: var(--space-6); }
  .auth-card-body { padding: var(--space-4); }
}
.topbar-lang select { max-width: 120px; }
/* Phones: the bar has no room for it (it stays in Settings and the site menu); long breadcrumbs truncate. */
@media (max-width: 640px) {
  .topbar .lang-switch.topbar-lang { display: none; }
  .topbar-breadcrumb { min-width: 0; overflow: hidden; white-space: nowrap; }
  .topbar-breadcrumb > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  /* Long words (German, Polish) must not widen the page: let the column shrink and titles break. */
  .main-content { min-width: 0; }
  .page-title, .page-subtitle, .card-title { overflow-wrap: anywhere; }
  .page-header > div[style*="display:flex"] { flex-wrap: wrap; }
}

/* ── Right-to-left (Arabic) ─────────────────────────────────── */
/* <html dir="rtl"> already mirrors text and flex rows; these flip the
   fixed sidebar and the margins that are written as left/right. */
[dir="rtl"] .sidebar { left: auto; right: 0; }
[dir="rtl"] .main-content { margin-left: 0; margin-right: var(--sidebar-width); transition: margin-right var(--transition-normal); }
[dir="rtl"] .sidebar.collapsed ~ .main-content { margin-left: 0; margin-right: var(--sidebar-collapsed); }
[dir="rtl"] .dropdown-menu { right: auto !important; left: 0; }
[dir="rtl"] .ph-arrow-left, [dir="rtl"] .ph-arrow-right,
[dir="rtl"] .ph-caret-left, [dir="rtl"] .ph-caret-right { transform: scaleX(-1); }
@media (max-width: 640px) {
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  [dir="rtl"] .sidebar.mobile-open { transform: translateX(0); }
  [dir="rtl"] .main-content { margin-right: 0 !important; }
}
