/* ==========================================================================
   PROMPTMASTER AI — COMPONENTE: TEMPLATES E COMPARADOR (Diff e Drawer)
   ========================================================================== */

/* 1. Comparison Card & Tabbed Panel */
.comparison-card {
  padding: 20px;
}

.comparison-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  margin-bottom: 16px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
  outline: none;
}

.tab-btn:hover {
  color: #FFF;
}

.tab-btn.active {
  background: rgba(255, 255, 255, 0.06);
  color: #FFF;
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 2px 8px rgba(0,0,0,0.3);
}

.comparison-content {
  position: relative;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.4s var(--transition-smooth);
}

/* Diff Preformatted Code Box */
.diff-box {
  background: rgba(3, 4, 9, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 20px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
  max-height: 480px;
  overflow-y: auto;
}

.diff-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 12px;
}

/* Side by Side Splitting Layout */
.split-diff-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.split-diff-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.split-diff-pane h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.diff-box-split {
  background: rgba(3, 4, 9, 0.45);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
  max-height: 400px;
  overflow-y: auto;
}

.original-split {
  border-left: 3px solid rgba(239, 68, 68, 0.4);
}

.refined-split {
  border-left: 3px solid rgba(16, 185, 129, 0.4);
}

/* 2. Collapsible Drawer Panel Content */
.drawer-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-glass);
}

.drawer-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 16px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition-fast);
}

.drawer-tab-btn:hover {
  color: #FFF;
  background: rgba(255, 255, 255, 0.01);
}

.drawer-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: rgba(139, 92, 246, 0.03);
}

.drawer-tab-btn i {
  width: 16px;
  height: 16px;
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.drawer-pane {
  display: none;
}

.drawer-pane.active {
  display: block;
}

.drawer-info-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* 3. Templates list inside Drawer */
.templates-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.template-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 18px;
  transition: all var(--transition-fast);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.template-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(139, 92, 246, 0.25);
  transform: translateY(-2px);
}

.temp-cat {
  font-size: 0.7rem;
  color: var(--secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.temp-title {
  font-size: 0.95rem;
  color: #FFF;
  font-weight: 600;
}

.temp-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.temp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.temp-badge {
  background: rgba(139, 92, 246, 0.1);
  color: var(--primary);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 600;
}

.btn-load-temp {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
  color: #FFF;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition-fast);
}

.btn-load-temp:hover {
  background: var(--accent-gradient);
  border-color: transparent;
}

.btn-load-temp i {
  width: 12px;
  height: 12px;
}

/* 4. History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-empty {
  text-align: center;
  padding: 40px 0;
  color: var(--text-darker);
  font-size: 0.85rem;
}

.history-card {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.history-card:hover {
  background: rgba(255, 255, 255, 0.03);
}

.hist-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
  margin-right: 12px;
}

.hist-text {
  font-size: 0.8rem;
  color: #FFF;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.hist-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.hist-score {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(139, 92, 246, 0.1);
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(139, 92, 246, 0.15);
}

.btn-restore-hist {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.btn-restore-hist:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #FFF;
}

.btn-restore-hist i {
  width: 16px;
  height: 16px;
}

@media (max-width: 600px) {
  .split-diff-container {
    grid-template-columns: 1fr;
  }
}
