/* ============================================
   COLOR CONVERTER — Modern Art Layout
   ============================================ */

.cc-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 24px 80px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1a1a1a;
}

/* ---------- HERO ---------- */
.cc-hero {
  text-align: center;
  margin-bottom: 48px;
}

.cc-hero__title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 12px;
  color: #0d0d0d;
}

.cc-hero__title span {
  background: linear-gradient(135deg, #ff5102, #ff8c42);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.cc-hero__sub {
  font-size: 16px;
  color: #666;
  max-width: 520px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---------- INPUT ZONE ---------- */
.cc-input-zone {
  max-width: 720px;
  margin: 0 auto 56px;
}

.cc-input-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  align-items: stretch;
}

/* Input wrap */
.cc-input-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border: 2px solid #ececec;
  border-radius: 16px;
  padding: 4px 4px 4px 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.cc-input-wrap:focus-within {
  border-color: #ff5102;
  box-shadow: 0 8px 32px rgba(255, 81, 2, 0.12);
}

.cc-input-hash {
  font-size: 28px;
  font-weight: 800;
  color: #ff5102;
  margin-right: 4px;
  user-select: none;
}

.cc-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #1a1a1a;
  background: transparent;
  padding: 16px 16px 16px 0;
  min-width: 0;
  width: 100%;
}

.cc-input::placeholder {
  color: #ccc;
}

/* Color picker */
.cc-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 20px;
  border-radius: 16px;
  background: #1a1a1a;
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  overflow: hidden;
  user-select: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.cc-picker:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
}

.cc-picker:active {
  transform: translateY(0);
}

.cc-picker__swatch {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: #cdba88;
  flex-shrink: 0;
  transition: background 0.3s ease;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

.cc-picker__label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.cc-picker input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  border: none;
  padding: 0;
}

/* Error */
.cc-error {
  margin-top: 12px;
  padding: 10px 16px;
  background: #fff2f0;
  border-left: 3px solid #ff4d4f;
  color: #cf1322;
  font-size: 14px;
  border-radius: 6px;
}

/* ---------- RESULT ZONE ---------- */
.cc-result {
  animation: cc-fade-in 0.4s ease;
}

@keyframes cc-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.cc-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.2fr);
  gap: 40px;
  align-items: start;
}

/* Color block */
.cc-block {
  aspect-ratio: 1 / 1;
  border-radius: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.cc-block:hover {
  transform: translateY(-4px);
}

.cc-block__hex {
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: 2px;
  align-self: flex-start;
}

.cc-block__rgb {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.85;
  letter-spacing: 0.5px;
  align-self: flex-start;
}

.cc-block__tag {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

/* Stats panel */
.cc-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cc-stat {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 12px;
  background: #fafafa;
  border: 1px solid #f0f0f0;
  transition: background 0.2s, border-color 0.2s;
  cursor: pointer;
}

.cc-stat:hover {
  background: #fff;
  border-color: #ff5102;
}

.cc-stat__label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #999;
}

.cc-stat__value {
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.5px;
  word-break: break-all;
}

.cc-stat__copy {
  opacity: 0;
  font-size: 12px;
  color: #ff5102;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.cc-stat:hover .cc-stat__copy {
  opacity: 1;
}

.cc-stat--copied .cc-stat__copy {
  opacity: 1;
  color: #10b981;
}

/* ---------- ACTION BUTTONS ---------- */
.cc-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.cc-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  font-family: inherit;
}

.cc-btn--print {
  background: #1a1a1a;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.cc-btn--print:hover {
  background: #ff5102;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255, 81, 2, 0.28);
}

.cc-btn--print:active {
  transform: translateY(0);
}

.cc-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ============================================
   METHOD — Smart art layout
   ============================================ */

.cc-method {
  margin-top: 40px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s;
}

.cc-method:hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

/* ---------- Summary ---------- */
.cc-method__summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  transition: background 0.2s;
}

.cc-method__summary::-webkit-details-marker { display: none; }

.cc-method__summary:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.cc-method__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff5102, #ff8c42);
  color: #fff;
  flex-shrink: 0;
}

.cc-method__label {
  flex: 1;
}

.cc-method__hint {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #94a3b8;
  background: #fff;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid #e2e8f0;
  text-transform: uppercase;
}

.cc-method__chevron {
  font-size: 10px;
  color: #94a3b8;
  transition: transform 0.25s ease;
}

details[open] .cc-method__chevron {
  transform: rotate(180deg);
}

.cc-method__body {
  padding: 28px 24px 24px;
  border-top: 1px solid #f1f5f9;
}

/* ============================================
   FLOW DIAGRAM
   ============================================ */

.cc-flow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 16px;
  background: #f8fafc;
  border-radius: 14px;
  margin-bottom: 28px;
}

.cc-flow__node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  border: 2px solid #e2e8f0;
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  transition: all 0.2s;
}

.cc-flow__node:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.cc-flow__node--start {
  background: #1e293b;
  color: #fff;
  border-color: #1e293b;
}

.cc-flow__node--end {
  background: linear-gradient(135deg, #ff5102, #ff8c42);
  color: #fff;
  border-color: #ff5102;
}

.cc-flow__node--leaf {
  padding: 8px 14px;
  font-size: 12px;
}

.cc-flow__node--warn {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #92400e;
}

.cc-flow__arrow {
  color: #cbd5e1;
  font-size: 16px;
  font-weight: 800;
}

.cc-flow__branch {
  display: inline-flex;
  gap: 6px;
  padding: 6px;
  background: #fff;
  border: 2px dashed #e2e8f0;
  border-radius: 12px;
}

/* ============================================
   STEP CARDS
   ============================================ */

.cc-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.cc-step {
  display: flex;
  gap: 14px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  transition: all 0.2s;
}

.cc-step:hover {
  border-color: #ff5102;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 81, 2, 0.08);
}

.cc-step--warn {
  background: #fffbeb;
  border-color: #fde68a;
}

.cc-step--warn:hover {
  border-color: #f59e0b;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.12);
}

.cc-step--end {
  background: linear-gradient(135deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
}

.cc-step__num {
  font-family: 'SF Mono', 'Monaco', monospace;
  font-size: 11px;
  font-weight: 800;
  color: #94a3b8;
  background: #f1f5f9;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.cc-step--end .cc-step__num {
  background: #ff5102;
  color: #fff;
}

.cc-step__content {
  flex: 1;
  min-width: 0;
}

.cc-step__title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cc-step__spec {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
  margin-bottom: 2px;
}

.cc-step__note {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

/* ============================================
   BADGE
   ============================================ */

.cc-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.cc-badge--warn {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.cc-badge--info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* ============================================
   PROS & CONS
   ============================================ */

.cc-proscons {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 16px;
}

.cc-proscons__col {
  padding: 20px 22px;
  border-radius: 16px;
  font-size: 13px;
}

.cc-proscons__col--good {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
}

.cc-proscons__col--bad {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1px solid #fed7aa;
}

.cc-proscons__header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.cc-proscons__col--good .cc-proscons__header { color: #15803d; }
.cc-proscons__col--bad .cc-proscons__header { color: #c2410c; }

.cc-proscons__col ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cc-proscons__col li {
  position: relative;
  padding-left: 22px;
  margin-bottom: 8px;
  color: #334155;
  line-height: 1.6;
}

.cc-proscons__col li:last-child {
  margin-bottom: 0;
}

.cc-proscons__col li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.cc-proscons__col--good li::before { background: #22c55e; }
.cc-proscons__col--bad li::before { background: #f97316; }

.cc-proscons__col strong {
  color: #0f172a;
  font-weight: 700;
}

/* Biến thể single column cho pros/cons */
.cc-proscons--single {
  grid-template-columns: 1fr;
}

.cc-proscons__col--full {
  width: 100%;
}

/* ============================================
   WARNINGS — kế thừa style từ .cc-method
   ============================================ */

.cc-warnings {
  margin-top: 16px;
}

/* Icon của warnings: đổi gradient sang vàng-cam */
.cc-method__icon--warn {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

/* Summary hover của warnings: sang tông vàng nhạt */
.cc-warnings__summary:hover {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%) !important;
}

/* Step card trong warnings: chữ note dài hơn, cho phép xuống dòng */
.cc-warnings .cc-step__note {
  font-style: normal;
  color: #64748b;
  line-height: 1.55;
  margin-top: 4px;
}

.cc-warnings .cc-step__note code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  color: #475569;
  font-family: 'SF Mono', 'Monaco', monospace;
}

.cc-warnings .cc-step__note strong {
  color: #0f172a;
  font-weight: 700;
}

/* ============================================
   NOTE — ghi chú cuối trang
   ============================================ */

.cc-note {
  margin-top: 56px;
  text-align: center;
  font-size: 13px;
  color: #999;
  line-height: 1.7;
}

.cc-note b {
  color: #666;
  font-weight: 700;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .cc-page { padding: 32px 16px 64px; }
  .cc-hero { margin-bottom: 32px; }

  /* Input + picker xếp dọc */
  .cc-input-row {
    grid-template-columns: 1fr;
  }

  .cc-picker {
    padding: 16px 20px;
    justify-content: center;
  }

  .cc-input-wrap { padding-left: 16px; }
  .cc-input-hash { font-size: 22px; }
  .cc-input { font-size: 22px; padding: 12px 12px 12px 0; }

  .cc-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .cc-block {
    aspect-ratio: auto;
    min-height: 200px;
    padding: 24px;
  }

  .cc-stat {
    grid-template-columns: 80px 1fr;
    gap: 12px;
    padding: 14px 16px;
  }

  .cc-stat__value { font-size: 15px; }
  .cc-stat__copy { display: none; }

  /* Method */
  .cc-method__summary {
    padding: 16px 18px;
    font-size: 14px;
    gap: 10px;
  }

  .cc-method__hint {
    display: none;
  }

  .cc-method__icon {
    width: 32px;
    height: 32px;
  }

  .cc-method__body {
    padding: 20px 16px 18px;
  }

  .cc-flow {
    padding: 16px 12px;
    gap: 6px;
  }

  .cc-flow__node {
    padding: 8px 12px;
    font-size: 11px;
  }

  .cc-flow__node--leaf {
    padding: 6px 10px;
    font-size: 10px;
  }

  .cc-flow__branch {
    width: 100%;
    justify-content: center;
    border-radius: 10px;
  }

  .cc-steps {
    grid-template-columns: 1fr;
  }

  .cc-proscons {
    grid-template-columns: 1fr;
  }

  /* Warnings */
  .cc-warnings .cc-step__note {
    font-size: 11px;
  }
}

/* ============================================
   PRINT — chỉ in vùng kết quả
   ============================================ */

@media print {
  body * { visibility: hidden; }

  #result, #result * { visibility: visible; }

  #result {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 30px;
  }

  .cc-input-zone,
  .cc-actions,
  .cc-hero,
  .cc-method,
  .cc-warnings,
  .cc-note,
  .cc-stat__copy {
    display: none !important;
  }

  .cc-block {
    aspect-ratio: auto !important;
    min-height: 260px;
    box-shadow: none !important;
    border: 1px solid #ddd;
  }

  @page {
    margin: 15mm;
    size: A4 portrait;
  }
}