/* ============================================
   FORJALABS - Herramientas Gratis
   Tool Pages Stylesheet
   ============================================ */

/* --- Tool Page Layout --- */
.tool-main {
  min-height: 100vh;
  background: #F9FAFB;
  padding-top: 80px; /* header height */
}

.tool-hero {
  background: var(--forja-black);
  padding: 60px 80px;
  border-bottom: 3px solid var(--forja-orange);
}

.tool-hero-inner {
  max-width: 800px;
  margin: 0 auto;
}

.tool-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.6);
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
  transition: color 0.2s;
  text-decoration: none;
}
.tool-back:hover { color: var(--forja-orange); }
.tool-back i { width: 16px; height: 16px; }

.tool-hero-badge {
  display: inline-block;
  background: var(--forja-orange);
  color: white;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 4px 12px;
  margin-bottom: 16px;
}

.tool-hero-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  color: white;
  line-height: 1.1;
  margin-bottom: 12px;
}

.tool-hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
  max-width: 600px;
}

.tool-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 50px 40px 80px;
}

/* --- Tool Cards --- */
.tool-card {
  background: white;
  border: 1px solid #E5E7EB;
  padding: 36px;
  margin-bottom: 24px;
}

.tool-section-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--forja-orange);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #F3F4F6;
}

/* --- Form Elements --- */
.tool-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--forja-black);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.tool-input,
.tool-textarea,
.tool-select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #E5E7EB;
  background: white;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--forja-black);
  outline: none;
  transition: border-color 0.2s;
  border-radius: 0;
  -webkit-appearance: none;
}
.tool-input:focus,
.tool-textarea:focus,
.tool-select:focus { border-color: var(--forja-orange); }

.tool-textarea {
  min-height: 140px;
  resize: vertical;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.5;
}

.tool-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

/* Range slider */
.tool-range-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.tool-range {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  background: #E5E7EB;
  outline: none;
  cursor: pointer;
}
.tool-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--forja-orange);
  cursor: pointer;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 0 1px var(--forja-orange);
}
.tool-range-value {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--forja-orange);
  min-width: 48px;
  text-align: right;
}

/* Color input */
.tool-color {
  width: 52px;
  height: 40px;
  border: 1.5px solid #E5E7EB;
  cursor: pointer;
  padding: 2px;
  background: white;
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed #D1D5DB;
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #FAFAFA;
  position: relative;
}
.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--forja-orange);
  background: #FFF7ED;
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.drop-zone-icon {
  width: 48px;
  height: 48px;
  color: #9CA3AF;
  margin: 0 auto 16px;
}
.drop-zone-icon i { width: 48px; height: 48px; }
.drop-zone-text {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}
.drop-zone-sub {
  font-size: 13px;
  color: var(--forja-gray);
}
.drop-zone.has-file {
  border-color: #10B981;
  background: #F0FDF4;
}
.drop-zone.has-file .drop-zone-icon i { color: #10B981; }

/* --- Buttons --- */
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.tool-btn i { width: 18px; height: 18px; }
.tool-btn-primary {
  background: var(--forja-orange);
  color: white;
}
.tool-btn-primary:hover { background: #EA580C; transform: translateY(-1px); }
.tool-btn-primary:disabled { background: #D1D5DB; cursor: not-allowed; transform: none; }

.tool-btn-secondary {
  background: var(--forja-black);
  color: white;
}
.tool-btn-secondary:hover { background: #1F2937; }

.tool-btn-outline {
  background: transparent;
  color: var(--forja-black);
  border: 1.5px solid #E5E7EB;
}
.tool-btn-outline:hover { border-color: var(--forja-black); }

.tool-btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}

.tool-btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* Chip buttons */
.tool-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.tool-chip {
  padding: 8px 16px;
  border: 1.5px solid #E5E7EB;
  background: white;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.15s;
  color: #374151;
}
.tool-chip:hover { border-color: var(--forja-orange); color: var(--forja-orange); }
.tool-chip.active {
  background: var(--forja-orange);
  border-color: var(--forja-orange);
  color: white;
}

/* --- Result Area --- */
.tool-result {
  margin-top: 24px;
  display: none;
}
.tool-result.visible { display: block; }

.tool-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.tool-result-label {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #10B981;
}

.tool-code {
  background: #1E1E1E;
  color: #D4D4D4;
  padding: 20px 24px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  position: relative;
  border-radius: 2px;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: transparent;
  border: 1.5px solid #E5E7EB;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
}
.copy-btn:hover { border-color: var(--forja-orange); color: var(--forja-orange); }
.copy-btn.copied { border-color: #10B981; color: #10B981; }

/* --- Color Swatches --- */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.swatch-item {
  text-align: center;
}
.swatch-color {
  height: 80px;
  border-radius: 2px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  border: 1px solid rgba(0,0,0,0.08);
}
.swatch-color:hover { transform: scale(1.04); }
.swatch-hex {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

/* --- Progress --- */
.progress-wrap {
  height: 4px;
  background: #E5E7EB;
  margin-top: 16px;
  overflow: hidden;
  display: none;
}
.progress-wrap.visible { display: block; }
.progress-fill {
  height: 100%;
  background: var(--forja-orange);
  transition: width 0.3s;
}

/* --- File List --- */
.file-list {
  list-style: none;
  margin-top: 16px;
}
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border: 1px solid #E5E7EB;
  margin-bottom: 8px;
  background: white;
}
.file-item-name {
  font-size: 14px;
  color: #374151;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item-size {
  font-size: 12px;
  color: var(--forja-gray);
  margin: 0 16px;
}
.file-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #9CA3AF;
  padding: 4px;
  display: flex;
}
.file-item-remove:hover { color: #EF4444; }

/* --- Grid helpers --- */
.tool-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.tool-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}
.tool-col { flex: 1; }
.tool-spacer { margin-bottom: 20px; }
.tool-divider {
  border: none;
  border-top: 1px solid #F3F4F6;
  margin: 24px 0;
}

.tool-info {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #EFF6FF;
  border-left: 3px solid #3B82F6;
  font-size: 13px;
  color: #1E40AF;
  margin-bottom: 20px;
}
.tool-info i { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.tool-warning {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #FEF9C3;
  border-left: 3px solid #EAB308;
  font-size: 13px;
  color: #713F12;
  margin-bottom: 20px;
}

.tool-success {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #F0FDF4;
  border-left: 3px solid #10B981;
  font-size: 13px;
  color: #065F46;
  margin-top: 16px;
  display: none;
}
.tool-success.visible { display: flex; }

/* --- Download Section --- */
.download-result {
  margin-top: 24px;
  display: none;
}
.download-result.visible { display: block; }

.video-info-card {
  display: flex;
  gap: 20px;
  padding: 20px;
  background: white;
  border: 1px solid #E5E7EB;
  margin-bottom: 20px;
}
.video-thumb {
  width: 160px;
  height: 90px;
  object-fit: cover;
  flex-shrink: 0;
  background: #F3F4F6;
}
.video-meta { flex: 1; }
.video-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--forja-black);
  margin-bottom: 8px;
  line-height: 1.3;
}
.video-duration {
  font-size: 13px;
  color: var(--forja-gray);
}

.download-btn-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px;
  background: var(--forja-orange);
  color: white;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.download-btn-main:hover { background: #EA580C; }
.download-btn-main i { width: 20px; height: 20px; }

.rate-limit-msg {
  padding: 16px;
  background: #FEF2F2;
  border-left: 3px solid #EF4444;
  font-size: 14px;
  color: #991B1B;
  margin-top: 16px;
  display: none;
}
.rate-limit-msg.visible { display: block; }

.loading-spinner {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 20px;
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--forja-gray);
}
.loading-spinner.visible { display: flex; }
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #E5E7EB;
  border-top-color: var(--forja-orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Preview image */
.img-preview {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
  margin: 16px auto;
  border: 1px solid #E5E7EB;
}

/* Diff output */
.diff-output {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: white;
  border: 1px solid #E5E7EB;
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
}
.diff-added { background: #D1FAE5; color: #065F46; }
.diff-removed { background: #FEE2E2; color: #991B1B; }
.diff-line { display: block; padding: 1px 8px; }

/* Stats row */
.stats-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.stat-item {
  flex: 1;
  min-width: 120px;
  padding: 16px;
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  text-align: center;
}
.stat-value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--forja-orange);
}
.stat-label {
  font-size: 12px;
  color: var(--forja-gray);
  margin-top: 4px;
}

/* Gradient preview */
.gradient-preview {
  height: 120px;
  border-radius: 2px;
  margin-bottom: 16px;
  border: 1px solid #E5E7EB;
}

/* Barcode output */
#barcode-output svg,
#barcode-output canvas {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .tool-hero { padding: 40px 24px; }
  .tool-content { padding: 32px 20px 60px; }
  .tool-card { padding: 24px 20px; }
  .tool-grid-2 { grid-template-columns: 1fr; }
  .tool-row { flex-direction: column; }
  .video-info-card { flex-direction: column; }
  .video-thumb { width: 100%; height: 180px; }
  .stats-row { gap: 12px; }
}

@media (max-width: 480px) {
  .tool-btn-group { flex-direction: column; }
  .tool-btn { width: 100%; }
  .swatch-grid { grid-template-columns: repeat(3, 1fr); }
}
