/* ── Reset & Base ── */
* { box-sizing: border-box; }

/* ══════════════════════════════
   MAIN SECTION — 2 Column Grid
══════════════════════════════ */
#main-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-top: 16px;
}

/* Copy Cards — full width top */
#main-section > section:nth-child(1) {
  grid-column: 1 / -1;
}

/* Detect & Test — same height side by side */
#main-section > section:nth-child(2),
#main-section > section:nth-child(3) {
  display: flex;
  flex-direction: column;
}

/* ── Section Cards ── */
#main-section > section {
  background: #ffffff;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
  padding: 20px !important;
  box-shadow: 0 2px 12px rgba(99,102,241,0.07) !important;
}

/* ══════════════════
   COPY CARD GRID
══════════════════ */
.ic-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.ic-card {
  background: #f8f9ff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

.ic-card:hover {
  box-shadow: 0 4px 18px rgba(99,102,241,0.13);
  border-color: #a5b4fc;
  transform: translateY(-2px);
}

.ic-card-top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.ic-badge {
  background: #ede9fe;
  color: #6d28d9;
  font-size: 0.70rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 0.04em;
  font-family: monospace;
}

.ic-card-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: #1e293b;
  margin-top: 2px;
}

.ic-card-use {
  font-size: 0.775rem;
  color: #64748b;
  flex: 1;
  line-height: 1.4;
}

.ic-copy-btn {
  margin-top: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 0;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: opacity 0.18s, transform 0.15s;
}

.ic-copy-btn:hover {
  opacity: 0.88;
  transform: scale(1.03);
}

.ic-copy-btn.copied {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

/* ══════════════════════
   SECTION HEADINGS
══════════════════════ */
.ic-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.ic-section-title .ic-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ══════════════════
   TEXTAREAS
══════════════════ */
.ic-textarea {
  width: 100%;
  resize: vertical;
  padding: 10px 12px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.9rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.18s;
  background: #ffffff;
  color: #1e293b;
  line-height: 1.6;
}

.ic-textarea:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.08);
}

.ic-textarea.readonly {
  background: #f8f9ff;
  color: #1e293b;
  cursor: default;
}

/* ══════════════════════
   DETECT & TEST EQUAL HEIGHT
══════════════════════ */
/* Detect section flex layout */
#main-section > section:nth-child(2) > textarea#ic-detect-input {
  flex: 1;
  min-height: 150px;
  resize: none;
}

/* Test box flex layout */
#main-section > section:nth-child(3) > textarea#ic-test-box {
  flex: 1;
  min-height: 150px;
  resize: none;
}

/* ══════════════════
   DETECT RESULT
══════════════════ */
.ic-detect-result {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.7;
  display: none;
}

.ic-detect-result.found {
  background: #fffbeb;
  color: #92400e;
  border: 1.5px solid #fde68a;
}

.ic-detect-result.clean {
  background: #f0fdf4;
  color: #166534;
  border: 1.5px solid #bbf7d0;
}

/* ══════════════════
   ACTION BUTTONS
══════════════════ */
.ic-btn-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.ic-action-btn {
  border: none;
  border-radius: 9px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.18s, transform 0.15s;
  color: #fff;
}

.ic-action-btn:hover {
  opacity: 0.88;
  transform: scale(1.03);
}

.ic-btn-detect     { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.ic-btn-remove     { background: linear-gradient(135deg, #ef4444, #dc2626); }
.ic-btn-copy-clean { background: linear-gradient(135deg, #22c55e, #16a34a); display: none; }

/* ══════════════════
   TEST BOX INFO
══════════════════ */
.ic-test-stats {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.ic-stat-chip {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.80rem;
  color: #475569;
  font-weight: 500;
  border: 1px solid #e2e8f0;
}

.ic-stat-chip strong {
  color: #6366f1;
}

/* ══════════════════════════════════════
   DARK MODE — only when .dark-mode class
   is on <body> (JS toggle থেকে)
══════════════════════════════════════ */
body.dark-mode #main-section > section {
  background: #0f172a !important;
  border-color: #1e293b !important;
}

body.dark-mode .ic-card {
  background: #1e1b4b;
  border-color: #312e81;
}

body.dark-mode .ic-card-name  { color: #e2e8f0; }
body.dark-mode .ic-card-use   { color: #94a3b8; }
body.dark-mode .ic-badge      { background: #312e81; color: #a5b4fc; }
body.dark-mode .ic-section-title { color: #e2e8f0; }

body.dark-mode .ic-textarea {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

body.dark-mode .ic-textarea.readonly {
  background: #0f172a;
  color: #e2e8f0;
}

body.dark-mode .ic-textarea:focus {
  border-color: #818cf8;
}

body.dark-mode .ic-detect-result.found {
  background: #422006;
  color: #fde68a;
  border-color: #78350f;
}

body.dark-mode .ic-detect-result.clean {
  background: #052e16;
  color: #86efac;
  border-color: #166534;
}

body.dark-mode .ic-stat-chip {
  background: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}

/* ══════════════════
   RESPONSIVE
══════════════════ */
@media (max-width: 900px) {
  .ic-card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 700px) {
  #main-section {
    grid-template-columns: 1fr;
  }

  #main-section > section:nth-child(1),
  #main-section > section:nth-child(2),
  #main-section > section:nth-child(3) {
    grid-column: 1 / -1;
  }

  .ic-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #main-section > section:nth-child(2) > textarea#ic-detect-input,
  #main-section > section:nth-child(3) > textarea#ic-test-box {
    min-height: 140px;
  }
}

@media (max-width: 400px) {
  .ic-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}