/* ========================================
   text-copy-1.css   コピーボタン
======================================== */

:root {
  --cp-primary: #2B7FE8;
  --cp-border:  #E5E9EF;
  --cp-radius:  8px;
}

/* ===== デモコンテナ上書き ===== */
.demo-container {
  flex-direction: column;
  align-items: stretch;
  padding: 24px;
  max-width: 600px;
}

/* ===== パターンブロック ===== */
.cp-pattern { margin-bottom: 28px; }
.cp-pattern:last-of-type { margin-bottom: 0; }

.cp-pattern-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: #2B7FE8;
  letter-spacing: 0.04em;
}

/* ===== Pattern 1: コードブロックコピー ===== */
.cp-code-wrapper {
  position: relative;
  background: #1E293B;
  border-radius: var(--cp-radius);
  overflow: hidden;
}

.cp-code-block {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
}

.cp-code-block code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: #E2E8F0;
  line-height: 1.8;
  white-space: pre;
}

.cp-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #94A3B8;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  font-size: 12px;
  font-family: sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.cp-copy-btn:hover { background: rgba(255, 255, 255, 0.22); color: #E2E8F0; }
.cp-copy-btn.cp-copied { background: rgba(34, 197, 94, 0.2); color: #86EFAC; border-color: rgba(34, 197, 94, 0.3); }

/* ===== Pattern 2: テキストエリアコピー ===== */
.cp-textarea-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 13px;
  font-family: sans-serif;
  color: #1A2332;
  background: #F8FAFC;
  border: 1.5px solid var(--cp-border);
  border-radius: var(--cp-radius);
  resize: vertical;
  min-height: 100px;
  line-height: 1.7;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.cp-textarea:focus {
  outline: none;
  border-color: var(--cp-primary);
  background: #fff;
}

.cp-textarea-copy {
  align-self: flex-end;
  padding: 8px 18px;
  background: var(--cp-primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  font-family: sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.cp-textarea-copy:hover { background: #1A6DD0; }
.cp-textarea-copy.cp-copied { background: #22C55E; }

/* ===== Pattern 3: インラインコピー ===== */
.cp-inline-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cp-inline-item {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--cp-border);
  border-radius: var(--cp-radius);
  overflow: hidden;
  background: #fff;
}

.cp-inline-label {
  padding: 0 12px;
  font-size: 11px;
  font-weight: 700;
  color: #5A6A7A;
  background: #F8FAFC;
  border-right: 1.5px solid var(--cp-border);
  display: flex;
  align-items: center;
  white-space: nowrap;
  min-height: 42px;
}

.cp-inline-text {
  flex: 1;
  padding: 10px 12px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  color: #1A2332;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.cp-inline-copy {
  padding: 0 14px;
  background: none;
  border: none;
  border-left: 1.5px solid var(--cp-border);
  font-size: 12px;
  font-family: sans-serif;
  color: #5A6A7A;
  cursor: pointer;
  min-width: 68px;
  min-height: 42px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.cp-inline-copy:hover { background: #F8FAFC; color: var(--cp-primary); }
.cp-inline-copy.cp-copied { color: #22C55E; background: #F0FDF4; }

/* ===== リセットボタン ===== */
.reset-btn {
  padding: 6px 16px;
  font-size: 13px;
  color: #5A6A7A;
  background: #fff;
  border: 1.5px solid #D0D7E0;
  border-radius: 6px;
  cursor: pointer;
  font-family: sans-serif;
  transition: background 0.15s, border-color 0.15s;
}

.reset-btn:hover {
  background: #F4F6F9;
  border-color: #9AA5B4;
}

.demo-controls { margin-top: 20px; text-align: right; }

/* ===== スマホ対応 ===== */
@media (max-width: 480px) {
  .cp-inline-label { font-size: 10px; padding: 0 8px; }
  .cp-inline-copy  { min-width: 56px; padding: 0 10px; }
}
