:root {
  --bg-color: #f4f7fb;
  --card-color: #ffffff;
  --primary-color: #0f6fff;
  --primary-dark: #0d59d9;
  --text-color: #1d2433;
  --muted-color: #5c667a;
  --border-color: #dfe7f4;
  --success-bg: #eaf8ee;
  --success-text: #1f7a43;
  --error-bg: #fdeceb;
  --error-text: #b42318;
  --shadow: 0 20px 45px rgba(15, 111, 255, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
}

button,
input {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-card {
  width: min(100%, 760px);
  background: var(--card-color);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px;
}

.app-header {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-color);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 2.5rem);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-weight: 700;
  color: var(--text-color);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: #fff;
  color: var(--text-color);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(15, 111, 255, 0.12);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.primary-btn {
  background: var(--primary-color);
  color: #fff;
}

.primary-btn:hover:not(:disabled) {
  background: var(--primary-dark);
}

.secondary-btn {
  background: #eaf2ff;
  color: var(--primary-color);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.message {
  min-height: 24px;
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  display: none;
}

.message.success {
  display: block;
  background: var(--success-bg);
  color: var(--success-text);
}

.message.error {
  display: block;
  background: var(--error-bg);
  color: var(--error-text);
}

.result-panel {
  margin-top: 28px;
  border-top: 1px solid var(--border-color);
  padding-top: 22px;
}

.history-section {
  margin-top: 28px;
  border-top: 1px solid var(--border-color);
  padding-top: 22px;
}

.history-heading,
.history-actions,
.history-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.history-heading {
  justify-content: space-between;
  align-items: flex-start;
}

.history-heading h2,
.history-heading p {
  margin: 0;
}

.history-heading h2 {
  font-size: 1.2rem;
}

.history-heading p {
  margin-top: 5px;
  color: var(--muted-color);
}

.danger-btn {
  background: var(--error-bg);
  color: var(--error-text);
}

.history-search {
  margin-top: 20px;
}

.empty-state {
  margin: 20px 0 0;
  padding: 20px;
  text-align: center;
  color: var(--muted-color);
  background: #f8faff;
  border: 1px dashed var(--border-color);
  border-radius: 10px;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.history-card {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.history-card h3 {
  margin: 0;
  font-size: 1rem;
}

.history-date,
.history-details {
  color: var(--muted-color);
  font-size: 0.88rem;
}

.history-date {
  white-space: nowrap;
}

.history-details {
  margin: 10px 0;
}

.history-url {
  display: block;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  color: var(--primary-color);
  font-size: 0.88rem;
}

.history-card-actions button {
  padding: 8px 12px;
}

.result-panel h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.result-box {
  background: #f8faff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  overflow-wrap: anywhere;
}

#generated-url {
  color: var(--text-color);
  font-size: 0.98rem;
  line-height: 1.5;
}

@media (max-width: 620px) {
  .app-card {
    padding: 22px 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    flex-direction: column;
  }

  .actions button {
    width: 100%;
  }

  .history-heading,
  .history-card-header {
    flex-direction: column;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions button {
    flex: 1;
    padding-inline: 10px;
  }
}
