/* Shared CSS Variables for aesthetic consistency */
:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-color: #f9fafb;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --border-color: #e5e7eb;
  --success-color: #10b981;
  --success-hover: #059669;
  --accent-color: #f59e0b;
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  position: relative;
}

/* Layout & Card Scaffolding */
.app-container {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
}

.step-card {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.step-card.hidden,
.hidden {
  display: none !important;
}

/* Typography */
h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

/* Global Buttons */
.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.btn-secondary {
  background-color: #f3f4f6;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: #e5e7eb;
}

.btn-success {
  background-color: var(--success-color);
  color: #ffffff;
}

.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-link {
  background: transparent;
  color: var(--text-muted);
}

.btn-link:hover {
  color: var(--text-main);
}

/* Step 1: Start / Selection Options */
.options-grid {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#file-input {
  display: none;
}

.custom-file-upload {
  text-align: center;
}

.divider {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* Step 2: Password Form */
#password-form {
  width: 100%;
  max-width: 400px;
}

.form-group {
  margin-bottom: 1.25rem;
}

input[type="password"] {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background-color: #ffffff;
  color: var(--text-main);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input[type="password"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.action-row {
  display: flex;
  gap: 1rem;
}

/* Step 3: In-Page Text Editor */
.editor-card {
  align-items: stretch;
  text-align: left;
  padding: 1.5rem;
  height: 70vh;
  min-height: 480px;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.file-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  background-color: #f3f4f6;
  color: var(--text-main);
  padding: 0.25rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.status-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.editor-wrapper {
  flex: 1;
  display: flex;
  margin-bottom: 1rem;
}

textarea#text-editor {
  width: 100%;
  height: 100%;
  resize: none;
  background-color: #f9fafb;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text-main);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

textarea#text-editor:focus {
  border-color: var(--primary-color);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.editor-footer {
  display: flex;
  justify-content: flex-end;
}

.editor-footer .btn {
  width: auto;
}

/* Step 4: Success Screen */
.success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #d1fae5;
  color: #065f46;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 300px;
}

/* Persistent Mini Version Tag */
.app-version {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #9ca3af;
  user-select: none;
  pointer-events: none;
}

@media (max-width: 480px) {
  .app-version {
    bottom: 0.5rem;
    right: 0.5rem;
    font-size: 0.7rem;
  }
}