/* =============================================================
   auth.css — Login Modal & User Dropdown — متجر 7oor
   ============================================================= */

/* ---- Modal Overlay ---- */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.auth-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* ---- Modal Card ---- */
.auth-modal {
  background: #fff;
  border-radius: 22px;
  width: 430px;
  max-width: calc(100vw - 32px);
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(40px) scale(0.95);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 28px 70px rgba(233, 30, 99, 0.2), 0 4px 24px rgba(0,0,0,0.12);
}
.auth-modal-overlay.open .auth-modal {
  transform: translateY(0) scale(1);
}

/* ---- Modal Header ---- */
.auth-modal-header {
  background: linear-gradient(135deg, #ad1457 0%, #e91e63 60%, #f06292 100%);
  border-radius: 22px 22px 0 0;
  padding: 28px 24px 22px;
  text-align: center;
  position: relative;
}
.auth-modal-header img {
  height: 50px;
  margin-bottom: 10px;
  filter: brightness(0) invert(1);
  mix-blend-mode: normal;
}
.auth-modal-header h2 {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.3px;
}
.auth-modal-header p {
  color: rgba(255,255,255,0.78);
  font-size: 0.83rem;
  margin: 5px 0 0;
}
.auth-modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255,255,255,0.22);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}
.auth-modal-close:hover { background: rgba(255,255,255,0.38); }

/* ---- Tabs ---- */
.auth-tabs {
  display: flex;
  border-bottom: 2px solid #f3f3f3;
}
.auth-tab {
  flex: 1;
  padding: 14px;
  text-align: center;
  font-size: 0.93rem;
  font-weight: 700;
  color: #aaa;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-bottom-color 0.2s;
  user-select: none;
}
.auth-tab.active {
  color: #e91e63;
  border-bottom-color: #e91e63;
}

/* ---- Panels ---- */
.auth-panel {
  padding: 24px 26px 28px;
  display: none;
}
.auth-panel.active { display: block; }

/* ---- Fields ---- */
.auth-field {
  margin-bottom: 15px;
}
.auth-field label {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}
.auth-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  font-size: 0.93rem;
  font-family: inherit;
  transition: border-color 0.22s, box-shadow 0.22s;
  box-sizing: border-box;
  direction: ltr;
  text-align: right;
  background: #fafafa;
}
.auth-field input:focus {
  outline: none;
  border-color: #e91e63;
  box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.12);
  background: #fff;
}
.auth-field input.invalid {
  border-color: #e53935;
}
.auth-field-error {
  font-size: 0.79rem;
  color: #e53935;
  margin-top: 4px;
  min-height: 16px;
  display: block;
}

/* ---- Error Banner ---- */
.auth-error-banner {
  background: #fce4ec;
  color: #b71c1c;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 0.87rem;
  margin-bottom: 14px;
  display: none;
  font-weight: 500;
  border-right: 3px solid #e53935;
}
.auth-error-banner.show { display: block; }

/* ---- Submit Button ---- */
.auth-submit-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #c2185b, #e91e63);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 8px;
  transition: opacity 0.2s, transform 0.18s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(233,30,99,0.3);
}
.auth-submit-btn:hover {
  opacity: 0.92;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233,30,99,0.4);
}
.auth-submit-btn:active { transform: translateY(0); box-shadow: none; }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Switch text ---- */
.auth-switch-text {
  text-align: center;
  font-size: 0.84rem;
  color: #999;
  margin-top: 14px;
}
.auth-switch-text a {
  color: #e91e63;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.auth-switch-text a:hover { text-decoration: underline; }

/* ---- Divider ---- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 6px;
  color: #ccc;
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #eee;
}

/* ============================================================
   User Menu (when logged in)
   ============================================================ */
.user-menu-wrap {
  position: relative;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 20px;
  color: var(--color-text-main, #222);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.2s;
}
.user-menu-btn:hover { background: rgba(233,30,99,0.08); }

.user-avatar {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c2185b, #e91e63);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(233,30,99,0.3);
}
.user-menu-name {
  max-width: 75px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.83rem;
}
.user-menu-caret {
  transition: transform 0.25s;
  opacity: 0.6;
}
.user-menu-wrap.open .user-menu-caret { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 36px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
  min-width: 180px;
  overflow: hidden;
  z-index: 3000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.97);
  transition: all 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.user-menu-wrap.open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.user-dropdown-header {
  padding: 14px 16px 10px;
  background: linear-gradient(135deg, #fce4ec, #fff);
  border-bottom: 1px solid #f8e4ec;
}
.user-dropdown-header .ud-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: #222;
}
.user-dropdown-header .ud-role {
  font-size: 0.76rem;
  color: #e91e63;
  margin-top: 2px;
}

.user-dropdown a,
.user-dropdown button.dd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  font-size: 0.89rem;
  font-family: inherit;
  color: #333;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  text-align: right;
  transition: background 0.18s;
  box-sizing: border-box;
}
.user-dropdown a:hover,
.user-dropdown button.dd-item:hover { background: #fce4ec; color: #c2185b; }

.dropdown-divider {
  height: 1px;
  background: #f5f5f5;
  margin: 4px 0;
}
.logout-dd-btn { color: #e53935 !important; }
.logout-dd-btn:hover { background: #fff0f0 !important; color: #b71c1c !important; }
