/* ===========================================
   Royal Blessing — ลงนามถวายพระพร
   WordPress Plugin Styles
   =========================================== */

.rb-wrapper {
  --rb-gold: #b8943e;
  --rb-gold-light: #d4af5a;
  --rb-gold-dark: #8a6d2b;
  --rb-gold-bg: #fdf8ed;
  --rb-gold-bg2: #f9f0d8;
  --rb-navy: #1a2744;
  --rb-navy-light: #2a3d66;
  --rb-cream: #fefcf6;
  --rb-text: #2c2a24;
  --rb-text-sec: #6b6660;
  --rb-text-muted: #a09a90;
  --rb-border: #e8e2d4;
  --rb-radius: 12px;
  --rb-radius-sm: 8px;
  --rb-shadow: 0 2px 12px rgba(0,0,0,0.05);

  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  color: var(--rb-text);
  line-height: 1.7;
  max-width: 780px;
  margin: 0 auto;
  padding: 0;
}

.rb-wrapper *, .rb-wrapper *::before, .rb-wrapper *::after {
  box-sizing: border-box;
}

/* ---- Header ---- */

.rb-header {
  background: linear-gradient(170deg, var(--rb-navy) 0%, var(--rb-navy-light) 50%, #344a7a 100%);
  padding: 2.5rem 2rem 2.75rem;
  text-align: center;
  border-radius: var(--rb-radius) var(--rb-radius) 0 0;
  position: relative;
  overflow: hidden;
}

.rb-header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(184,148,62,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 20% 100%, rgba(184,148,62,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 60% 80% at 80% 100%, rgba(184,148,62,0.06) 0%, transparent 50%);
  pointer-events: none;
}

.rb-header-ornament {
  position: absolute;
  top: 0;
  width: 120px;
  height: 100%;
  pointer-events: none;
  opacity: 0.07;
}

.rb-ornament-left {
  left: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(184,148,62,1) 8px,
    rgba(184,148,62,1) 9px
  );
}

.rb-ornament-right {
  right: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(184,148,62,1) 8px,
    rgba(184,148,62,1) 9px
  );
}

.rb-header-image {
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.rb-header-image img {
  max-height: 140px;
  width: auto;
  border-radius: 8px;
  border: 2px solid rgba(184,148,62,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.rb-header-emblem {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.75rem;
  color: var(--rb-gold-light);
  position: relative;
  z-index: 1;
}

.rb-header-emblem svg {
  width: 100%;
  height: 100%;
}

.rb-title {
  color: #fff;
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 0.25rem;
  position: relative;
  z-index: 1;
  text-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.rb-subtitle {
  color: rgba(255,255,255,0.65);
  font-size: 1.45rem;
  font-weight: 300;
  margin: 0;
  position: relative;
  z-index: 1;
}

.rb-header-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--rb-gold-light), transparent);
  margin: 1.25rem auto 0;
  border-radius: 2px;
  position: relative;
  z-index: 1;
}

/* ---- Form ---- */

.rb-form-section {
  background: var(--rb-cream);
  border-left: 1px solid var(--rb-border);
  border-right: 1px solid var(--rb-border);
  padding: 1.75rem;
}

.rb-form {
  background: #fff;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  padding: 1.5rem;
  box-shadow: var(--rb-shadow);
}

.rb-form-heading {
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--rb-text);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rb-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.rb-form-heading::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--rb-gold), var(--rb-gold-dark));
  border-radius: 3px;
  flex-shrink: 0;
}

.rb-form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 540px) {
  .rb-form-row {
    flex-direction: column;
    gap: 1rem;
  }
}

.rb-field {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.rb-field-grow {
  flex: 1;
  margin-bottom: 0;
}

.rb-field label {
  display: block;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--rb-text-sec);
  margin-bottom: 6px;
}

.rb-req {
  color: #c0392b;
}

.rb-field input,
.rb-field select,
.rb-field textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius-sm);
  font-family: inherit;
  font-size: 1.4rem;
  color: var(--rb-text);
  background: #fff;
  transition: border-color 0.25s, box-shadow 0.25s;
  outline: none;
  -webkit-appearance: none;
}

.rb-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%236b6660' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.rb-field input:focus,
.rb-field select:focus,
.rb-field textarea:focus {
  border-color: var(--rb-gold);
  box-shadow: 0 0 0 3px rgba(184,148,62,0.12);
}

.rb-field input::placeholder,
.rb-field textarea::placeholder {
  color: var(--rb-text-muted);
  font-weight: 300;
}

.rb-field textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.7;
}

.rb-form-actions {
  padding-top: 0.25rem;
}

.rb-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 200px;
  padding: 12px 32px;
  background: linear-gradient(135deg, var(--rb-gold-dark) 0%, var(--rb-gold) 50%, var(--rb-gold-light) 100%);
  color: #fff;
  border: none;
  border-radius: var(--rb-radius-sm);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.25s, filter 0.25s;
  box-shadow: 0 2px 8px rgba(184,148,62,0.25);
  letter-spacing: 0.01em;
}

.rb-submit-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 4px 16px rgba(184,148,62,0.3);
}

.rb-submit-btn:active {
  transform: scale(0.97);
}

.rb-submit-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: none;
}

/* ---- Status ---- */

.rb-status {
  margin-top: 1rem;
  padding: 0;
  font-size: 0.9rem;
  border-radius: var(--rb-radius-sm);
  display: none;
}

.rb-status.rb-success {
  display: block;
  padding: 12px 16px;
  background: #eaf5ee;
  color: #1a6b4e;
  border: 1px solid #c4e4d0;
}

.rb-status.rb-error {
  display: block;
  padding: 12px 16px;
  background: #fdf0ef;
  color: #c0392b;
  border: 1px solid #f0c5c1;
}

/* ---- Messages ---- */

.rb-messages-section {
  background: var(--rb-cream);
  border-left: 1px solid var(--rb-border);
  border-right: 1px solid var(--rb-border);
  padding: 0 1.75rem 1.75rem;
}

.rb-messages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

.rb-messages-title {
  font-family: 'Noto Sans Thai', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--rb-text);
}

.rb-messages-count {
  background: var(--rb-gold-bg);
  color: var(--rb-gold-dark);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  border: 1px solid rgba(184,148,62,0.2);
}

/* Message Card */

.rb-msg {
  background: #fff;
  border: 1px solid var(--rb-border);
  border-radius: var(--rb-radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.65rem;
  transition: box-shadow 0.2s;
  animation: rbFadeUp 0.4s ease both;
}

.rb-msg:hover {
  box-shadow: 0 3px 14px rgba(0,0,0,0.05);
}

@keyframes rbFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rb-msg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.rb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.82rem;
  flex-shrink: 0;
  border: 1.5px solid rgba(184,148,62,0.2);
}

.rb-msg-info { flex: 1; min-width: 0; }

.rb-msg-name {
  font-weight: 600;
  font-size: 0.93rem;
  color: var(--rb-text);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rb-msg-meta {
  font-size: 0.78rem;
  color: var(--rb-text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rb-msg-meta .rb-dot {
  width: 3px;
  height: 3px;
  background: var(--rb-text-muted);
  border-radius: 50%;
  display: inline-block;
}

.rb-msg-body {
  font-size: 0.93rem;
  color: var(--rb-text-sec);
  line-height: 1.75;
  padding-left: 52px;
  margin: 0;
}

/* Loading */

.rb-loading {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--rb-text-muted);
  font-size: 0.9rem;
}

.rb-loading-spinner {
  width: 28px;
  height: 28px;
  margin: 0 auto 0.75rem;
  border: 3px solid var(--rb-border);
  border-top-color: var(--rb-gold);
  border-radius: 50%;
  animation: rbSpin 0.8s linear infinite;
}

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

.rb-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--rb-text-muted);
  font-size: 0.93rem;
}

/* ---- Footer ---- */

.rb-footer {
  background: var(--rb-cream);
  border: 1px solid var(--rb-border);
  border-top: none;
  border-radius: 0 0 var(--rb-radius) var(--rb-radius);
  text-align: center;
  padding: 1.25rem 2rem 1.5rem;
}

.rb-footer-line {
  width: 50px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--rb-gold), transparent);
  margin: 0 auto 1rem;
}

.rb-footer p {
  color: var(--rb-gold-dark);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: 'Noto Sans Thai', sans-serif;
  margin: 0;
  letter-spacing: 0.02em;
}

.rb-btn-text {
  font-size: 1.4rem
}

