/* =========================================================
   TOOL MINI: MODERN LUXURY SUITE (7 POWERFUL IN-HOUSE TOOLS)
   ========================================================= */

/* Modern Sleek Tool Sub Navigation (Grid & Wrap - Easy to Tap) */
.tools-subnav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
  background: rgba(18, 20, 29, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 8px;
  backdrop-filter: blur(10px);
}

.tool-nav-btn {
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.84rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-align: center;
  user-select: none;
}

.tool-nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.tool-nav-btn.active {
  background: linear-gradient(135deg, rgba(40, 223, 153, 0.18), rgba(0, 242, 254, 0.18));
  color: #28df99;
  border-color: #28df99;
  box-shadow: 0 0 16px rgba(40, 223, 153, 0.3);
}

.tool-panel-section {
  display: none;
  animation: fadeIn 0.35s ease;
}

.tool-panel-section.active {
  display: block;
}

/* =========================================================
   1. CLASH OF CLANS COMBOS (COC ARMY MANAGER)
   ========================================================= */
.coc-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.coc-badge-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #feca57;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coc-th-filter-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 14px;
  margin-bottom: 16px;
  scrollbar-width: thin;
}

.coc-th-btn {
  padding: 5px 13px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.coc-th-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.coc-th-btn.active {
  background: #feca57;
  color: #121318;
  border-color: #feca57;
  box-shadow: 0 0 14px rgba(254, 202, 87, 0.45);
}

.coc-combos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.coc-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-fast);
}

.coc-card:hover {
  transform: translateY(-4px);
  border-color: rgba(254, 202, 87, 0.5);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.coc-card-thumb-wrap {
  position: relative;
  width: 100%;
  height: 145px;
  background: #080a10;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.coc-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.coc-card:hover .coc-card-thumb {
  transform: scale(1.04);
}

.coc-th-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(18, 19, 24, 0.9);
  border: 1px solid #feca57;
  color: #feca57;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

.coc-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.coc-card-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 6px;
  line-height: 1.35;
}

.coc-card-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.coc-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: auto;
}

.coc-btn-primary {
  flex: 1;
  padding: 7px 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.76rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.coc-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.5);
  color: #fff;
}

.coc-btn-secondary {
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.74rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.coc-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #28df99;
  color: #28df99;
}

/* Modal Guide & Edit COC - Full uncropped display */
.coc-guide-img-wrap {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 14px;
  background: #06070a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.coc-guide-img-wrap img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
  display: block;
}

.coc-guide-text {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.35);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: pre-line;
  max-height: 40vh;
  overflow-y: auto;
}

/* Image Preview in Modal - Full view */
.coc-img-preview-box {
  width: 100%;
  min-height: 110px;
  max-height: 240px;
  border-radius: var(--radius-md);
  background: #06070a;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  margin-top: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.coc-img-preview-box img {
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  display: block;
}

/* =========================================================
   2. SHAPE-FRAMED QR CODE GENERATOR (QUÉT CỰC NHẠY 100%)
   ========================================================= */
.qr-container-box {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.qr-form-side {
  flex: 1;
  min-width: 280px;
}

.qr-preview-side {
  width: 260px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.qr-canvas-wrap {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  transition: all var(--transition-fast);
}

.qr-canvas-wrap canvas {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.qr-opt-group {
  margin-bottom: 14px;
}

.qr-opt-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.qr-shape-pills, .qr-color-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.qr-pill-btn {
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.qr-pill-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.qr-pill-btn.active {
  background: #28df99;
  color: #121318;
  border-color: #28df99;
  box-shadow: 0 0 12px rgba(40, 223, 153, 0.4);
}

/* =========================================================
   3. FANCY TEXT GENERATOR (27+ FONT STYLES)
   ========================================================= */
.fancy-text-input-box {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 18px;
  outline: none;
  transition: all var(--transition-fast);
}

.fancy-text-input-box:focus {
  border-color: #00f2fe;
  box-shadow: 0 0 16px rgba(0, 242, 254, 0.25);
  background: rgba(255, 255, 255, 0.08);
}

.fancy-text-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.fancy-text-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all var(--transition-fast);
}

.fancy-text-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 242, 254, 0.4);
}

.fancy-text-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.fancy-text-output {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-all;
}

.fancy-copy-btn {
  padding: 6px 12px;
  background: rgba(0, 242, 254, 0.12);
  border: 1px solid rgba(0, 242, 254, 0.4);
  color: #00f2fe;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.74rem;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.fancy-copy-btn:hover {
  background: #00f2fe;
  color: #121318;
}

/* =========================================================
   4. JSON FORMATTER & VALIDATOR
   ========================================================= */
.json-editor-textarea {
  width: 100%;
  height: 220px;
  background: rgba(10, 12, 18, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 14px;
  color: #28df99;
  font-family: var(--font-code);
  font-size: 0.84rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}

.json-editor-textarea:focus {
  border-color: #28df99;
}

/* =========================================================
   5. NÉN & GIẢM DUNG LƯỢNG ẢNH (IMAGE COMPRESSOR)
   ========================================================= */
.compress-dropzone {
  border: 2px dashed rgba(40, 223, 153, 0.4);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  text-align: center;
  background: rgba(40, 223, 153, 0.03);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: 20px;
}

.compress-dropzone:hover, .compress-dropzone.dragover {
  border-color: #28df99;
  background: rgba(40, 223, 153, 0.08);
  transform: translateY(-2px);
}

.compress-controls-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.compress-stat-badge {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.compress-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.compress-img-box {
  background: #080a10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
}

.compress-img-box img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  margin: 0 auto 10px;
}

/* =========================================================
   6. TẢI ẢNH BÌA YOUTUBE THUMBNAIL (HD & 4K)
   ========================================================= */
.yt-thumb-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.yt-thumb-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.yt-thumb-preview {
  width: 100%;
  height: 160px;
  background: #080a10;
  position: relative;
  overflow: hidden;
}

.yt-thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.yt-thumb-body {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

/* =========================================================
   7. BẢNG MÃ MÀU & TẠO GRADIENT
   ========================================================= */
.color-maker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.color-preview-box {
  width: 100%;
  height: 150px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.15);
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: background 0.2s ease;
}

.palette-swatches-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.palette-swatch-item {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.2s ease;
}

.palette-swatch-item:hover {
  transform: scale(1.15);
  border-color: #fff;
}

/* =========================================================
   RESPONSIVE TOOLS
   ========================================================= */
@media (max-width: 900px) {
  .tools-subnav {
    grid-template-columns: repeat(3, 1fr);
  }
  .coc-combos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .tools-subnav {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 6px;
  }
  .tool-nav-btn {
    padding: 9px 8px;
    font-size: 0.76rem;
  }
  .compress-compare-grid, .color-maker-grid, .yt-thumb-grid {
    grid-template-columns: 1fr;
  }
  .coc-combos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .coc-card-thumb-wrap {
    height: 110px;
  }
  .coc-card-body {
    padding: 10px;
  }
  .coc-card-title {
    font-size: 0.85rem;
  }
  .coc-card-desc {
    font-size: 0.72rem;
    -webkit-line-clamp: 2;
  }
  .coc-btn-primary, .coc-btn-secondary {
    padding: 5px 6px;
    font-size: 0.7rem;
  }
  .fancy-text-grid {
    grid-template-columns: 1fr;
  }
  .qr-container-box {
    flex-direction: column;
    align-items: center;
  }
  .qr-preview-side {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .tools-subnav {
    grid-template-columns: 1fr;
  }
  .coc-combos-grid {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   8. KÝ TỰ TÀNG HÌNH & KHOẢNG TRỐNG ĐẶT TÊN GAME (100% IN-HOUSE)
   ========================================================= */
.invisible-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.invisible-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all var(--transition-fast);
}

.invisible-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(40, 223, 153, 0.4);
  transform: translateY(-2px);
}

.invisible-card-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.invisible-card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.invisible-copy-btn {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, rgba(40, 223, 153, 0.15), rgba(0, 242, 254, 0.15));
  border: 1px solid #28df99;
  color: #28df99;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.invisible-copy-btn:hover {
  background: #28df99;
  color: #121318;
  box-shadow: 0 0 16px rgba(40, 223, 153, 0.4);
}

@media (max-width: 640px) {
  .invisible-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   SKILLS CONTAINER BALANCED GRID (2 COLUMNS DESKTOP)
   ========================================================= */
#skills-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  width: 100%;
}

@media (max-width: 768px) {
  #skills-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* =========================================================
   LIGHT THEME (NỀN TRẮNG): ĐỘ TƯƠNG PHẢN CAO, SIÊU SẮC NÉT
   ========================================================= */
body:not(.dark-theme) .tools-subnav {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

body:not(.dark-theme) .tool-nav-btn {
  background: #ffffff;
  color: #334155;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

body:not(.dark-theme) .tool-nav-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

body:not(.dark-theme) .tool-nav-btn.active {
  background: #ecfdf5;
  color: #059669;
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

body:not(.dark-theme) .fancy-text-input-box {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

body:not(.dark-theme) .fancy-text-input-box:focus {
  border-color: #0284c7;
  background: #ffffff;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.2);
}

body:not(.dark-theme) .fancy-text-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

body:not(.dark-theme) .fancy-text-output {
  color: #0f172a;
}

body:not(.dark-theme) .coc-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
}

body:not(.dark-theme) .coc-card-title {
  color: #0f172a;
}

body:not(.dark-theme) .coc-card-desc {
  color: #475569;
}

body:not(.dark-theme) .coc-btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

body:not(.dark-theme) .invisible-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

body:not(.dark-theme) .invisible-card-title {
  color: #0f172a;
}

body:not(.dark-theme) .invisible-card-desc {
  color: #64748b;
}

body:not(.dark-theme) .compress-controls-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

body:not(.dark-theme) .compress-dropzone {
  background: #f0fdf4;
  border-color: #86efac;
}

body:not(.dark-theme) .compress-img-box {
  background: #f8fafc;
  border-color: #e2e8f0;
}

body:not(.dark-theme) .yt-thumb-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

body:not(.dark-theme) .json-editor-textarea {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}

body:not(.dark-theme) .qr-preview-side {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

body:not(.dark-theme) .skills-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
}

body:not(.dark-theme) .skills-group-title {
  color: #0f172a;
}

body:not(.dark-theme) .skill-bar-unit {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

body:not(.dark-theme) .skill-header-row {
  color: #1e293b;
}

body:not(.dark-theme) .skill-meter-bg {
  background: #e2e8f0;
}

/* Mobile Touch Optimization */
.tool-nav-btn, .coc-th-btn, .qr-pill-btn, .fancy-copy-btn, .invisible-copy-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
