/* ============================================================
   EduTrip - Layout
   Header + Topbar + Main + Navigation + Staff Panel + Notifications
   ============================================================ */

/* ========== HEADER الأساسي ========== */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 60%, #1e5bb8 100%);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(26,58,107,0.3);
}
.logo-area { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  width: 56px; height: 56px;
  background: var(--gold);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.brand-logo-card {
  width: 132px; height: 84px; padding: 0;
  border-radius: 16px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 9px 21px rgba(0,0,0,.20);
  border: 1px solid rgba(255,255,255,.75);
}
.brand-logo {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  display: block; transform: scale(2.35);
}
.logo-text h1 { color: white; font-size: 22px; font-weight: 900; line-height: 1.2; }
.logo-text p { color: rgba(255,255,255,0.7); font-size: 12px; }
.header-contact { text-align: left; }
.header-contact p { color: rgba(255,255,255,0.85); font-size: 12px; line-height: 1.8; }
.header-contact a { color: var(--gold-light); text-decoration: none; }

@media(max-width:560px){
  .header { padding: 14px 16px; }
  .brand-logo-card { width: 108px; height: 68px; }
  .logo-text h1 { font-size: 20px; }
  .logo-text p { font-size: 10px; }
  .header-contact { display: none; }
  .topbar { padding-left: 14px; }
  .topbar-user {
    position: static; width: 100%; margin-right: 0;
    justify-content: flex-start; flex-direction: row; align-items: center;
  }
  .staff-welcome { padding: 6px 9px; }
  .topbar-user .staff-logout { width: auto; padding: 7px 10px; font-size: 12px; }
}

/* ========== MAIN ========== */
.main { max-width: 960px; margin: 0 auto; padding: 28px 16px 60px; }

/* ========== TOPBAR / NAVIGATION ========== */
.topbar {
  background: #12294d;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  position: relative;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
html:not(.page-visibility-ready) #topbar { visibility: hidden; }
.topbar.has-staff-user { padding-left: 250px; }
.topbar-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.topbar-tab {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.75);
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.topbar-tab:hover { background: rgba(255,255,255,0.08); color: white; }
.topbar-tab.active { background: var(--gold); color: var(--primary); }
.topbar-user {
  display: flex; align-items: center; gap: 10px;
  margin-right: auto; direction: rtl;
}
.topbar-user.staff-user-panel {
  position: absolute; left: 44px; top: 8px;
  width: 290px; margin: 0;
  flex-direction: column; align-items: center; gap: 6px;
}
.topbar-user span { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 600; }

/* Staff welcome */
.staff-welcome {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; width: auto; min-width: 245px;
  padding: 5px 9px; border-radius: 12px;
  background: linear-gradient(135deg,#fff,#eaf3ff);
  border: 1px solid rgba(255,255,255,.92);
  box-shadow: 0 7px 17px rgba(0,0,0,.18);
  min-height: 34px; box-sizing: border-box; overflow: visible;
}
.staff-welcome .staff-name { color: #102c56; font-size: 13px; font-weight: 900; white-space: nowrap; }
.staff-welcome .staff-wave { display: inline-block; font-size: 15px; line-height: 1; flex: 0 0 auto; }
.staff-welcome .badge {
  margin: 0 !important; color: #123d77 !important;
  background: #d9eaff !important; border: 1px solid #a9c9ef !important;
  font-size: 10px !important; font-weight: 900 !important;
  white-space: nowrap; padding: 4px 6px !important;
}
.topbar-user .staff-logout {
  background: rgba(255,255,255,.11) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,.48) !important;
  box-shadow: none; width: 106px;
  justify-content: center; padding: 6px 8px; font-size: 12px;
}
.topbar-user .staff-logout:hover { background: #fff !important; color: #123765 !important; }

.staff-profile-row {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; width: 100%; direction: rtl;
}
.staff-profile-row .staff-welcome { width: auto; min-width: 245px; flex: 0 1 auto; }

/* Notification bell */
.notification-bell {
  position: relative; width: 36px; height: 36px; flex: 0 0 36px;
  border: 1px solid rgba(255,255,255,.62); border-radius: 11px;
  background: rgba(255,255,255,.12); color: #fff;
  font-size: 18px; cursor: pointer; transition: .2s;
}
.notification-bell:hover,
.notification-bell.is-open { background: #fff; color: #123765; transform: translateY(-1px); }
.notification-count {
  position: absolute; min-width: 17px; height: 17px; padding: 0 3px;
  box-sizing: border-box; top: -7px; left: -7px;
  border-radius: 99px; background: #ef4444; color: #fff;
  border: 2px solid #12294d; font: 800 10px/13px Arial, sans-serif;
  text-align: center; display: none;
}
.notification-count.show { display: block; }
.notification-panel {
  position: absolute; z-index: 90; left: 0; top: 44px;
  width: min(380px, calc(100vw - 30px)); max-height: 440px; overflow: auto;
  padding: 10px; border: 1px solid #dbe6f3; border-radius: 14px;
  background: #fff; color: #10284d;
  box-shadow: 0 18px 42px rgba(3,24,58,.30);
  direction: rtl; text-align: right; display: none;
}
.notification-panel.show { display: block; }
.notification-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 6px 10px; border-bottom: 1px solid #e4ecf5;
  font-size: 14px; font-weight: 900;
}
.notification-panel-head span { color: #10284d !important; }
.notification-panel-head small { color: #6d819d; font-size: 11px; font-weight: 700; }
.notification-item {
  width: 100%; display: flex; gap: 10px; align-items: flex-start;
  border: 0; border-bottom: 1px solid #eef3f8; background: transparent;
  padding: 11px 6px; color: #18355d; text-align: right;
  font-family: 'Cairo', sans-serif; cursor: pointer;
}
.notification-item:hover { background: #f4f8fe; }
.notification-item:last-child { border-bottom: 0; }
.notification-icon {
  width: 30px; height: 30px; flex: 0 0 30px;
  display: grid; place-items: center;
  border-radius: 9px; background: #eaf2ff; font-size: 15px;
}
.notification-item.warning .notification-icon { background: #fff3db; }
.notification-item.danger .notification-icon { background: #fff0f0; }
.notification-copy { min-width: 0; flex: 1; color: #18355d !important; }
.notification-copy strong { display: block; color: #123765 !important; font-size: 12px; margin-bottom: 2px; }
.notification-copy span { display: block; color: #607793 !important; font-size: 11px; line-height: 1.55; }
.notification-copy time { display: block; margin-top: 3px; color: #99a9bd !important; font-size: 10px; }
.notification-empty { color: #6d819d; padding: 25px 12px; text-align: center; font-size: 13px; }

@media(max-width:560px){
  .topbar.has-staff-user { padding-left: 14px; }
  .staff-profile-row { width: auto; }
  .notification-panel { left: auto; right: 0; top: 44px; }
  .staff-profile-row .staff-welcome { width: auto; min-width: 160px; }
}
@media(max-width:560px){
  .topbar, .topbar.has-staff-user { padding-left: 14px; }
  .topbar-user, .topbar-user.staff-user-panel {
    position: static; width: 100%; margin-right: 0;
    justify-content: flex-start; flex-direction: row; align-items: center;
  }
  .topbar-user .staff-logout { width: auto; padding: 7px 10px; font-size: 12px; }
}

/* ========== VISUAL REFINEMENT ========== */
.header {
  position: relative; overflow: hidden;
  padding: 24px max(24px, calc((100% - 1120px) / 2));
  background: linear-gradient(120deg, #10284d 0%, #1b477f 55%, #2866ba 100%);
}
.header::after {
  content: ''; position: absolute; width: 320px; height: 320px;
  border-radius: 50%; left: -80px; top: -210px;
  background: rgba(255,255,255,.07); pointer-events: none;
}
.logo-area, .header-contact { position: relative; z-index: 1; }
.logo-icon { box-shadow: 0 8px 22px rgba(0,0,0,.2); transform: rotate(-4deg); }
.logo-text h1 { letter-spacing: .3px; font-size: 25px; }
.topbar {
  padding: 10px max(24px, calc((100% - 1120px) / 2));
  background: rgba(12,32,62,.97);
  box-shadow: 0 6px 18px rgba(16,40,77,.13);
}
.topbar-tab { padding: 9px 15px; }
.topbar-tab.active { box-shadow: 0 3px 10px rgba(212,168,67,.25); }
.main { max-width: 1120px; padding: 34px 20px 72px; }

/* ========== CUSTOMER HEADER REFRESH ========== */
.header {
  max-width: 1260px; margin: 16px auto 0;
  border-radius: 20px; padding: 17px 26px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #071f38, #0c4b77);
  box-shadow: 0 15px 40px rgba(7, 31, 56, .16);
}
.header::after {
  content: ''; position: absolute;
  width: 340px; height: 340px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%; left: -120px; top: -260px; pointer-events: none;
}
.logo-area, .header-contact { position: relative; z-index: 1; }
.logo-area { display: flex; align-items: center; gap: 14px; }
.brand-logo-card {
  width: 76px; height: 54px; padding: 0;
  border-radius: 12px; background: #fff;
  border: 1px solid rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; box-shadow: none;
}
.brand-logo {
  width: 100%; height: 100%;
  object-fit: contain; object-position: center;
  display: block; transform: scale(2.85);
}
.logo-text h1 { color: #fff; font-size: 21px; font-weight: 900; line-height: 1.2; letter-spacing: .6px; }
.logo-text p { color: rgba(255,255,255,.7); font-size: 11px; }
.header-contact.contact-header {
  display: flex !important; align-items: center;
  justify-content: flex-end; gap: 30px;
  padding: 0; min-height: auto; overflow: visible;
  background: transparent;
  font-family: "Cairo", sans-serif;
  color: #eaf2f8; text-align: initial;
}
.contact-decoration { display: none; }
.contact-item {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 10px;
  white-space: nowrap; font-size: 13px; font-weight: 700;
}
.contact-item i { width: 27px; height: 27px; color: #eef5f9; stroke-width: 2.5; }
.contact-item a { color: inherit; text-decoration: none; transition: color .2s ease; }
.contact-item a:hover { color: #d9ad46; }
.legacy-header { display: none !important; }

@media (max-width: 950px) { .header { margin: 0; border-radius: 0; } }
@media (max-width: 700px) { .header { padding: 20px; align-items: flex-start; gap: 18px; flex-direction: column; } }
@media (max-width: 650px) {
  .header-contact.contact-header { justify-content: center; gap: 14px; min-height: 64px; }
  .contact-item { font-size: 10px; gap: 5px; }
  .contact-item i { width: 20px; height: 20px; }
}

/* ========== NAVIGATION REFRESH ========== */
.topbar {
  max-width: 1160px; margin: 12px auto 0;
  padding: 7px 12px; min-height: 66px;
  border-radius: 18px; background: #fff;
  border: 1px solid rgba(30,74,124,.08);
  box-shadow: 0 14px 32px rgba(10,35,68,.12);
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
}
.topbar.has-staff-user { padding-left: 12px; }
.topbar-tabs { flex: 1; display: flex; align-items: center; justify-content: flex-start; gap: 5px; flex-wrap: wrap; }
.topbar-tab { color: #375474; padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.3; }
.topbar-tab:hover { background: #edf4fb; color: #0e4777; }
.topbar-tab.active { background: #0e4777; color: #fff; box-shadow: 0 6px 14px rgba(14,71,119,.21); }
.topbar-user { margin-right: auto; flex: 0 0 auto; }
#btn-login-nav {
  background: #fff !important;
  color: #123d6c !important;
  border-color: #b8cbe1 !important;
  box-shadow: none;
}
#btn-login-nav:hover { background: #edf4fb !important; }
.topbar-user.staff-user-panel {
  position: static; left: auto; top: auto;
  width: 280px; margin-right: auto;
  flex-direction: column; align-items: center; gap: 6px;
}
.topbar-user .staff-logout {
  background: #edf4fb !important;
  color: #123d6c !important;
  border-color: #b8cbe1 !important;
}
.notification-bell { border-color: #b8cbe1; background: #edf4fb; color: #123d6c; }

/* /staff login-only */
body.staff-login-only .header,
body.staff-login-only #topbar { display: none !important; }
body.staff-login-only .main {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding-top: 36px; padding-bottom: 36px;
}
body.staff-login-only #view-login { width: min(100%, 460px); }

@media (max-width: 950px) { .topbar { margin: 0; border-radius: 0; } }
@media (max-width: 700px) {
  .topbar { min-height: auto; padding: 9px 12px; align-items: flex-start; flex-direction: column; }
  .topbar-tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
  .topbar-tab { white-space: nowrap; }
  .topbar-user { margin-right: 0; }
  .topbar-user.staff-user-panel { width: 100%; margin-right: 0; justify-content: flex-start; }
}

/* Responsive tweaks for main */
@media(max-width:700px) {
  .header { padding: 20px; align-items: flex-start; gap: 18px; flex-direction: column; }
  .header-contact { text-align: right; }
  .topbar { padding: 10px 14px; }
  .topbar-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .topbar-tab { white-space: nowrap; }
  .main { padding: 22px 12px 48px; }
}