/* ============================================================
   ARQUIPA — Fase 5 Styles
   Payments · WebSockets · Push Notifications · Onboarding
   Advanced Settings · Activity Log · API Integrations
   ============================================================ */

/* ---- WEBSOCKET STATUS INDICATOR ---- */
.ws-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; flex-shrink: 0;
  transition: all var(--dur) var(--ease);
}
.ws-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  animation: wsPulse 2s ease-in-out infinite;
}
@keyframes wsPulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(.8)} }

.ws-connected    { background:var(--color-green-pale); color:var(--color-green); }
.ws-connected .ws-dot { background:var(--color-green); }
.ws-connecting   { background:rgba(212,160,23,0.1); color:var(--color-gold-dark); }
.ws-connecting .ws-dot { background:var(--color-gold); animation:wsPulse .8s ease-in-out infinite; }
.ws-disconnected { background:var(--color-danger-pale); color:var(--color-danger); }
.ws-disconnected .ws-dot { background:var(--color-danger); animation:none; }

/* ---- NOTIFICATIONS PANEL (full) ---- */
.notif-panel {
  position: fixed; top: var(--topbar-h); right: 0;
  width: 380px; max-height: calc(100vh - var(--topbar-h));
  background: var(--card-bg);
  border-left: 1px solid var(--border-color);
  box-shadow: -8px 0 32px rgba(27,42,74,0.1);
  display: flex; flex-direction: column;
  z-index: 250;
  transform: translateX(100%);
  transition: transform .3s var(--ease);
}
.notif-panel.open { transform: translateX(0); }

.notif-panel-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.notif-panel-header h4 { font-size: var(--font-size-h3); font-weight: 700; }
.notif-panel-actions { display: flex; gap: 6px; }

.notif-list { flex: 1; overflow-y: auto; }
.notif-list::-webkit-scrollbar { width: 3px; }
.notif-list::-webkit-scrollbar-thumb { background: var(--border-color); }

.notif-item {
  display: flex; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--gray-50);
  cursor: pointer; transition: background var(--dur) var(--ease);
  position: relative;
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(27,42,74,0.03); }
.notif-item.unread::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--color-navy);
  border-radius: 0 2px 2px 0;
}
.notif-item-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.notif-item-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ni-invoice  { background: rgba(27,42,74,0.1);  color: var(--color-navy); }
.ni-proposal { background: var(--color-purple-pale); color: var(--color-purple); }
.ni-match    { background: var(--color-green-pale);  color: var(--color-green); }
.ni-system   { background: var(--gray-100); color: var(--gray-600); }
.ni-payment  { background: rgba(212,160,23,0.12); color: var(--color-gold-dark); }

.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.notif-item-text  { font-size: 12px; color: var(--text-secondary); line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item-time  { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

.notif-panel-footer {
  padding: 14px 20px; border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* ---- PAYMENTS MODULE ---- */
.payment-methods-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-bottom: 24px;
}
.payment-card {
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px; cursor: pointer;
  transition: all var(--dur) var(--ease);
  position: relative;
}
.payment-card:hover    { border-color: var(--color-navy); box-shadow: var(--shadow-md); }
.payment-card.active   { border-color: var(--color-navy); background: rgba(27,42,74,0.03); }
.payment-card-logo     { height: 36px; margin-bottom: 12px; display: flex; align-items: center; }
.payment-card-logo svg { height: 28px; width: auto; }
.payment-card-name     { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.payment-card-desc     { font-size: 12px; color: var(--text-secondary); }
.payment-card-badge    { position: absolute; top: 12px; right: 12px; }
.payment-card-check    {
  position: absolute; top: 12px; right: 12px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-navy); color: #fff;
  display: none; align-items: center; justify-content: center; font-size: 11px;
}
.payment-card.active .payment-card-check { display: flex; }

/* Bank transfer details */
.bank-details-card {
  background: var(--gray-50);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 20px;
}
.bank-detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-color);
  font-size: 13px;
}
.bank-detail-row:last-child { border-bottom: none; }
.bank-detail-label { color: var(--text-muted); font-weight: 500; }
.bank-detail-value { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.copy-btn {
  width: 26px; height: 26px; border-radius: 6px;
  background: var(--card-bg); border: 1px solid var(--border-color);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); transition: all var(--dur) var(--ease);
}
.copy-btn:hover { background: var(--color-navy); color: #fff; border-color: var(--color-navy); }
.copy-btn svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Payment history */
.payment-tx-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--gray-50);
}
.payment-tx-item:last-child { border-bottom: none; }
.tx-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.tx-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tx-in  { background: var(--color-green-pale);  color: var(--color-green); }
.tx-out { background: var(--color-danger-pale);  color: var(--color-danger); }
.tx-info { flex: 1; }
.tx-desc { font-size: 13px; font-weight: 600; }
.tx-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tx-amount { font-size: 16px; font-weight: 800; }
.tx-amount.credit { color: var(--color-green); }
.tx-amount.debit  { color: var(--color-danger); }

/* ---- ACTIVITY LOG ---- */
.activity-timeline { display: flex; flex-direction: column; }
.activity-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--gray-50); position: relative;
}
.activity-item:last-child { border-bottom: none; }
.activity-item::before {
  content: '';
  position: absolute; left: 17px; top: 50px; bottom: -14px;
  width: 1px; background: var(--border-color);
}
.activity-item:last-child::before { display: none; }
.activity-dot {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; position: relative; z-index: 1;
}
.activity-dot svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act-create  { background: var(--color-green-pale);  color: var(--color-green); }
.act-update  { background: var(--color-info-pale);   color: var(--color-info); }
.act-delete  { background: var(--color-danger-pale); color: var(--color-danger); }
.act-login   { background: rgba(27,42,74,0.1);       color: var(--color-navy); }
.act-approve { background: var(--color-green-pale);  color: var(--color-green); }
.act-payment { background: rgba(212,160,23,0.12);    color: var(--color-gold-dark); }
.activity-body  { flex: 1; }
.activity-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.activity-meta  { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; }

/* ---- ONBOARDING WIZARD ---- */
.onboarding-overlay {
  position: fixed; inset: 0;
  background: rgba(15,20,35,0.6);
  backdrop-filter: blur(6px);
  z-index: 600;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.onboarding-overlay.show { display: flex; }

.onboarding-card {
  background: var(--card-bg);
  border-radius: var(--radius-xl);
  width: 100%; max-width: 560px;
  box-shadow: 0 32px 80px rgba(15,20,35,0.25);
  overflow: hidden;
  animation: slideModal .3s var(--ease);
}
.onboarding-header {
  background: linear-gradient(135deg, var(--color-navy), var(--color-navy-light));
  padding: 28px 32px 24px;
}
.onboarding-step-indicator {
  display: flex; gap: 6px; margin-bottom: 20px;
}
.ob-step-dot {
  height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.25); flex: 1;
  transition: background .3s ease;
}
.ob-step-dot.done   { background: var(--color-gold-light); }
.ob-step-dot.active { background: #fff; }
.onboarding-header h3 { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.onboarding-header p  { font-size: 13px; color: rgba(255,255,255,0.65); line-height: 1.6; }
.onboarding-body    { padding: 28px 32px; }
.onboarding-footer  {
  padding: 16px 32px;
  border-top: 1px solid var(--border-color);
  display: flex; align-items: center; justify-content: space-between;
}

.ob-feature-list { display: flex; flex-direction: column; gap: 12px; }
.ob-feature {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; background: var(--gray-50);
  border-radius: var(--radius-md); border: 1px solid var(--border-color);
}
.ob-feature-icon {
  width: 36px; height: 36px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ob-feature-icon svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ob-feature-text h5 { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.ob-feature-text p  { font-size: 11px; color: var(--text-secondary); line-height: 1.5; }

/* ---- API INTEGRATIONS ---- */
.integrations-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.integration-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: all var(--dur) var(--ease);
}
.integration-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.integration-top {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px;
}
.integration-logo {
  width: 44px; height: 44px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; flex-shrink: 0;
}
.integration-name  { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.integration-desc  { font-size: 12px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.5; }
.integration-field {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px; font-size: 12px;
  color: var(--text-muted); font-family: monospace;
  margin-bottom: 10px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* ---- TOGGLE SWITCH ---- */
.toggle-switch {
  position: relative; width: 42px; height: 24px;
  display: inline-block; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--gray-200); border-radius: 12px;
  cursor: pointer; transition: background .2s ease;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  transition: transform .2s ease;
}
.toggle-switch input:checked ~ .toggle-track { background: var(--color-navy); }
.toggle-switch input:checked ~ .toggle-track .toggle-thumb { transform: translateX(18px); }

/* ---- LIVE CHAT WIDGET (floating) ---- */
.live-chat-fab {
  position: fixed; bottom: 90px; right: 20px;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--color-navy);
  box-shadow: 0 6px 24px rgba(27,42,74,0.35);
  display: none; align-items: center; justify-content: center;
  cursor: pointer; z-index: 290;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
  border: none;
}
.live-chat-fab:hover { transform: scale(1.08); background: var(--color-navy-light); }
.live-chat-fab svg { width: 22px; height: 22px; stroke: #fff; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.live-chat-fab .fab-badge {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--color-danger); color: #fff;
  font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--card-bg);
}
@media (max-width: 768px) { .live-chat-fab { display: flex; } }

/* ---- PAYMENT GATEWAY MODAL ---- */
.payment-gateway-form { max-width: 420px; margin: 0 auto; }
.payment-amount-display {
  text-align: center; padding: 24px;
  background: linear-gradient(135deg, var(--color-navy), var(--color-navy-light));
  border-radius: var(--radius-lg); margin-bottom: 24px; color: #fff;
}
.payment-amount-display .amt { font-size: 40px; font-weight: 800; line-height: 1; }
.payment-amount-display .doc { font-size: 12px; color: rgba(255,255,255,0.6); margin-top: 6px; }

.card-input-group {
  background: var(--gray-50);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 12px;
}
.card-input-group .form-control {
  border: none; background: transparent; border-radius: 0;
  border-bottom: 1px solid var(--border-color);
}
.card-input-group .form-control:last-child { border-bottom: none; }
.card-input-row { display: grid; grid-template-columns: 1fr 1fr; }
.card-input-row .form-control { border-right: 1px solid var(--border-color); }
.card-input-row .form-control:last-child { border-right: none; }

.secure-badge {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  font-size: 11px; color: var(--text-muted); margin-top: 12px;
}
.secure-badge svg { width: 13px; height: 13px; stroke: var(--color-green); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .notif-panel { width: 100%; }
  .payment-methods-grid { grid-template-columns: 1fr 1fr; }
  .integrations-grid    { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .payment-methods-grid { grid-template-columns: 1fr; }
  .onboarding-header { padding: 20px; }
  .onboarding-body   { padding: 20px; }
  .onboarding-footer { padding: 14px 20px; }
}

/* Dark theme overrides for fase5 components */
[data-theme="dark"] .notif-panel     { background: var(--card-bg,#161B27); border-color: var(--border-color); }
[data-theme="dark"] .notif-item      { border-color: var(--border-color); }
[data-theme="dark"] .notif-item:hover { background: rgba(255,255,255,.04); }
[data-theme="dark"] .notif-item-title { color: var(--text-primary); }
[data-theme="dark"] .notif-item-text  { color: var(--text-secondary); }
[data-theme="dark"] .payment-card     { background: var(--card-bg,#161B27); border-color: var(--border-color); }
[data-theme="dark"] .onboarding-overlay { background: rgba(0,0,0,.9); }
[data-theme="dark"] .onboarding-card  { background: var(--card-bg,#161B27); }
[data-theme="dark"] .ob-step-dot      { background: rgba(255,255,255,.2); }
[data-theme="dark"] .ob-step-dot.active { background: var(--color-gold); }
[data-theme="dark"] .act-row          { border-color: var(--border-color); }
[data-theme="dark"] .act-row:hover    { background: rgba(255,255,255,.03); }
[data-theme="dark"] .act-detail       { color: var(--text-secondary); }
[data-theme="dark"] .intg-card        { background: var(--card-bg,#161B27); border-color: var(--border-color); }
[data-theme="dark"] .intg-name        { color: var(--text-primary); }
[data-theme="dark"] .toggle-thumb     { background: #fff; }
