:root {
  --bg-color: #FAF6F0;
  --card-bg: #FFFDF9;
  --text-dark: #2D1A13;
  --text-muted: #5D4037;
  --border-color: #E6D5C3;
  --btn-gradient-1: #3E2723;
  --btn-gradient-2: #8D6E63;
  --font-family: 'Plus Jakarta Sans', sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto; /* Allows smooth scrolling if card expands */
  padding: 40px 20px;
}

/* Background Cookies - Locked to viewport & non-blocking */
.bg-cookie {
  position: fixed;
  width: 40vw;
  max-width: 350px;
  min-width: 200px;
  z-index: 0;
  opacity: 0.6;
  pointer-events: none; /* Prevents background elements from blocking input clicks */
}

.bg-cookie.top-left {
  top: -8%;
  left: -8%;
  transform: rotate(-15deg);
}

.bg-cookie.bottom-right {
  bottom: -8%;
  right: -8%;
  transform: rotate(25deg);
}

/* Main Card */
.card {
  position: relative;
  z-index: 1;
  background: var(--card-bg);
  border: 2px solid var(--border-color);
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  padding: 36px 28px;
  box-shadow: 0 12px 40px rgba(93, 64, 55, 0.08);
  overflow: hidden;
}

/* Card Edge SVG Cookie Details */
.card-edge {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50px;
  pointer-events: none;
  z-index: 0;
}

.card-edge.top { top: 0; }
.card-edge.bottom { bottom: 0; }

.edge-cookie {
  position: absolute;
  width: 46px;
  height: 46px;
}

.edge-cookie.e1 { left: 10px; top: -23px; }
.edge-cookie.e2 { right: 15px; top: -15px; }
.edge-cookie.e3 { left: -15px; bottom: -15px; }
.edge-cookie.e4 { right: 10px; bottom: -23px; }

/* Header */
.card-header {
  text-align: center;
  margin-bottom: 24px;
  position: relative;
  z-index: 2;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
}

.title-icon {
  font-size: 1.8rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

/* Form Styles */
form {
  position: relative;
  z-index: 2;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
}

.input-wrapper, .textarea-wrapper {
  position: relative;
  width: 100%;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: #A68A7C;
  pointer-events: none;
}

input {
  width: 100%;
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 14px 14px 44px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  transition: border-color 0.2s ease;
  outline: none;
}

textarea {
  width: 100%;
  background: #FFFFFF;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text-dark);
  resize: none; /* Prevents breaking card layout on resize */
  transition: border-color 0.2s ease;
  outline: none;
}

input:focus, textarea:focus {
  border-color: #A68A7C;
}

input::placeholder, textarea::placeholder {
  color: #BCAAA4;
  font-weight: 500;
}

/* Mini Overlapping Cookies */
.mini-cookie {
  position: absolute;
  width: 28px;
  height: 28px;
  pointer-events: none;
  z-index: 3;
}

.mini-cookie.m1 {
  top: -12px;
  right: 12px;
  transform: rotate(15deg);
}

.mini-cookie.m2 {
  bottom: 12px;
  right: -10px;
  transform: rotate(-20deg);
}

/* Button */
button {
  width: 100%;
  background: linear-gradient(90deg, var(--btn-gradient-1) 0%, var(--btn-gradient-2) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: 25px;
  padding: 15px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 6px;
  box-shadow: 0 4px 15px rgba(62, 39, 35, 0.2);
}

button:hover {
  transform: translateY(-2deg);
  box-shadow: 0 6px 20px rgba(62, 39, 35, 0.3);
}

button:active {
  transform: translateY(0);
}

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

/* Spinner Loader */
.loader {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

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

/* Status Messages */
.status-box {
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.status-box.success { color: #2E7D32; }
.status-box.error { color: #C62828; }

/* Sent Logs Section */
#sent-logs-section {
  position: relative;
  z-index: 2;
  margin-top: 20px;
  animation: fadeIn 0.3s ease-out;
}

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

.log-divider {
  height: 2px;
  background: var(--border-color);
  margin: 0 0 14px 0;
  border-radius: 2px;
  opacity: 0.6;
}

.log-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
}

.log-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 130px;
  overflow-y: auto;
  padding-right: 4px;
}

.log-container::-webkit-scrollbar {
  width: 5px;
}
.log-container::-webkit-scrollbar-track {
  background: rgba(230, 213, 195, 0.3);
  border-radius: 10px;
}
.log-container::-webkit-scrollbar-thumb {
  background: #C4B0A0;
  border-radius: 10px;
}

.log-item {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  box-shadow: 0 2px 6px rgba(93, 64, 55, 0.03);
}

.log-sender {
  font-weight: 700;
  color: var(--btn-gradient-2);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.log-message {
  color: var(--text-muted);
  line-height: 1.35;
  word-break: break-word;
}

.hidden { display: none !important; }

/* Footer */
.footer-text {
  margin-top: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  z-index: 1;
}