/* ================================================================
   public/css/profile.css
   Shared stylesheet for all profile / account pages.
   Loaded by layouts/profile.blade.php — no page should duplicate
   any of these rules.
   ================================================================ */

/* ── 1. Design Tokens ── */
:root {
  /* Brand */
  --orange:        #f5841f;
  --orange-hover:  #e0730e;
  --orange-light:  #fff4ee;

  /* Surface */
  --bg:            #ffffff;
  --white:         #ffffff;
  --input-bg:      #f5f5f5;
  --light-gray:    #f7f7f7;
  --light:         #fafafa;

  /* Text */
  --dark:          #1a1a1a;
  --text-dark:     #1a1a1a;
  --text-mid:      #555555;
  --text-light:    #999999;
  --text-lighter:  #cccccc;

  /* Semantic */
  --green:         #2ea84a;
  --red:           #e53e3e;
  --blue:          #2878d0;
  --purple:        #8e44ad;

  /* Structure */
  --border:        #e8e8e8;
  --shadow:        0 1px 6px rgba(0,0,0,0.07);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.08);
  --radius:        8px;
  --radius-lg:     12px;

  /* Layout */
  --sidebar-w:     210px;
  --page-max:      1280px;
  --page-pad:      28px;
}

/* ── 2. Reset + Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
}

/* ── 3. Breadcrumb ── */
.profile-breadcrumb {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  padding: 18px var(--page-pad) 0;
  font-size: 13px;
  max-width: var(--page-max);
  margin: 0 auto;
}

[dir="ltr"] .profile-breadcrumb { justify-content: flex-start; }

.profile-breadcrumb a {
  color: var(--text-light);
  text-decoration: none;
  transition: color .15s;
}
.profile-breadcrumb a:hover { color: var(--orange); }
.profile-breadcrumb .sep { color: var(--text-lighter); font-size: 11px; }
.profile-breadcrumb .crumb-active { color: var(--text-dark); font-weight: 600; }

/* ── 4. Two-column Layout ── */
.profile-page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px var(--page-pad) 60px;
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.profile-main {
  flex: 1;
  min-width: 0;
}

/* ── 5. Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 13px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  transition: background .15s;
  background: #fff;
}
.nav-item:last-of-type { border-bottom: none; }
.nav-item:hover { background: var(--light); }
.nav-item i { font-size: 15px; color: var(--text-mid); flex-shrink: 0; width: 18px; text-align: center; }
.nav-item.active { background: var(--orange); color: #fff; }
.nav-item.active i { color: #fff; }
.nav-item.logout { color: var(--red); }
.nav-item.logout i { color: var(--red); }
.nav-item.logout:hover { background: #fff5f5; }

/* ── 6. Page Card Shell ── */
.page-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.page-card-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-card-title {
  font-size: 17px;
  font-weight: 800;
  text-align: right;
}
[dir="ltr"] .page-card-title { text-align: left; }

.page-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-mid);
}

/* ── 7. Form Fields ── */
.field-group { margin-bottom: 18px; }

.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  text-align: right;
  margin-bottom: 7px;
  display: block;
}
[dir="ltr"] .field-label { text-align: left; }

.inp {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  display: block;
  height: 46px;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 0 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  color: var(--text-dark);
  text-align: right;
  outline: none;
  transition: border-color .18s, background .18s;
}
[dir="ltr"] .inp { text-align: left; }
.inp[type="email"] { direction: ltr; text-align: left; }
.inp::placeholder { color: var(--text-light); }
.inp:focus { border-color: var(--orange); background: #fff; }

/* ── 8. Phone Row ── */
.phone-row {
  display: flex;
  align-items: stretch;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: 6px;
  height: 46px;
  transition: border-color .18s;
  direction: ltr;
  position: relative;
}
.phone-row:focus-within { border-color: var(--orange); background: #fff; }
.phone-row:focus-within .phone-code,
.phone-row:focus-within .phone-input { background: #fff; }

.phone-code {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 10px;
  border-right: 1.5px solid var(--border);
  background: var(--input-bg);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s;
  border-radius: 6px 0 0 6px;
  min-width: 88px;
  user-select: none;
}
.phone-code .flag { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.phone-code .chevron { color: var(--text-light); font-size: 9px; margin-right: 2px; transition: transform .2s; }
.phone-code:hover { background: #efefef; }

.phone-input {
  box-sizing: border-box;
  flex: 1;
  border: none;
  background: transparent;
  padding: 0 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 13.5px;
  color: var(--text-dark);
  text-align: left;
  outline: none;
}
.phone-input::placeholder { color: var(--text-light); }

/* Phone country dropdown */
.phone-code-wrap {
  position: relative;
  flex-shrink: 0;
}
.phone-code-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 260px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.13);
  z-index: 9999;
  overflow: hidden;
}
.phone-code-dropdown.open { display: block; }

.phone-code-search-wrap {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
}
.phone-code-search-wrap i { color: var(--text-light); font-size: 13px; flex-shrink: 0; }
.phone-code-search {
  flex: 1;
  border: none;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  color: var(--text-dark);
  outline: none;
  background: transparent;
  direction: rtl;
}
.phone-code-search::placeholder { color: var(--text-light); }

.phone-code-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.phone-code-list::-webkit-scrollbar { width: 4px; }
.phone-code-list::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.phone-code-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
  direction: ltr;
  transition: background .12s;
}
.phone-code-option:hover, .phone-code-option.selected { background: #fff8f3; }
.phone-code-option.selected .opt-dial { color: var(--orange); }
.phone-code-option .opt-flag { width: 22px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,0.12); flex-shrink: 0; }
.phone-code-option .opt-dial { font-weight: 700; color: var(--text-dark); min-width: 46px; font-size: 13px; }
.phone-code-option .opt-name { color: var(--text-mid); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; }

.phone-input {
  box-sizing: border-box;
  flex: 1;
  border: none;
  background: var(--input-bg);
  padding: 0 12px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  color: var(--text-light);
  text-align: left;
  outline: none;
  transition: background .18s;
}
.phone-input::placeholder { color: var(--text-light); }

/* ── 9. Status Tabs ── */
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.tab {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: var(--input-bg);
  color: var(--text-mid);
  transition: all .18s;
  white-space: nowrap;
}
.tab:hover { background: #eee; }
.tab.active { background: var(--orange); color: #fff; border-color: var(--orange); }

/* ── 10. Search + Date Row ── */
.filter-row,
.search-row {
  display: flex;
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.search-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  right: 13px;
  color: var(--text-light);
  font-size: 14px;
  pointer-events: none;
}
.search-inp {
  width: 100%;
  height: 40px;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 0 38px 0 14px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  color: var(--text-dark);
  text-align: right;
  outline: none;
  transition: border-color .18s;
  direction: rtl;
}
.search-inp::placeholder { color: var(--text-light); }
.search-inp:focus { border-color: var(--orange); background: #fff; }

.date-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.date-icon {
  position: absolute;
  right: 10px;
  color: var(--text-light);
  font-size: 14px;
  pointer-events: none;
}
.date-inp {
  height: 40px;
  width: 160px;
  background: var(--input-bg);
  border: 1.5px solid transparent;
  border-radius: 6px;
  padding: 0 34px 0 10px;
  font-family: 'Cairo', sans-serif;
  font-size: 13px;
  color: var(--text-light);
  text-align: right;
  outline: none;
  transition: border-color .18s;
  direction: rtl;
  cursor: pointer;
}
.date-inp::placeholder { color: var(--text-light); }
.date-inp:focus { border-color: var(--orange); background: #fff; }

/* ── 11. Unified Status Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Order statuses */
.badge-submitted,  .badge-pending       { background: #f3f4f6; color: #6b7280; }
.badge-processing, .badge-on_hold       { background: #fef9c3; color: #854d0e; }
.badge-confirmed,  .badge-parsed        { background: #dbeafe; color: #1e40af; }
.badge-shipped                          { background: #e0e7ff; color: #3730a3; }
.badge-partial_shipped, .badge-delivery { background: #ede9fe; color: #5b21b6; }
.badge-delivered,  .badge-completed     { background: #dcfce7; color: #166534; }
.badge-cancelled,  .badge-failed        { background: #fee2e2; color: #991b1b; }
.badge-refunded                         { background: #fce7f3; color: #9d174d; }

/* Inquiry / smart sourcing statuses */
.badge-uploaded                         { background: #f3f4f6; color: #6b7280; }
.badge-ready                            { background: #e0e7ff; color: #3730a3; }
.badge-quoted                           { background: #f3e8ff; color: #6b21a8; }
.badge-analyzing,
.badge-matching_suppliers               { background: #fef9c3; color: #854d0e; }
.badge-pending_review                   { background: #fff7ed; color: #9a3412; }
.badge-generating_rfqs,
.badge-sending_to_suppliers             { background: #dbeafe; color: #1e40af; }
.badge-awaiting_responses               { background: #e0e7ff; color: #3730a3; }
.badge-comparing_offers,
.badge-pending_approval                 { background: #ede9fe; color: #5b21b6; }
.badge-approved                         { background: #d1fae5; color: #065f46; }

/* RFQ statuses */
.badge-draft                            { background: #f3f4f6; color: #6b7280; }
.badge-under_review                     { background: #fff7ed; color: #9a3412; }
.badge-closed                           { background: #fee2e2; color: #991b1b; }

/* Customized order statuses */
.badge-accepted                         { background: #f3e8ff; color: #6b21a8; }
.badge-rejected                         { background: #fee2e2; color: #991b1b; }

/* ── 12. Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 28px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  cursor: pointer;
  transition: background .18s, color .18s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: var(--orange);
  color: #fff;
}
.btn-primary:hover { background: var(--orange-hover); }

.btn-secondary {
  background: transparent;
  color: var(--orange);
  border: 1.5px solid var(--orange);
}
.btn-secondary:hover { background: var(--orange); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { background: var(--light-gray); }

.btn-danger {
  background: #fff;
  color: var(--red);
  border: 1.5px solid var(--red);
}
.btn-danger:hover { background: #fff5f5; }

/* ── 13. Alert / Flash Messages ── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 600;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.alert-success {
  background: #efe;
  border: 1px solid #cfc;
  color: #166534;
}
.alert-success svg { stroke: #166534; }

.alert-error {
  background: #fee;
  border: 1px solid #fcc;
  color: #991b1b;
}
.alert-error svg { stroke: #991b1b; }

.alert-warning {
  background: #fff7ed;
  border: 1px solid #fde68a;
  color: #854d0e;
}
.alert-warning svg { stroke: #854d0e; }

/* ── 14. Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.empty-state i {
  font-size: 40px;
  color: var(--text-lighter);
  margin-bottom: 14px;
}
.empty-state p {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 600;
}

/* ── 15. Avatar Block (settings page) ── */
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border);
  display: block;
}
.avatar-edit-btn {
  position: absolute;
  bottom: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-dark);
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
}
.avatar-edit-btn:hover { background: var(--orange); }
.avatar-edit-btn i { color: #fff; font-size: 10px; }

/* ── 16. Security List (settings page) ── */
.sec-items {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.sec-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
  background: var(--input-bg);
}
.sec-item:last-child { border-bottom: none; }
.sec-item:hover { background: #eeeded; }

.sec-item-label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dark);
}
.sec-item.danger .sec-item-label { color: var(--red); }
.sec-item.danger .sec-chevron { color: var(--red); }

.sec-chevron {
  color: var(--text-light);
  font-size: 12px;
}

/* ── 17. Responsive ── */
@media (max-width: 760px) {
  .profile-page {
    flex-direction: column;
    padding: 16px 16px 40px;
  }
  .profile-breadcrumb {
    padding: 14px 16px 0;
  }
  .sidebar { width: 100%; }
  .page-card-header { flex-direction: column; gap: 8px; }
}

@media (max-width: 500px) {
  .tabs { gap: 4px; }
  .tab { padding: 6px 10px; font-size: 12px; }
  .date-inp { width: 120px; }
}
