/**
 * CLAADSS Captcha — Dual-Mode Security Verification Styling
 * Supports Alphanumeric Code + Visual Image Matching
 * Designed for Claadss Modern & King Theme
 */

.claadss-captcha-card {
  display: block;
  width: 100%;
  margin: 16px 0 20px 0;
  padding: 14px 16px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #F8FAFC;
  transition: all 0.25s ease;
}

.claadss-captcha-card:hover {
  border-color: rgba(56, 189, 248, 0.3);
}

/* Light theme overrides */
body:not(.king-night) .claadss-captcha-card {
  background: #F8FAFC;
  border-color: #E2E8F0;
  color: #0F172A;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* Header bar & Mode switcher */
.claadss-c-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body:not(.king-night) .claadss-c-header {
  border-bottom-color: #E2E8F0;
}

.claadss-c-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #38BDF8;
}

.claadss-c-badge-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: #38BDF8;
}

/* Segmented mode pills */
.claadss-c-nav-pills {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px;
  border-radius: 8px;
  gap: 4px;
}

body:not(.king-night) .claadss-c-nav-pills {
  background: #E2E8F0;
}

.claadss-c-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  background: transparent;
  color: #94A3B8;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.claadss-c-tab:hover {
  color: #FFF;
}

body:not(.king-night) .claadss-c-tab:hover {
  color: #0F172A;
}

.claadss-c-tab.active {
  background: #38BDF8;
  color: #0F172A;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.35);
}

/* Panels (show/hide) */
.claadss-c-panel {
  display: none;
  animation: claadssFadeIn 0.25s ease forwards;
}

.claadss-c-panel.active {
  display: block;
}

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

/* MODE 1: Alphanumeric Code styling */
.claadss-c-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.claadss-c-code-display {
  flex: 1;
  display: flex;
  align-items: center;
  background: rgba(2, 6, 23, 0.7);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

body:not(.king-night) .claadss-c-code-display {
  background: #0F172A;
}

.claadss-captcha-svg {
  width: 100%;
  max-width: 220px;
  height: 48px;
  display: block;
}

.claadss-c-code-tools {
  display: flex;
  gap: 6px;
}

.claadss-c-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.claadss-c-tool-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38BDF8;
  color: #38BDF8;
  transform: rotate(15deg);
}

body:not(.king-night) .claadss-c-tool-btn {
  background: #E2E8F0;
  border-color: #CBD5E1;
  color: #475569;
}

body:not(.king-night) .claadss-c-tool-btn:hover {
  background: #38BDF8;
  color: #0F172A;
}

.claadss-c-tool-btn.rotating svg {
  animation: claadssSpin 0.6s linear;
}

@keyframes claadssSpin {
  100% { transform: rotate(360deg); }
}

.claadss-c-input-wrap input.claadss-c-text-input {
  width: 100%;
  height: 42px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #FFF;
  font-size: 0.95rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
  box-sizing: border-box;
  outline: none;
  transition: all 0.2s ease;
}

.claadss-c-input-wrap input.claadss-c-text-input:focus {
  border-color: #38BDF8;
  background: rgba(56, 189, 248, 0.05);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

body:not(.king-night) .claadss-c-input-wrap input.claadss-c-text-input {
  background: #FFFFFF;
  border-color: #CBD5E1;
  color: #0F172A;
}

body:not(.king-night) .claadss-c-input-wrap input.claadss-c-text-input:focus {
  border-color: #0284C7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}

/* MODE 2: Visual Image Matching styling */
.claadss-c-image-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

body:not(.king-night) .claadss-c-image-prompt {
  background: #F1F5F9;
  border-color: #CBD5E1;
}

.claadss-c-prompt-text {
  font-size: 0.82rem;
  color: #94A3B8;
  flex: 1;
}

body:not(.king-night) .claadss-c-prompt-text {
  color: #475569;
}

.claadss-c-target-name {
  color: #38BDF8;
  font-weight: 800;
  text-transform: capitalize;
  display: inline-block;
  margin-left: 4px;
}

body:not(.king-night) .claadss-c-target-name {
  color: #0284C7;
}

.claadss-c-target-preview {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 5px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #38BDF8;
  box-sizing: border-box;
}

.claadss-c-target-preview svg {
  width: 100%;
  height: 100%;
}

/* 5-Tile Grid */
.claadss-c-tiles-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.claadss-c-tile {
  position: relative;
  aspect-ratio: 1;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1.5px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  box-sizing: border-box;
}

body:not(.king-night) .claadss-c-tile {
  background: #FFFFFF;
  border-color: #E2E8F0;
  color: #475569;
}

.claadss-c-tile svg {
  width: 24px;
  height: 24px;
  transition: transform 0.2s ease;
}

.claadss-c-tile:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(56, 189, 248, 0.4);
  color: #FFF;
  transform: translateY(-2px);
}

body:not(.king-night) .claadss-c-tile:hover {
  background: #F8FAFC;
  border-color: #38BDF8;
  color: #0F172A;
}

.claadss-c-tile:hover svg {
  transform: scale(1.1);
}

.claadss-c-tile.selected {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38BDF8;
  color: #38BDF8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
  transform: scale(1.04);
}

body:not(.king-night) .claadss-c-tile.selected {
  background: #E0F2FE;
  border-color: #0284C7;
  color: #0284C7;
}

.claadss-c-tile-check {
  display: none;
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #10B981;
  color: #FFF;
  font-size: 11px;
  font-weight: 900;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

.claadss-c-tile.selected .claadss-c-tile-check {
  display: flex;
  animation: claadssPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes claadssPop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Verified badge state */
.claadss-c-verified-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.76rem;
  color: #94A3B8;
  padding: 4px 6px;
}

.claadss-c-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748B;
  transition: all 0.2s ease;
}

.claadss-c-verified-badge.is-verified {
  color: #34D399;
}

.claadss-c-verified-badge.is-verified .claadss-c-badge-dot {
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

/* Error message display */
.claadss-captcha-error {
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #EF4444;
}

/* Responsive */
@media (max-width: 480px) {
  .claadss-c-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .claadss-c-nav-pills {
    width: 100%;
    justify-content: stretch;
  }
  .claadss-c-tab {
    flex: 1;
    justify-content: center;
  }
  .claadss-c-tiles-grid {
    gap: 6px;
  }
}
