/* ==========================================================================
   WhatsApp Channel Cards - Compact Responsive Layout (GenResurs 2026)
   ========================================================================== */

/* Container queries root */
:has(> #accountsGrid),
#tab-account,
#test-shell {
  container-type: inline-size;
}

#accountsGrid {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px;
  align-items: start !important;
  width: 100%;
}

@container (min-width: 900px) {
  #accountsGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px;
  }
}

@supports not (container-type: inline-size) {
  @media (min-width: 1280px) {
    #accountsGrid {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 18px;
    }
  }
}

#accountsGrid > .gold-major-block {
  height: auto !important;
  display: flex;
  flex-direction: column;
}

#accountsGrid .premium-account {
  flex: 0 1 auto !important;
  display: flex;
  flex-direction: column;
  justify-content: flex-start !important;
  height: auto !important;
  padding: 14px 15px !important;
  gap: 8px !important;
  box-sizing: border-box;
  background: radial-gradient(ellipse at 10% 0%, rgba(255, 255, 255, 0.05), transparent 55%), linear-gradient(135deg, #18191f, #0d0f14 70%);
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  border-radius: 14px;
}

/* Thin Elegant Divider */
.card-compact-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.25), rgba(255, 255, 255, 0.08) 50%, rgba(212, 175, 55, 0.25));
  margin: 1px 0;
  flex-shrink: 0;
}

/* ==========================================================================
   Section 1: Compact Header (Account Name, Phone, Status, Profile)
   ========================================================================== */

.compact-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding-left: 0;
  box-sizing: border-box;
}

.compact-card-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0 36px;
  box-sizing: border-box;
  text-align: center;
}

.compact-card-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
  overflow-wrap: break-word;
  word-break: break-word;
  min-width: 0;
  text-align: center;
}

.compact-card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0;
  box-sizing: border-box;
  flex-wrap: wrap;
}

@container (min-width: 380px) {
  .compact-card-topbar {
    flex-wrap: nowrap !important;
  }
}

@media (min-width: 500px) {
  .compact-card-topbar {
    flex-wrap: nowrap !important;
  }
}

.compact-header-main {
  display: flex;
  align-items: center;
  gap: 6px 14px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-left: 0;
  box-sizing: border-box;
  flex-wrap: wrap;
}

@container (min-width: 380px) {
  .compact-header-main {
    flex-wrap: nowrap !important;
  }
}

@media (min-width: 500px) {
  .compact-header-main {
    flex-wrap: nowrap !important;
  }
}

.account-rename-button {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid rgba(217, 199, 140, 0.3);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: #dfd9c7;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.account-rename-button:hover {
  background: rgba(244, 217, 34, 0.2);
  color: #ffe735;
}

.compact-header-phone-row {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex: 0 0 auto !important;
  width: auto !important;
  font-size: 13.5px;
  line-height: 1.35;
  min-width: 0;
  box-sizing: border-box;
}

.compact-header-phone-row span {
  max-width: 100%;
  box-sizing: border-box;
}

.compact-photo {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #202c33;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.compact-profile-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: #c9d1d9;
  min-width: 0;
  flex: 0 1 auto;
  flex-wrap: nowrap;
}

@container (max-width: 379px) {
  .compact-profile-row {
    flex-wrap: wrap;
  }
}

.compact-row-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex-shrink: 0;
}

.compact-row-icon.icon-wa {
  background: rgba(37, 211, 102, 0.15);
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: #25D366;
}

.compact-row-label {
  font-size: 14px;
  font-weight: 500;
  color: #8696a0;
  white-space: nowrap;
}

.channel-profile-value {
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  min-width: 0;
  flex: 1 1 auto;
}

.compact-owner-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: #b9b6be;
  min-width: 0;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.compact-header-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex-shrink: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/* ==========================================================================
   Section 2: Telephony & Device States (Compact)
   ========================================================================== */

.compact-telephony-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  min-width: 0;
}

.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.compact-sip-row {
  padding: 1px 0;
}

.compact-sip-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.compact-row-icon.icon-sip {
  background: rgba(244, 217, 34, 0.15);
  border: 1px solid rgba(244, 217, 34, 0.35);
  color: #f4d922;
}

.channel-sip-text {
  font-size: 14px;
  color: #c9d1d9;
  font-weight: 500;
  white-space: normal;
}

.channel-sip-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  color: #ffe735;
  margin-left: 3px;
  letter-spacing: 0.5px;
}

.compact-route-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}

.channel-call-route {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  flex-wrap: wrap;
  white-space: normal;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.channel-call-route.route-external {
  background: rgba(23, 37, 84, 0.7);
  border: 1px solid rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}

.channel-call-route.route-browser {
  background: rgba(59, 7, 100, 0.7);
  border: 1px solid rgba(168, 85, 247, 0.5);
  color: #e9d5ff;
}

.channel-call-route.route-none {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(100, 116, 139, 0.4);
  color: #94a3b8;
}

/* Device rows */
.channel-device-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  flex-wrap: wrap;
  padding: 2px 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.compact-device-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  flex: 0 1 auto;
  cursor: default;
}

.compact-row-icon.icon-external {
  background: rgba(30, 58, 138, 0.45);
  border: 1px solid rgba(59, 130, 246, 0.45);
  color: #60a5fa;
}

.compact-row-icon.icon-browser {
  background: rgba(88, 28, 135, 0.45);
  border: 1px solid rgba(168, 85, 247, 0.45);
  color: #c084fc;
}

.channel-device-title {
  font-size: 14px;
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
}

/* Badge (CARD-01 preserved) */
.channel-device-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  box-sizing: border-box;
  flex: 0 1 auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid transparent;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}

.channel-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.channel-badge-text {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  min-width: 0;
  flex: 1 1 auto;
}

/* Status variants */
.channel-status-registered {
  color: #34d399;
  background: rgba(6, 78, 59, 0.45);
  border-color: rgba(16, 185, 129, 0.5);
}
.channel-dot-registered {
  background-color: #10b981;
}

.channel-status-unregistered {
  color: #94a3b8;
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(71, 85, 105, 0.45);
}
.channel-dot-unregistered {
  background-color: #64748b;
}

.channel-status-unverified {
  color: #6ee7b7;
  background: rgba(6, 78, 59, 0.35);
  border-color: rgba(52, 211, 153, 0.4);
}
.channel-dot-unverified {
  background-color: #34d399;
}

.channel-status-unknown {
  color: #fde047;
  background: rgba(113, 63, 18, 0.35);
  border-color: rgba(234, 179, 8, 0.45);
}
.channel-dot-unknown {
  background-color: #eab308;
}

.channel-status-unreachable {
  color: #fca5a5;
  background: rgba(136, 19, 55, 0.4);
  border-color: rgba(244, 63, 94, 0.45);
}
.channel-dot-unreachable {
  background-color: #f43f5e;
}

/* ==========================================================================
   Section 3: Contacts (Compact)
   ========================================================================== */

.compact-contacts-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.compact-contacts-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  cursor: pointer;
  min-width: 0;
}

.compact-contacts-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.compact-contacts-title {
  font-size: 14px;
  font-weight: 700;
  color: #f6f6f8;
  line-height: 1.3;
}

.compact-contacts-desc {
  font-size: 14px;
  color: #8696a0;
  line-height: 1.3;
  margin: 0;
}

.compact-checkbox {
  appearance: none;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1px solid rgba(86, 126, 150, 0.6);
  background: #111b21;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.compact-checkbox:checked {
  background: #10ac91;
  border-color: #76ecda;
}
.compact-checkbox:checked:after {
  content: '✓';
  display: block;
  color: white;
  text-align: center;
  font-size: 14px;
  line-height: 1;
}

.compact-contact-result {
  font-size: 12px;
  color: #a5acc2;
}

/* ==========================================================================
   Section 4: PBX Button & Actions (Compact)
   ========================================================================== */

.compact-footer-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  min-width: 0;
}

.compact-pbx-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  color: #e6f9ff;
  background: linear-gradient(135deg, rgba(9, 44, 76, 0.7), rgba(4, 25, 45, 0.85));
  border: 1px solid rgba(0, 186, 204, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
.compact-pbx-button:hover {
  filter: brightness(1.15);
  box-shadow: 0 0 14px rgba(0, 186, 204, 0.3);
}

.compact-button-arrow {
  margin-left: auto;
  font-size: 12px;
  color: #53dfff;
}

.compact-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding-right: 36px; /* avoid bottom-right corner chamfer */
}

.compact-action-btn {
  flex: 1 1 auto;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(104, 102, 117, 0.4);
  background: linear-gradient(135deg, #1f1f28, #15151c);
  color: #f1eff8;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.compact-action-btn:hover {
  filter: brightness(1.2);
  border-color: #b8b1c7;
}

.compact-action-btn.action-qr {
  color: #ffe448;
  background: linear-gradient(130deg, rgba(101, 82, 22, 0.6), #36301a);
  border-color: #bca335;
}

.compact-action-btn.action-delete {
  flex: 0 0 34px;
  padding: 6px;
  color: #e8a3b1;
  background: linear-gradient(140deg, #492c37, #231b27);
  border-color: rgba(132, 82, 99, 0.5);
}
