/* 
  Customer Pricing Portal Stylesheet
  Clean, High-Contrast, Practical & Responsive RTL Design
*/

:root {
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-light: #e0f2fe;
  --primary-dark: #075985;
  
  --success: #10b981;
  --success-light: #d1fae5;
  --success-dark: #065f46;

  --accent: #f59e0b;
  --accent-light: #fef3c7;

  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #f8fafc;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  direction: rtl;
  text-align: right;
  line-height: 1.6;
  min-height: 100vh;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.app-header {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 1rem 1.5rem;
  margin-top: 1rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-icon {
  background: var(--primary-light);
  color: var(--primary);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.brand h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.subtitle {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.header-left-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.linkedin-badge {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #0284c7;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-decoration: none;
  direction: ltr !important;
  unicode-bidi: isolate;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.linkedin-badge:hover {
  background: #e0f2fe;
  border-color: #7dd3fc;
  color: #0369a1;
  transform: translateY(-1px);
}

.user-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #334155;
}

.logout-btn {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s;
}

.logout-btn:hover {
  background: #fca5a5;
  color: #7f1d1d;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 1.25rem 0;
}

/* Search Card */
.search-card {
  position: relative;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  position: relative;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 0.35rem 0.85rem;
  transition: all 0.2s;
}

.search-icon {
  display: flex;
  align-items: center;
  color: var(--primary);
  margin-left: 0.65rem;
}

.main-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-main);
  background: transparent;
  padding: 0.5rem 0;
}

.main-search-input::placeholder {
  color: var(--text-subtle);
  font-weight: 400;
  font-size: 1rem;
}

.clear-input-btn {
  background: #f1f5f9;
  border: none;
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.clear-input-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Suggestions Dropdown */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 0.5rem;
}

.suggestion-item {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s;
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: var(--primary-light);
}

.suggestion-name {
  font-weight: 700;
  font-size: 1rem;
  color: #0f172a;
}

.suggestion-meta {
  display: flex;
  gap: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.suggestion-badge {
  background: #f1f5f9;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.85rem;
  color: #334155;
}

/* Selected Client Card (Clean Banner) */
.client-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
  border-right: 5px solid var(--primary);
}

.client-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.client-title-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.client-avatar {
  background: var(--primary-light);
  color: var(--primary);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}

.client-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
}

.client-branches {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: block;
}

/* Toolbar */
.client-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.inner-filter-wrap {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
}

.filter-icon {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.inner-filter-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.mode-toggles {
  display: flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.toggle-btn {
  border: none;
  background: transparent;
  padding: 0.45rem 1rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.toggle-btn.active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.35rem 0.75rem;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  color: #0f172a;
}

.btn-secondary {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Results & Placeholders */
.results-container {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  min-height: 280px;
}

.placeholder-state {
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 650px;
  margin: 0 auto;
}

.placeholder-icon {
  margin-bottom: 1rem;
}

.placeholder-state h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: #0f172a;
}

.placeholder-state p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.quick-pick-title {
  margin-top: 1.5rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-muted);
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.quick-tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}

.quick-tag:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
  border-color: var(--primary);
}

/* Loading */
.loading-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Table */
.table-wrapper {
  animation: fadeIn 0.2s ease-in-out;
}

.table-info-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.filter-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.modern-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid var(--border);
  text-align: right;
  font-size: 0.85rem;
}

.modern-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  color: #1e293b;
  vertical-align: middle;
}

.product-name-cell {
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
  white-space: normal;
  line-height: 1.45;
  min-width: 250px;
}

.nowrap {
  white-space: nowrap;
}

.doc-branch-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: flex-start;
}

.price-range-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  white-space: nowrap;
}

.price-avg {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.modern-table tbody tr:hover {
  background-color: #f8fafc;
}

.modern-table tbody tr:last-child td {
  border-bottom: none;
}

/* Price highlighting */
.price-pill {
  display: inline-block;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.price-sub {
  font-size: 0.82rem;
  color: #334155;
  font-weight: 600;
}

.doc-link {
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.82rem;
  display: inline-block;
}

.branch-tag {
  font-size: 0.78rem;
  background: #f1f5f9;
  color: #475569;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-block;
}

.history-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--primary);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
}

.history-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
}

.modal-close-btn {
  background: #f1f5f9;
  border: none;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: 1.25rem 0;
  font-size: 0.86rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.footer-separator {
  color: var(--border-strong);
}

.credit-link {
  color: #0077b5;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s;
}

.credit-link:hover {
  color: #005582;
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Print styles */
@media print {
  body {
    background: #ffffff;
  }
  .app-header, .search-card, .client-toolbar, .app-footer, .btn, .history-btn {
    display: none !important;
  }
  .client-card {
    border: 1px solid #000;
    box-shadow: none;
  }
  .results-container {
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .modern-table th, .modern-table td {
    border-bottom: 1px solid #000;
    color: #000;
  }
}

/* Mobile responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .client-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .mode-toggles {
    width: 100%;
  }
  .toggle-btn {
    flex: 1;
    justify-content: center;
  }
}

/* Login Modal */
.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 370px;
  padding: 1.75rem 2rem;
  border: 1px solid var(--border);
  animation: fadeIn 0.25s ease-in-out;
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-icon {
  background: var(--primary-light);
  color: var(--primary);
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.login-header h2 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.login-error {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.15rem;
  text-align: right;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 0.75rem;
  font-size: 1rem;
  margin-top: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.login-footer {
  margin-top: 1.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.login-credit-link {
  font-size: 0.76rem !important;
  padding: 0.15rem 0.55rem !important;
  color: var(--text-muted) !important;
  background: transparent !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-full) !important;
  opacity: 0.8;
  font-weight: 500 !important;
}

.login-credit-link:hover {
  opacity: 1;
  background: #f0f9ff !important;
  border-color: #bae6fd !important;
  color: #0284c7 !important;
}

.login-credit-link svg {
  width: 12px !important;
  height: 12px !important;
  color: #64748b !important;
}

.login-credit-link:hover svg {
  color: #0284c7 !important;
}



/* App Footer with LTR LinkedIn Credit */
.app-footer {
  margin-top: 3.5rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
}

.footer-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-title {
  direction: rtl;
}

.footer-separator {
  color: var(--border-strong);
  font-size: 0.85rem;
}

.credit-link {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  color: #0284c7 !important;
  text-decoration: none !important;
  font-weight: 600 !important;
  direction: ltr !important;
  unicode-bidi: isolate !important;
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  padding: 0.25rem 0.65rem !important;
  border-radius: var(--radius-full) !important;
  transition: all 0.15s ease !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.credit-link svg {
  flex-shrink: 0;
  color: #0284c7;
}

.credit-link:hover {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #7dd3fc !important;
  box-shadow: var(--shadow-sm) !important;
}

