* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(135deg, #141e30, #243b55);
  color: #fff;
}

.page {
  padding: 24px 16px 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.card {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 255, 255, 0.08);
  padding: 24px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

h1 {
  text-align: center;
  font-size: 1.25rem;
  margin: 0;
}

.title-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  min-height: 36px;
}

.title-bar h1 {
  flex: 1;
  text-align: center;
  padding: 0 52px;
}

.title-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.settings-panel {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.settings-hint {
  margin: 8px 0 0;
  font-size: 11px;
  opacity: 0.7;
  line-height: 1.4;
}

.btn-settings-save {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(45deg, #00b09b, #2a9d8f);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-settings-save:hover {
  filter: brightness(1.05);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  margin: 0;
}

.card-modal {
  background: rgba(30, 40, 60, 0.95);
  padding: 22px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.card-modal h2 {
  margin: 0 0 10px;
  font-size: 1.2rem;
  text-align: center;
}

.modal-lead {
  line-height: 1.5;
  text-align: center;
}

.modal-lead-highlight {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  opacity: 0.95;
}

.modal-section {
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(45deg, #ff512f, #dd2476);
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  font-size: 15px;
}

.btn-secondary {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.field-error {
  margin: 0;
  font-size: 12px;
  color: #ff8a8a;
  text-align: center;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 255, 204, 0.2);
  color: #00ffcc;
}

.subtitle {
  text-align: center;
  font-size: 12px;
  opacity: 0.75;
  margin: 0 0 20px;
  line-height: 1.45;
}

.section {
  margin-bottom: 18px;
}

label {
  font-size: 12px;
  opacity: 0.85;
  display: block;
}

label .optional {
  font-weight: normal;
  opacity: 0.65;
}

select,
input {
  width: 100%;
  padding: 10px 12px;
  margin-top: 6px;
  border-radius: 12px;
  border: none;
  outline: none;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
}

button#generateBtn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(45deg, #ff512f, #dd2476);
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  font-size: 15px;
}

button#generateBtn:hover:not(:disabled) {
  transform: scale(1.02);
}

#result {
  margin-top: 16px;
  font-size: 16px;
  text-align: center;
  font-weight: bold;
  color: #00ffcc;
  line-height: 1.5;
  word-break: break-word;
}

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

.sms-btn {
  width: auto;
  display: block;
  margin: 12px auto 0;
  padding: 8px 18px;
  font-size: 13px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(45deg, #00b09b, #96c93d);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.copy-sms {
  width: auto;
  min-width: auto;
  background: none;
  border: none;
  color: #00ffcc;
  cursor: pointer;
  font-size: 14px;
  padding: 0 6px;
  flex-shrink: 0;
  line-height: 1;
}

.copy-sms:hover {
  transform: scale(1.15);
}

.history {
  margin-top: 20px;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.history-header h3 {
  margin: 0;
  font-size: 15px;
}

.trash-icon {
  cursor: pointer;
  color: #ff3b3b;
  transition: 0.2s;
  line-height: 0;
}

.trash-icon:hover {
  transform: scale(1.15);
}

#historyList {
  max-height: min(280px, 40vh);
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.history-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.delete-one {
  width: auto;
  min-width: auto;
  background: none;
  border: none;
  color: #ff3b3b;
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
  flex-shrink: 0;
  line-height: 1;
}

.hidden {
  display: none !important;
}
