@import url('https://fonts.googleapis.com/css2?family=Creepster&family=MedievalSharp&family=Inter:wght@400;600&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: #0d0a1a;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(80, 20, 100, 0.25) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(40, 100, 20, 0.15) 0%, transparent 50%);
  color: #d4c8a8;
  min-height: 100vh;
}

/* === CONTAINER === */
.container {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}

/* === HEADER === */
.header {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.header .logo {
  width: 100px;
  height: auto;
  border-radius: 12px;
  border: 2px solid #6b2fa0;
  box-shadow: 0 0 20px rgba(107, 47, 160, 0.5);
  margin-bottom: 0.75rem;
}

.header h1 {
  font-family: 'Creepster', cursive;
  font-size: 2rem;
  color: #a855f7;
  text-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
  letter-spacing: 2px;
}

.header .subtitle {
  font-family: 'MedievalSharp', cursive;
  color: #7a6f5a;
  font-size: 0.95rem;
  margin-top: 0.3rem;
}

/* === STEPS === */
.step {
  display: none;
  animation: fadeIn 0.4s ease;
}

.step.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === UPLOAD === */
.upload-area {
  border: 2px dashed #6b2fa0;
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(107, 47, 160, 0.06);
}

.upload-area:hover,
.upload-area.dragover {
  background: rgba(107, 47, 160, 0.15);
  border-color: #a855f7;
  box-shadow: 0 0 25px rgba(168, 85, 247, 0.2);
}

.upload-area .upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.upload-area p {
  font-family: 'MedievalSharp', cursive;
  font-size: 1.1rem;
  color: #d4c8a8;
}

.upload-area small {
  color: #6a5f4a;
  font-size: 0.85rem;
}

.upload-area input[type="file"] {
  display: none;
}

/* Encoding */
.encoding-select {
  margin-top: 1rem;
  text-align: center;
}

.encoding-select label {
  color: #7a6f5a;
  font-size: 0.85rem;
  margin-right: 0.4rem;
}

.encoding-select select {
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  border: 1px solid #3a2a50;
  background: #1a1230;
  color: #d4c8a8;
  font-size: 0.85rem;
}

/* === INPUT DIVIDER === */
.input-divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  gap: 1rem;
}

.input-divider::before,
.input-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #3a2a50;
}

.input-divider span {
  color: #7a6f5a;
  font-family: 'MedievalSharp', cursive;
  font-size: 1rem;
}

/* === TEXT INPUT AREA === */
.text-input-area {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.text-input-area label {
  color: #d4c8a8;
  font-family: 'MedievalSharp', cursive;
  font-size: 1rem;
}

.text-input-area label small {
  color: #6a5f4a;
  font-size: 0.8rem;
}

.text-input-area textarea {
  background: #110e1f;
  border: 1px solid #3a2a50;
  border-radius: 10px;
  color: #d4c8a8;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  resize: vertical;
  min-height: 120px;
}

.text-input-area textarea:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
}

.text-input-area textarea::placeholder {
  color: #4a4050;
}

.text-input-area .btn {
  align-self: flex-end;
}

/* === BUTTON GROUP === */
.button-group {
  display: flex;
  gap: 0.5rem;
}

/* === CURSE LIST === */
.curse-list {
  list-style: none;
  max-height: 65vh;
  overflow-y: auto;
  border: 1px solid #2a1f3d;
  border-radius: 10px;
  padding: 0.4rem;
  background: #110e1f;
  scrollbar-width: thin;
  scrollbar-color: #6b2fa0 #110e1f;
}

.curse-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid #1f1835;
  transition: background 0.2s;
}

.curse-item:last-child {
  border-bottom: none;
}

.curse-item:hover {
  background: rgba(107, 47, 160, 0.08);
}

.curse-item .number {
  color: #6b2fa0;
  font-weight: 600;
  min-width: 1.8rem;
  text-align: right;
  font-size: 0.85rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

.curse-item .text {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
  word-break: break-word;
}

.curse-item .actions {
  display: flex;
  gap: 0.3rem;
  flex-shrink: 0;
}

.curse-item input[type="text"] {
  width: 100%;
  background: #1a1230;
  border: 1px solid #3a2a50;
  color: #d4c8a8;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.curse-item input[type="text"]:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

/* === PREFIX FIELD === */
.prefix-field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.prefix-field label {
  color: #7a6f5a;
  font-size: 0.85rem;
  font-family: 'MedievalSharp', cursive;
}

.prefix-field input {
  background: #1a1230;
  border: 1px solid #3a2a50;
  color: #d4c8a8;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: 'Inter', sans-serif;
}

.prefix-field input:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 8px rgba(168, 85, 247, 0.3);
}

/* === BUTTONS === */
.btn {
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}

.btn-primary {
  background: linear-gradient(135deg, #6b2fa0, #a855f7);
  color: white;
  box-shadow: 0 2px 10px rgba(107, 47, 160, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 4px 18px rgba(168, 85, 247, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #1f1835;
  color: #a89cc0;
  border: 1px solid #3a2a50;
}

.btn-secondary:hover {
  background: #2a1f45;
}

.btn-danger {
  background: #5c1a1a;
  color: #e88;
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: #7a2020;
}

.btn-edit {
  background: #1a2a40;
  color: #88bbee;
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.btn-edit:hover {
  background: #223a55;
}

.btn-small {
  padding: 0.3rem 0.55rem;
  font-size: 0.8rem;
}

.button-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  align-items: stretch;
}

.button-row .info {
  color: #7a6f5a;
  font-size: 0.85rem;
  text-align: center;
  order: -1;
}

/* === PREVIEW === */
.preview-info {
  background: rgba(107, 47, 160, 0.1);
  border: 1px solid #3a2a50;
  border-radius: 8px;
  padding: 0.85rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.preview-info strong {
  color: #a855f7;
}

.card-preview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
}

.card {
  border: 1px solid #3a2a50;
  border-radius: 6px;
  padding: 0.6rem 0.7rem;
  background: #110e1f;
  font-size: 0.75rem;
  line-height: 1.4;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../img/logo-landscape.jpeg') center/cover no-repeat;
  opacity: 0.12;
  filter: grayscale(100%);
  pointer-events: none;
}

.card .card-prefix {
  color: #6b2fa0;
  font-weight: bold;
  font-size: 0.9rem;
  line-height: 1.3;
  position: relative;
  z-index: 1;
  text-align: center;
}

.card .card-divider {
  color: #6b2fa0;
  text-align: center;
  font-size: 0.75rem;
  letter-spacing: 2px;
  margin: 0.3rem 0;
  position: relative;
  z-index: 1;
  opacity: 0.7;
}

.card .card-curse {
  color: #d4c8a8;
  font-style: italic;
  font-weight: bold;
  font-size: 0.95rem;
  line-height: 1.3;
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

/* === Decorative elements === */
.voodoo-divider {
  text-align: center;
  color: #3a2a50;
  font-size: 1.2rem;
  letter-spacing: 8px;
  margin: 1.5rem 0;
  user-select: none;
}

/* === Loading overlay === */
.loading {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13, 10, 26, 0.9);
  z-index: 100;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
}

.loading.active {
  display: flex;
}

.loading .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #2a1f3d;
  border-top-color: #a855f7;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  color: #a855f7;
  font-family: 'MedievalSharp', cursive;
}

/* === TABLET+ === */
@media (min-width: 480px) {
  .container {
    padding: 1.5rem;
  }

  .header h1 {
    font-size: 2.5rem;
  }

  .header .logo {
    width: 120px;
  }

  .card-preview {
    grid-template-columns: repeat(2, 1fr);
  }

  .button-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }

  .button-row .info {
    order: 0;
  }
}

/* === DESKTOP === */
@media (min-width: 768px) {
  .container {
    padding: 2rem 3rem;
  }

  .header {
    padding: 2.5rem 0 1.5rem;
  }

  .header h1 {
    font-size: 3rem;
  }

  .header .logo {
    width: 140px;
  }

  .upload-area {
    padding: 3.5rem 2.5rem;
  }

  .upload-area .upload-icon {
    font-size: 3.5rem;
  }

  .upload-area p {
    font-size: 1.3rem;
  }

  .curse-list {
    padding: 0.75rem;
  }

  .curse-item {
    padding: 0.85rem 0.75rem;
    gap: 0.75rem;
  }

  .curse-item .number {
    min-width: 2.2rem;
    font-size: 0.95rem;
  }

  .curse-item .text {
    font-size: 1rem;
  }

  .card-preview {
    gap: 1rem;
  }

  .card {
    padding: 0.8rem 1rem;
    min-height: 95px;
  }

  .card .card-curse {
    font-size: 1.05rem;
  }

  .preview-info {
    padding: 1.2rem;
    font-size: 0.95rem;
  }

  .btn {
    padding: 0.65rem 1.8rem;
    font-size: 1rem;
  }
}

/* === LARGE DESKTOP === */
@media (min-width: 1024px) {
  .container {
    max-width: 960px;
  }

  .card-preview {
    grid-template-columns: repeat(3, 1fr);
  }
}
