/* ======================================= */
/* ENHANCED TEKST-OMZETTER                 */
/* UNIFIED STYLE MET BARCODE & BROWSER     */
/* ======================================= */

/* ===== COLOR DEFINITIONS ===== */
.text-converter-card {
  --text-converter-bg-card: var(--secondary-bg);
  --text-converter-bg-input: var(--primary-bg);
  --text-converter-bg-form: var(--secondary-bg);
  --text-converter-border: var(--border-color);
  --text-converter-text: var(--text-primary);
  --text-converter-text-secondary: var(--text-secondary);
  --text-converter-button-bg: var(--link-color);
  --text-converter-button-text: var(--text-primary);
  --text-converter-button-border: var(--border-color);
  --text-converter-button-hover-border: var(--link-color);
  --text-converter-button-hover-shadow: rgba(88, 166, 255, 0.2);
  --text-converter-type-btn-active-bg: var(--link-color);
  --text-converter-type-btn-active-border: var(--link-color);
  --text-converter-type-btn-active-shadow: rgba(88, 166, 255, 0.3);
  --text-converter-focus-border: var(--link-color);
  --text-converter-focus-shadow: rgba(88, 166, 255, 0.1);
}

:root.light-mode .text-converter-card {
  --text-converter-bg-card: #ffffff;
  --text-converter-bg-input: #ffffff;
  --text-converter-bg-form: #f9fafb;
  --text-converter-border: #d0d7de;
  --text-converter-text: #24292f;
  --text-converter-text-secondary: #57606a;
  --text-converter-button-bg: #ffffff;
  --text-converter-button-text: #24292f;
  --text-converter-button-border: #d0d7de;
  --text-converter-button-hover-border: #0969da;
  --text-converter-button-hover-shadow: rgba(9, 105, 218, 0.15);
  --text-converter-type-btn-active-bg: #0969da;
  --text-converter-type-btn-active-border: #0969da;
  --text-converter-type-btn-active-shadow: rgba(9, 105, 218, 0.2);
  --text-converter-focus-border: #0969da;
  --text-converter-focus-shadow: rgba(9, 105, 218, 0.1);
}

/* ===== MAIN CARD ===== */
.text-converter-card {
  max-width: 100%;
  margin: 0 auto;
  padding: 1.25rem;
  background: var(--text-converter-bg-card);
  border: 1px solid var(--text-converter-border);
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: var(--text-converter-text);
  position: relative;
  overflow: hidden;
}

.text-converter-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #9333ea, #3b82f6, #9333ea);
  background-size: 200% 100%;
  animation: textConverterGradientShift 3s ease infinite;
}

@keyframes textConverterGradientShift {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* ===== HEADER ===== */
.text-converter-card h1 {
  color: var(--text-converter-text);
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  text-align: center;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.text-converter-card .intro {
  text-align: center;
  color: var(--text-converter-text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.5;
  font-weight: 400;
}

/* ===== LAYOUT ===== */
.text-converter-card-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

@media (min-width: 992px) {
  .text-converter-card-layout {
    grid-template-columns: 1fr 1fr;
  }
}

.text-converter-card-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===== SECTION HEADERS (label row) ===== */
.text-converter-card-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.text-converter-card-section-header label {
  color: var(--text-converter-text);
  font-weight: 500;
  font-size: 0.875rem;
  margin: 0;
}

/* ===== INLINE COPY BUTTON (input header) ===== */
.text-converter-card-inline-copy-btn {
  background: transparent;
  border: 1px solid var(--text-converter-border);
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-converter-text-secondary);
  transition: all 0.15s ease;
  line-height: 1;
}

.text-converter-card-inline-copy-btn:hover {
  border-color: var(--text-converter-button-hover-border);
  color: var(--text-converter-text);
  background: var(--text-converter-bg-form);
}

/* ===== ACTIVE BADGE (shows last transform) ===== */
.text-converter-card-active-badge {
  display: none;
  background: var(--text-converter-type-btn-active-bg);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-converter-card-active-badge.visible {
  display: inline-block;
}

/* ===== TEXTAREA WRAPPER (for inline char counter) ===== */
.text-converter-card-textarea-wrap {
  position: relative;
}

/* ===== INPUT/OUTPUT SECTIONS ===== */
.text-converter-card-input-section,
.text-converter-card-output-section {
  background: var(--text-converter-bg-form);
  border: 1px solid var(--text-converter-border);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
}

.text-converter-card-input-section:hover,
.text-converter-card-output-section:hover {
  border-color: var(--text-converter-button-hover-border);
}

.text-converter-card-input-section label,
.text-converter-card-output-section label {
  display: block;
  color: var(--text-converter-text);
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.text-converter-card textarea {
  width: 100%;
  padding: 0.75rem;
  padding-bottom: 1.6rem; /* room for inline counter */
  background: var(--text-converter-bg-input);
  color: var(--text-converter-text);
  border: 2px solid var(--text-converter-border);
  border-radius: 8px;
  font-family: "Roboto Mono", monospace;
  font-size: 0.9rem;
  resize: vertical;
  transition: all 0.2s ease;
  box-sizing: border-box;
  line-height: 1.5;
}

.text-converter-card textarea:focus {
  outline: none;
  border-color: var(--text-converter-focus-border);
  box-shadow: 0 0 0 3px var(--text-converter-focus-shadow);
}

.text-converter-card textarea[readonly] {
  background: var(--text-converter-bg-form);
  cursor: default;
  opacity: 0.9;
}

.text-converter-card textarea::placeholder {
  color: var(--text-converter-text-secondary);
  opacity: 0.6;
}

/* Drag-over visual */
.text-converter-card textarea.drag-over {
  border-color: var(--text-converter-focus-border);
  box-shadow: 0 0 0 3px var(--text-converter-focus-shadow);
  background: color-mix(in srgb, var(--text-converter-bg-input) 90%, var(--text-converter-focus-border) 10%);
}

/* ===== INLINE CHAR COUNTER ===== */
.text-converter-card-char-counter {
  position: absolute;
  bottom: 0.45rem;
  right: 0.6rem;
  font-size: 0.7rem;
  font-family: "Roboto Mono", monospace;
  color: var(--text-converter-text-secondary);
  opacity: 0.55;
  pointer-events: none;
  user-select: none;
}

/* ===== CONVERSION GRID ===== */
.text-converter-card-conversion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.text-converter-card-convert-btn {
  background: var(--text-converter-button-bg);
  border: 2px solid var(--text-converter-button-border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-converter-button-text);
  font-size: 0.85rem;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.text-converter-card-convert-btn::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.text-converter-card-convert-btn:hover {
  border-color: var(--text-converter-button-hover-border);
  background: var(--text-converter-bg-card);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--text-converter-button-hover-shadow);
}

.text-converter-card-convert-btn:hover::before {
  width: 300px; height: 300px;
}

.text-converter-card-convert-btn:active {
  transform: translateY(0);
}

/* Active transform highlight */
.text-converter-card-convert-btn.active-transform {
  border-color: var(--text-converter-type-btn-active-border);
  box-shadow: 0 0 0 2px var(--text-converter-type-btn-active-shadow);
}

.text-converter-card-btn-label {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  color: var(--text-converter-text);
}

/* ===== REPEAT INPUT inside button ===== */
.text-converter-card-repeat-input {
  width: 3rem;
  padding: 0.15rem 0.3rem;
  border: 1px solid var(--text-converter-border);
  border-radius: 4px;
  background: var(--text-converter-bg-input);
  color: var(--text-converter-text);
  font-size: 0.8rem;
  font-family: "Roboto Mono", monospace;
  text-align: center;
  cursor: text;
  position: relative;
  z-index: 2;
}

.text-converter-card-repeat-input:focus {
  outline: none;
  border-color: var(--text-converter-focus-border);
}

/* ===== UTILITY ROW (swap + undo) ===== */
.text-converter-card-utility-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.text-converter-card-utility-btn {
  padding: 0.55rem 0.75rem;
  border: 1px dashed var(--text-converter-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.825rem;
  font-weight: 500;
  color: var(--text-converter-text-secondary);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.text-converter-card-utility-btn:hover:not(:disabled) {
  border-color: var(--text-converter-button-hover-border);
  color: var(--text-converter-text);
  background: var(--text-converter-bg-form);
  border-style: solid;
}

.text-converter-card-utility-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ===== STATS ===== */
.text-converter-card-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
}

.text-converter-card-stat {
  background: var(--text-converter-bg-form);
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 2px solid var(--text-converter-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.text-converter-card-stat:hover {
  border-color: var(--text-converter-button-hover-border);
  transform: translateY(-1px);
}

.text-converter-card-stat-label {
  font-size: 0.8rem;
  color: var(--text-converter-text-secondary);
  font-weight: 500;
}

.text-converter-card-stat-value {
  font-size: 0.9rem;
  color: var(--text-converter-type-btn-active-bg);
  font-weight: 600;
  text-align: right;
}

/* ===== ACTION BUTTONS ===== */
.text-converter-card-action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.text-converter-card-action-btn {
  padding: 0.7rem 1.25rem;
  border: 2px solid var(--text-converter-button-border);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.text-converter-card-action-btn::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 0; height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.text-converter-card-action-btn:hover::before {
  width: 300px; height: 300px;
}

.text-converter-card-action-btn.primary {
  background: var(--text-converter-type-btn-active-bg) !important;
  border-color: var(--text-converter-type-btn-active-border) !important;
  color: white !important;
  box-shadow: 0 2px 8px var(--text-converter-type-btn-active-shadow);
}

.text-converter-card-action-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--text-converter-type-btn-active-shadow) !important;
}

.text-converter-card-action-btn.secondary {
  background: var(--button-reset-bg) !important;
  border-color: var(--button-reset-bg) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.text-converter-card-action-btn.secondary:hover {
  background: var(--button-reset-hover) !important;
  border-color: var(--button-reset-hover) !important;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4) !important;
}

.text-converter-card-action-btn:active {
  transform: translateY(0);
}

/* ===== FEEDBACK ===== */
.text-converter-card-feedback {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  display: none;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-10px);
  margin-top: 0.75rem;
}

.text-converter-card-feedback.visible {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.text-converter-card-feedback.success,
.text-converter-card-feedback.visible {
  background: #10b981;
  color: #ffffff;
  border: 2px solid #059669;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.text-converter-card-feedback.error {
  background: #ef4444;
  color: #ffffff;
  border: 2px solid #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

:root.light-mode .text-converter-card-feedback.success,
:root.light-mode .text-converter-card-feedback.visible {
  background: #10b981;
  color: #ffffff;
  border: 2px solid #059669;
}

:root.light-mode .text-converter-card-feedback.error {
  background: #ef4444;
  color: #ffffff;
  border: 2px solid #dc2626;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
  .text-converter-card-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .text-converter-card { padding: 1rem; }

  .text-converter-card h1 {
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
  }

  .text-converter-card .intro {
    font-size: 0.85rem;
    margin-bottom: 0.875rem;
  }

  .text-converter-card textarea {
    padding: 0.65rem;
    padding-bottom: 1.5rem;
    font-size: 0.875rem;
  }

  .text-converter-card-conversion-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .text-converter-card-convert-btn {
    padding: 0.6rem 0.65rem;
    font-size: 0.8rem;
  }

  .text-converter-card-action-buttons,
  .text-converter-card-utility-row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .text-converter-card-action-btn {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }
}

@media (max-width: 576px) {
  .text-converter-card { padding: 0.875rem; }

  .text-converter-card h1 { font-size: 1.3rem; }

  .text-converter-card .intro { font-size: 0.8rem; }

  .text-converter-card-convert-btn {
    padding: 0.55rem 0.6rem;
    font-size: 0.75rem;
  }

  .text-converter-card-action-btn {
    padding: 0.6rem 0.875rem;
    font-size: 0.825rem;
  }

  .text-converter-card-stats {
    grid-template-columns: 1fr 1fr;
  }
}
