/**
 * MazayaChat Channels Hub - Modern, Calm & Professional B2B Styles
 * Tokens: Navy #072032, Lime #ACE601, Line #E2E8F0, Pale #F8FAFC, White #FFFFFF
 */

.mz-channels-wrap {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  box-sizing: border-box;
  font-family: "Almarai", "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #072032;
  direction: rtl;
}

[dir="rtl"] .mz-channels-wrap {
  direction: rtl;
}

[dir="ltr"] .mz-channels-wrap {
  direction: ltr;
}

.mz-empty-banner {
  background: #FFFFFF;
  border: 1px dashed #CBD5E1;
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}

/* ─── Header ─── */
.mz-channels-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.mz-header-info h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #072032;
  margin: 0 0 6px 0;
  letter-spacing: -0.01em;
}

.mz-header-info p {
  font-size: 0.88rem;
  color: #64748B;
  margin: 0;
  line-height: 1.5;
}

.mz-btn-connect-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ACE601;
  color: #072032;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid rgba(7, 32, 50, 0.08);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 2px 6px rgba(172, 230, 1, 0.35);
  font-family: inherit;
  white-space: nowrap;
}

.mz-btn-connect-main:hover {
  background: #9bd600;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(172, 230, 1, 0.45);
}

/* ─── Summary Row ─── */
.mz-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

@media (max-width: 860px) {
  .mz-summary-row {
    grid-template-columns: 1fr;
  }
}

.mz-stat-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(7, 32, 50, 0.02);
  transition: border-color 0.2s ease;
}

.mz-stat-card:hover {
  border-color: #CBD5E1;
}

.mz-stat-content h3 {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748B;
  margin: 0 0 6px 0;
}

.mz-stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: #072032;
  line-height: 1.2;
}

.mz-stat-sub {
  font-size: 0.76rem;
  color: #94A3B8;
  margin-top: 4px;
}

.mz-stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mz-stat-icon-wrap.navy {
  background: rgba(7, 32, 50, 0.05);
  color: #072032;
}

.mz-stat-icon-wrap.green {
  background: #ECFDF5;
  color: #059669;
}

.mz-stat-icon-wrap.lime {
  background: rgba(172, 230, 1, 0.22);
  color: #072032;
}

/* ─── Channels Grid ─── */
.mz-channels-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

@media (max-width: 992px) {
  .mz-channels-grid {
    grid-template-columns: 1fr;
  }
}

/* ─── Card ─── */
.mz-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 1px 4px rgba(7, 32, 50, 0.03);
  display: flex;
  flex-direction: column;
  transition: all 0.2s ease;
}

.mz-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 4px 16px rgba(7, 32, 50, 0.06);
}

.mz-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #F1F5F9;
  margin-bottom: 16px;
}

.mz-card-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mz-card-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mz-card-title-group h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #072032;
  margin: 0 0 2px 0;
}

.mz-card-title-group span {
  font-size: 0.78rem;
  color: #64748B;
}

/* ─── Badges ─── */
.mz-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.mz-status-pill.connected {
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.mz-status-pill.disconnected {
  background: #F8FAFC;
  color: #64748B;
  border: 1px solid #E2E8F0;
}

.mz-status-pill.attention {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.mz-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.mz-status-pill.connected .mz-dot {
  background: #10B981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.mz-status-pill.disconnected .mz-dot {
  background: #94A3B8;
}

.mz-status-pill.attention .mz-dot {
  background: #F59E0B;
}

/* ─── Methods List Inside Card ─── */
.mz-methods-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.mz-method-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #F1F5F9;
  background: #F8FAFC;
  border-radius: 12px;
  transition: all 0.15s ease;
}

.mz-method-row:hover {
  background: #FFFFFF;
  border-color: #E2E8F0;
  box-shadow: 0 1px 4px rgba(7, 32, 50, 0.03);
}

.mz-method-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.mz-method-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mz-method-details {
  min-width: 0;
  flex: 1;
}

.mz-method-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #072032;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mz-method-sub {
  font-size: 0.74rem;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mz-method-sub .mz-count-tag {
  background: #E2E8F0;
  color: #072032;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.68rem;
}

.mz-method-sub .mz-count-tag.active {
  background: #DCFCE7;
  color: #166534;
}

.mz-method-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── Buttons ─── */
.mz-btn-action {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mz-btn-action.connect {
  background: #072032;
  color: #FFFFFF;
}

.mz-btn-action.connect:hover {
  background: #113650;
}

.mz-btn-action.manage {
  background: #FFFFFF;
  color: #072032;
  border-color: #CBD5E1;
}

.mz-btn-action.manage:hover {
  background: #F1F5F9;
  border-color: #94A3B8;
}

/* ─── Automation Footer Link Strip ─── */
.mz-card-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.mz-footer-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94A3B8;
}

.mz-footer-link {
  font-size: 0.74rem;
  font-weight: 600;
  color: #2563EB;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.mz-footer-link:hover {
  text-decoration: underline;
  color: #1D4ED8;
}

/* ─── Modals ─── */
.mz-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 32, 50, 0.45);
  backdrop-filter: blur(3px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  direction: rtl;
}

[dir="ltr"] .mz-modal-overlay {
  direction: ltr;
}

.mz-modal-card {
  background: #FFFFFF;
  width: 100%;
  max-width: 580px;
  border-radius: 18px;
  box-shadow: 0 20px 40px rgba(7, 32, 50, 0.18);
  border: 1px solid #E2E8F0;
  overflow: hidden;
  animation: mzFadeUp 0.18s ease-out;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

@keyframes mzFadeUp {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mz-modal-header {
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #F1F5F9;
}

.mz-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  color: #072032;
}

.mz-modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  color: #94A3B8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
}

.mz-modal-close-btn:hover {
  color: #072032;
  background: #F1F5F9;
}

.mz-modal-body {
  padding: 22px;
  overflow-y: auto;
}

/* Picker Grid inside Modal */
.mz-picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (max-width: 520px) {
  .mz-picker-grid {
    grid-template-columns: 1fr;
  }
}

.mz-picker-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.mz-picker-card:hover {
  background: #FFFFFF;
  border-color: #072032;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(7, 32, 50, 0.05);
}

.mz-picker-card h4 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #072032;
  margin: 0 0 2px 0;
}

.mz-picker-card p {
  font-size: 0.74rem;
  color: #64748B;
  margin: 0;
  line-height: 1.35;
}

/* IMAP Form Modal Styles */
.mz-form-group {
  margin-bottom: 14px;
}

.mz-form-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #072032;
  margin-bottom: 6px;
}

.mz-form-input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid #CBD5E1;
  font-size: 0.85rem;
  font-family: inherit;
  color: #072032;
  outline: none;
  transition: border-color 0.15s;
}

.mz-form-input:focus {
  border-color: #072032;
}

.mz-form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
}

.mz-fieldset {
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: #F8FAFC;
}

.mz-fieldset legend {
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  padding: 0 6px;
}

.mz-modal-footer {
  padding: 14px 22px;
  border-top: 1px solid #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #F8FAFC;
}

.mz-alert-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 14px;
  display: none;
}
