/**
 * RaceDesk - Layout Shell Styles
 * Header (Logo, Dynamic Title, Login, Language Switcher), Full-Width Content, Footer
 */

.app-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =========================================
   0. IMPERSONATION / TEST MODE BANNER
   ========================================= */
.impersonation-banner {
  background: linear-gradient(90deg, #b45309, #d97706);
  color: #ffffff;
  padding: 8px 24px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.3);
  z-index: 1001;
  position: sticky;
  top: 0;
}

.impersonation-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.impersonation-banner-content i {
  font-size: 16px;
  color: #fef3c7;
}

.impersonation-banner-btn {
  background: #ffffff;
  color: #92400e;
  border: none;
  font-weight: 700;
  font-size: 12px;
  padding: 5px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  transition: all 0.15s ease;
}

.impersonation-banner-btn:hover {
  background: #fef3c7;
  color: #78350f;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* =========================================
   1. GLOBAL APP HEADER
   ========================================= */
.app-header {
  background-color: var(--color-header-bg);
  color: var(--color-header-text);
  border-bottom: 1px solid var(--color-header-border);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.header-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.header-title-divider {
  width: 1px;
  height: 24px;
  background-color: #334155;
}

.header-content-title {
  font-size: 17px;
  font-weight: 600;
  color: #f1f5f9;
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Header Navigation & Buttons */
.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

.header-nav-btn,
.header-nav .btn,
.app-header .btn-auth,
.app-header .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  padding: 6px 14px;
  min-height: 32px;
  font-size: 13px !important;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.header-nav-btn:hover,
.header-nav .btn:hover,
.app-header .btn-auth:hover {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.header-nav-btn.active,
.header-nav-btn.btn-primary,
.header-nav .btn.btn-primary,
.header-nav .btn-primary,
.app-header .btn-primary {
  background-color: var(--color-primary);
  border: 1px solid var(--color-primary);
  color: #ffffff;
  font-size: 13px !important;
  font-weight: 600;
  padding: 6px 14px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.4);
}

/* Language Selector */
.lang-selector {
  display: flex;
  align-items: center;
  background: #1e293b;
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid #334155;
}

.lang-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 12px !important;
  font-weight: 700;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.12s ease;
  line-height: 1.2;
}
.lang-btn:hover {
  color: #ffffff;
}
.lang-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  font-size: 12px !important;
  font-weight: 700;
}

/* =========================================
   2. MAIN CONTENT AREA (Full-Width)
   ========================================= */
.app-main {
  flex: 1 0 auto;
  background-color: var(--color-content-bg);
  width: 100%;
  padding: 24px;
}

.page-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-heading {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.02em;
}

.page-subheading {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* =========================================
   3. FOOTER
   ========================================= */
.app-footer {
  background-color: #f8fafc;
  border-top: 1px solid var(--color-border);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--color-text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-link {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.footer-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* =========================================
   4. MOBILE OFF-CANVAS DRAWER & RESPONSIVE
   ========================================= */

/* Desktop defaults: hide mobile-only elements */
.mobile-menu-toggle {
  display: none;
}
.mobile-nav-backdrop {
  display: none;
}
.mobile-nav-drawer {
  display: none;
}

/* Base Mobile Drawer Styles (Active when opened or on mobile) */
.mobile-menu-toggle {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f8fafc;
  font-size: 18px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mobile-menu-toggle:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.mobile-nav-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
  display: block;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82%;
  max-width: 340px;
  background: #0f172a;
  color: #f8fafc;
  z-index: 1510;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 25px rgba(0, 0, 0, 0.5);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.mobile-nav-drawer.open {
  transform: translateX(0);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #1e293b;
  background: #0b1120;
}

.mobile-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-nav-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.mobile-nav-close:hover {
  color: #ffffff;
  background: #1e293b;
}

.mobile-nav-user-box {
  padding: 16px 20px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-nav-user-avatar {
  width: 38px;
  height: 38px;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

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

.mobile-nav-user-name {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-nav-user-role {
  margin-top: 3px;
}

.mobile-nav-links {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.mobile-nav-link i {
  font-size: 16px;
  width: 20px;
  text-align: center;
  color: #94a3b8;
}

.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: #1e293b;
  color: #ffffff;
}

.mobile-nav-link.active {
  background: var(--color-primary);
  color: #ffffff;
}

.mobile-nav-link.active i {
  color: #ffffff;
}

.mobile-nav-footer {
  padding: 18px 20px;
  border-top: 1px solid #1e293b;
  background: #0b1120;
}

/* =========================================
   5. TABLET BREAKPOINTS (768px – 1024px)
   ========================================= */
@media (max-width: 1024px) and (min-width: 769px) {
  .app-header {
    padding: 0 16px;
  }
  .header-nav {
    gap: 4px;
    margin-left: 6px;
  }
  .header-nav-btn,
  .header-nav .btn {
    padding: 5px 10px;
    font-size: 12px !important;
  }
  .lang-btn {
    padding: 4px 6px;
    font-size: 11px !important;
  }
  .app-main {
    padding: 18px 16px;
  }
}

/* =========================================
   6. MOBILE BREAKPOINTS (< 768px)
   ========================================= */
@media (max-width: 768px) {
  .app-header {
    padding: 0 14px;
    height: 58px;
  }
  .header-nav {
    display: none !important;
  }
  .header-title-divider,
  .header-content-title {
    display: none !important;
  }
  .desktop-lang-selector {
    display: none !important;
  }
  .header-right .btn-auth,
  .header-right span {
    display: none !important;
  }
  .mobile-menu-toggle {
    display: flex !important;
  }
  .mobile-nav-backdrop,
  .mobile-nav-drawer {
    display: flex !important;
  }
  .app-main {
    padding: 14px 10px 32px;
  }
  .impersonation-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 14px;
  }
  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 14px;
    gap: 14px;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 12px 16px;
  }
  .page-header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-header-bar > div:last-child {
    width: 100%;
  }
  .page-header-bar .btn {
    width: 100%;
    justify-content: center;
    min-height: 42px;
  }
}

/* =========================================
   SPORT LABELS (Desktop / Tablet vs Mobile)
   ========================================= */
.sport-label-short {
  display: none !important;
}
.sport-label-full {
  display: inline !important;
}

/* On smartphones / narrow mobile screens (<= 600px), display short sport codes (AL, CC, BI).
   On iPad mini (744px / 768px), standard iPads and larger tablets, display full sport names. */
@media (max-width: 600px) {
  .sport-label-short {
    display: inline !important;
  }
  .sport-label-full {
    display: none !important;
  }
}

