* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 40px;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #f0d312 0%, #b7ff87 100%);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  color: #14241d;
}

/* Linker (hvis du får noen senere) */
a {
  color: #2563eb;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Layout: venstre config + høyre telefon */
#layout {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

/* Hovedkortet (venstre) */
#main {
  width: 100%;
  max-width: 720px;
  background: #f7faf7;
  border-radius: 18px;
  border: 1px solid rgba(18, 36, 27, 0.16);
  padding: 24px 28px 28px;
  box-shadow:
    0 18px 40px rgba(7, 24, 16, 0.36),
    0 0 0 1px rgba(18, 36, 27, 0.08);
}

/* Header */
#main h1 {
  margin: 0 0 20px 0;
  font-size: 2.0rem;
  letter-spacing: 0.05em;
  font-weight: 800;
  color: #14332b;
  font-family: 'Inter', sans-serif;
  text-transform: uppercase;
  position: relative;
}

#info {
  padding: 0;
}

/* Intro-tekstfelt */
#textBox {
  margin-top: 6px;
  margin-bottom: 18px;
}

#messageInput {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #dbe7dd;
  font-size: 14px;
  background: #ffffff;
  resize: vertical;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

#messageInput::placeholder {
  color: #9ca3af;
}

#messageInput:focus {
  border-color: #3c7cff;
  box-shadow: 0 0 0 1px rgba(60, 124, 255, 0.45);
  background: #ffffff;
}

/* Skeleton loader for textarea while generating */
.skeleton {
  position: relative;
  color: transparent !important; /* hide text while loading */
  background: linear-gradient(90deg, #f3f4f6 0%, #e6eef0 50%, #f3f4f6 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s linear infinite;
}
.skeleton::placeholder {
  color: transparent;
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

#textBox p {
  margin-top: 8px;
  font-size: 13px;
  color: #3e5046;
}

/* Tabellområde */
#tabell {
  margin-top: 10px;
}

/* Selve tabellen */
#wordTable {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  background: #fbfdfb;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dbe7dd;
}

#wordTable thead {
  background: #edf5ef;
}

#wordTable th,
#wordTable td {
  padding: 10px 12px;
  font-size: 14px;
  text-align: left;
}

#wordTable th {
  font-weight: 600;
  color: #223329;
  border-bottom: 1px solid #dbe7dd;
}

#wordTable tbody tr:nth-child(even) {
  background: #f4faf6;
}

#wordTable tbody tr:hover {
  background: #e1f2e7;
}

/* Knappeseksjon */
#buttons {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

#moods{
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

/* Felles knappestil */
#addRowBtn,
#sendSMSBtn,
#return,
#saveSMSBtn,
#generate, .mood {
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    transform 0.08s ease-out,
    box-shadow 0.08s ease-out,
    background-color 0.12s ease-out,
    color 0.12s ease-out;
}

/* Primærknapp (Save + Generate) */
#saveSMSBtn,
#generate {
  background: #133c28;
  color: #f7faf7;
  box-shadow: 0 10px 18px rgba(7, 24, 16, 0.32);
}
.mood{
  color: #f7faf7;
  background: #54b284;
  box-shadow: 0 10px 18px rgba(7, 24, 16, 0.32);
}
.mood.selected{
  color: #f7faf7;
  background: #133c28;
}
.mood{
  color: #f7faf7;
  background: #54b284;
}

#moods{
  margin-bottom: 10px;
}

/* Return-knapp */
#return {
  background: #d27a6a;
  color: #fefcfb;
  box-shadow: 0 10px 18px rgba(88, 32, 22, 0.3);
}

/* Send-knapp */
#sendSMSBtn {
  background: #2f855a;
  color: #f7faf7;
  box-shadow: 0 10px 18px rgba(15, 36, 25, 0.32);
}

/* Hover/active for de tre hovedknappene */
#sendSMSBtn:hover,
#return:hover,
#saveSMSBtn:hover,
#generate:hover, .mood:hover {
  background: #0f2419;
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(7, 24, 16, 0.4);
}

#sendSMSBtn:active,
#return:active,
#saveSMSBtn:active,
#generate:active, .mood:active{
  transform: translateY(0);
  box-shadow: 0 6px 10px rgba(7, 24, 16, 0.26);
}

/* Sekundærknapp (+ Add row) */
#addRowBtn {
  background: #e4ebe4;
  color: #14241d;
  box-shadow: 0 4px 8px rgba(7, 24, 16, 0.18);
}

#addRowBtn:hover {
  background: #d6e3d8;
  transform: translateY(-1px);
}

#addRowBtn:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(7, 24, 16, 0.22);
}

/* Responsiv justering på små skjermer */
@media (max-width: 768px) {
  body {
    padding: 20px;
    align-items: stretch;
  }

  #main {
    padding: 18px 16px 20px;
  }

  #main h1 {
    font-size: 22px;
  }
}

/* Telefon-ramme */
#phonePreview {
  flex-shrink: 0;
}

.phone-frame {
  width: 280px;
  height: 560px;
  border-radius: 40px;
  background: #020617;
  padding: 10px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.8),
    0 0 0 1px rgba(148, 163, 184, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Skjerm inni telefonen */
.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 32px;
  background: radial-gradient(circle at top, #0b1120 0, #020617 55%, #020617 100%);
  padding: 10px 10px 12px;
  display: flex;
  flex-direction: column;
  color: #e5e7eb;
  font-size: 12px;
}

/* Statusbar */
.phone-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 6px;
}

.phone-time {
  font-weight: 500;
}

.phone-status-dots {
  font-size: 8px;
}

/* Header i meldingsappen */
.phone-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.3);
  margin-bottom: 8px;
}

.phone-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: yellow;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #022c22;
}

.phone-header-text {
  display: flex;
  flex-direction: column;
}

.phone-title {
  font-size: 12px;
  font-weight: 600;
}

.phone-subtitle {
  font-size: 10px;
  opacity: 0.7;
}

/* Meldingsområdet */
.phone-messages {
  flex: 1;
  padding: 6px 2px 6px;
  overflow-y: auto;
}

/* Bobler */
.phone-bubble {
  display: inline-block;
  max-width: 80%;
  padding: 7px 9px;
  border-radius: 16px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.phone-bubble.system {
  background: rgba(15, 23, 42, 0.6);
  color: #e5e7eb;
  margin-left: auto;
  margin-right: auto;
  border-radius: 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  width: 100%;
}

.phone-bubble.user {
  background: #4f46e5;
  color: #f9fafb;
  margin-left: auto;
  margin-right: 4px;
  border-radius: 16px;
  border-bottom-left-radius: 4px; /* flyttet halen til venstre */
}


.phone-bubble.reply {
  background: #111827;
  color: #e5e7eb;
  margin-right: auto;
  margin-left: 4px;
  border-bottom-left-radius: 4px;
}

/* Input-linje nederst */
.phone-input-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  margin-top: 4px;
}

.phone-input-placeholder {
  flex: 1;
  font-size: 11px;
  color: #9ca3af;
  padding-left: 6px;
}

.phone-send {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #4f46e5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #022c22;
}

/* Juster layout på små skjermer */
@media (max-width: 900px) {
  #layout {
    flex-direction: column;
    align-items: center;
  }

  #phonePreview {
    margin-top: 24px;
  }
}

.inputField {
  width: 100%;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  font-size: 14px;
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.inputField:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.4);
}
