/* ============================================================
   profile.css — بوصلة Profile Page
   ============================================================ */

:root {
  --dark:        #012a22;
  --dark-2:      #013128;
  --teal:        #0e6b57;
  --teal-mid:    #d9c994;
  --teal-light:  #eee1b8;
  --gold:        #d9c994;
  --gold-light:  #eee1b8;
  --white:       #ffffff;
  --off-white:   #eef6f5;
  --muted:       #7db8b2;
  --light-bg:    #f3f9f8;
  --text-dark:   #0d2420;
  --text-mid:    #2a4a46;
  --border:      rgba(217, 201, 148, 0.22);
  --ok:          #22c55e;
  --warn:        #f59e0b;
  --danger:      #ef4444;
  --radius:      16px;
  --radius-sm:   10px;
  --trans:       0.28s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
  background: var(--light-bg);
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
}

[dir="rtl"] body {
  font-family: "IBM Plex Sans Arabic", "Segoe UI", system-ui, sans-serif;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ══════════════════════════════════════════════════════════
   AUTH GUARD (not logged in)
══════════════════════════════════════════════════════════ */
.auth-guard {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.guard-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 56px 48px;
  text-align: center;
  max-width: 440px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.07);
}

.guard-icon {
  font-size: 52px;
  color: var(--teal-light);
  margin-bottom: 20px;
}

.guard-box h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.guard-box p {
  font-size: 15px;
  color: #5a7a77;
  margin-bottom: 28px;
  line-height: 1.7;
}

/* ══════════════════════════════════════════════════════════
   SHARED BUTTONS
══════════════════════════════════════════════════════════ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  padding: 13px 28px;
  border-radius: 50px;
  box-shadow: 0 8px 22px rgba(14, 122, 112, 0.32);
  transition: filter var(--trans), transform var(--trans), box-shadow var(--trans);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(14, 122, 112, 0.46);
  color: var(--white);
}

.btn-save {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: linear-gradient(135deg, var(--teal-mid), var(--teal));
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
  padding: 11px 26px;
  border-radius: 50px;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(14, 122, 112, 0.28);
  transition: filter var(--trans), transform var(--trans);
}

.btn-save:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-save.loading {
  opacity: 0.65;
  pointer-events: none;
}

.btn-cancel {
  font-size: 14px;
  font-weight: 600;
  color: #7a9a98;
  padding: 11px 20px;
  border-radius: 50px;
  border: 1.5px solid #d0e8e5;
  background: transparent;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}

.btn-cancel:hover {
  background: var(--light-bg);
  color: var(--text-mid);
  border-color: var(--teal-light);
}

/* ══════════════════════════════════════════════════════════
   PROFILE HEADER
══════════════════════════════════════════════════════════ */
.profile-header {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 60%, #0f2e2a 100%);
  padding: 60px 28px 70px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.ph-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.ph-avatar {
  position: relative;
  width: 96px;
  height: 96px;
}

.ph-avatar i {
  font-size: 96px;
  color: var(--teal-light);
  line-height: 1;
  filter: drop-shadow(0 4px 16px rgba(94, 196, 187, 0.4));
}

.ph-avatar-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2.5px solid rgba(94, 196, 187, 0.35);
  animation: ringPulse 3s ease-in-out infinite;
}

@keyframes ringPulse {
  0%, 100% { transform: scale(1);   opacity: 0.5; }
  50%       { transform: scale(1.06); opacity: 1;   }
}

.ph-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ph-name {
  font-size: 28px;
  font-weight: 800;
  color: var(--white);
}

.ph-username {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.ph-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(94, 196, 187, 0.12);
  border: 1px solid rgba(94, 196, 187, 0.3);
  color: var(--teal-light);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 5px 14px;
  border-radius: 30px;
}

.ph-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.15;
  pointer-events: none;
}

.ph-blob1 {
  width: 300px;
  height: 300px;
  background: var(--teal-mid);
  top: -100px;
  left: -60px;
}

.ph-blob2 {
  width: 240px;
  height: 240px;
  background: var(--gold);
  bottom: -80px;
  right: -40px;
}

/* ══════════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════════ */
.profile-toast {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  max-width: 700px;
  margin: 20px auto 0;
  animation: toastIn 0.3s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile-toast.success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #15803d;
}

.profile-toast.error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
}

/* ══════════════════════════════════════════════════════════
   PROFILE BODY & CARDS
══════════════════════════════════════════════════════════ */
.profile-body {
  max-width: 700px;
  margin: -28px auto 60px;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
  z-index: 2;
}

.profile-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.07);
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  padding: 32px;
  transition: box-shadow var(--trans);
}

.profile-card:hover {
  box-shadow: 0 10px 40px rgba(0,0,0,0.11);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid #eef3f2;
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.ch-info  { background: rgba(14, 122, 112, 0.1); color: var(--teal); }
.ch-pass  { background: rgba(201, 146, 42, 0.1); color: var(--gold); }

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.card-sub {
  font-size: 13px;
  color: #6a8e8a;
  line-height: 1.6;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.field-wrap {
  position: relative;
  margin-bottom: 18px;
}

.field-wrap input {
  width: 100%;
  padding: 14px 42px 14px 42px;
  border: 1.5px solid #d4e8e5;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  background: #f8fffe;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
  -webkit-appearance: none;
  appearance: none;
}

.field-wrap input:focus {
  border-color: var(--teal-light);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(94, 196, 187, 0.14);
}

.field-wrap input.invalid {
  border-color: var(--danger);
}

.field-wrap label {
  position: absolute;
  left: 42px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #7a9e9b;
  pointer-events: none;
  transition: all 0.2s ease;
  background: transparent;
  padding: 0 4px;
}

.field-wrap input:focus + label,
.field-wrap input:not(:placeholder-shown) + label {
  top: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  background: var(--white);
}

.field-wrap input[type="date"] + label {
  top: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  background: var(--white);
}

.fi {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #8ab8b4;
  pointer-events: none;
  z-index: 1;
}

.eye-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #8ab8b4;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color var(--trans);
}

.eye-btn:hover { color: var(--teal); }

.strength-wrap {
  height: 4px;
  background: #e5f0ef;
  border-radius: 4px;
  margin: -10px 0 8px;
  overflow: hidden;
}

.strength-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  transition: width 0.4s ease, background 0.4s ease;
}

.strength-label {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 12px;
  min-height: 16px;
}

.pass-tips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 20px;
}

.tip-item {
  font-size: 12px;
  font-weight: 600;
  color: #9ab8b5;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color var(--trans);
}

.tip-item.ok {
  color: var(--ok);
}

.tip-item.ok i { color: var(--ok); }
.tip-item:not(.ok) i { color: #ccc; }

.card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid #eef3f2;
}

/* ══════════════════════════════════════════════════════════
   QUICK LINKS CARD
══════════════════════════════════════════════════════════ */
.card-links { padding: 0; overflow: hidden; }

.quick-link-row { display: flex; flex-direction: column; }

.quick-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  text-align: left;
  width: 100%;
  transition: background var(--trans);
  cursor: pointer;
}

.quick-link:hover { background: #f3faf9; }

.ql-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.ql-plan   { background: rgba(14, 122, 112, 0.1); color: var(--teal); }
.ql-saved  { background: rgba(201, 146, 42, 0.1);  color: var(--gold); }
.ql-logout { background: rgba(239, 68, 68, 0.1);   color: var(--danger); }

.ql-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ql-body strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dark);
}

.ql-body span {
  font-size: 12px;
  color: #7a9e9b;
}

.ql-arrow {
  font-size: 12px;
  color: #b8d0ce;
  flex-shrink: 0;
}

.quick-link:hover .ql-arrow { color: var(--teal-light); }

.ql-divider {
  height: 1px;
  background: #eef3f2;
  margin: 0 28px;
}

/* ══════════════════════════════════════════════════════════
   RTL
══════════════════════════════════════════════════════════ */
[dir="rtl"] body {
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
}

[dir="rtl"] .field-wrap label  { left: auto; right: 42px; }
[dir="rtl"] .fi                { left: auto; right: 14px; }
[dir="rtl"] .eye-btn           { right: auto; left: 12px; }
[dir="rtl"] .field-wrap input  { padding: 14px 42px 14px 42px; }

[dir="rtl"] .field-wrap input:focus + label,
[dir="rtl"] .field-wrap input:not(:placeholder-shown) + label {
  right: 42px; left: auto;
}

[dir="rtl"] .quick-link { text-align: right; }
[dir="rtl"] .card-actions { flex-direction: row-reverse; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
  .profile-header { padding: 50px 20px 60px; }
  .ph-name        { font-size: 22px; }

  .profile-body   { margin-top: -20px; gap: 16px; }
  .profile-card   { padding: 22px 18px; }
  .card-header    { flex-direction: column; gap: 12px; }

  .field-row      { grid-template-columns: 1fr; gap: 0; }

  .card-actions   { flex-direction: column-reverse; align-items: stretch; }
  .btn-save,
  .btn-cancel     { width: 100%; justify-content: center; }

  .quick-link     { padding: 16px 18px; }
  .ql-divider     { margin: 0 18px; }

  .guard-box      { padding: 36px 22px; }
}
