/* ============================================================
   ARCH.MSU — ระบบหนังสือขอความอนุเคราะห์
   Custom CSS — Architectural Minimalist Theme
   สร้างขึ้นใหม่ทั้งหมด | Bootstrap Responsive Compatible
   ============================================================ */

/* ---------- Google Font ---------- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;600;700&family=Kanit:wght@300;500;700&display=swap');

/* ---------- CSS Variables ---------- */
:root {
  --arch-black:      #1a1a1a;
  --arch-dark:       #2c2c2c;
  --arch-mid:        #4a4a4a;
  --arch-muted:      #8a8a8a;
  --arch-border:     #e2ddd3;
  --arch-bg:         #f7f4ee;
  --arch-white:      #ffffff;
  --arch-accent:     #9f7a23;
  --arch-accent2:    #7d4a1f;
  --arch-success:    #2f6b4f;
  --arch-input-bg:   #fdfcfa;
  --arch-shadow:     0 10px 30px rgba(30, 24, 16, 0.08);
  --arch-shadow-lg:  0 18px 55px rgba(30, 24, 16, 0.14);
  --arch-radius:     10px;
  --arch-radius-md:  12px;
  --font-thai:       'Sarabun', 'Kanit', sans-serif;
  --transition:      all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-thai);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  color: var(--arch-dark);
  background-color: var(--arch-bg);
  background-image:
    radial-gradient(circle at top left, rgba(159,122,35,0.14), transparent 34%),
    linear-gradient(135deg, #fbfaf7 0%, #efe8dc 100%);
  min-height: 100vh;
}

/* ---------- Page Wrapper ---------- */
#content {
  padding: 48px 0 64px;
}

.container-fluid {
  width: 90%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px;
}

/* ---------- Page Heading ---------- */
.page-heading {
  max-width: 760px;
  margin: 0 auto 22px;
  text-align: center;
}

.page-heading .eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 5px 14px;
  border: 1px solid rgba(159,122,35,0.28);
  border-radius: 999px;
  color: var(--arch-accent2);
  background: rgba(255,255,255,0.68);
  font-family: 'Kanit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.page-heading h1 {
  margin: 0;
  color: var(--arch-black);
  font-family: 'Kanit', sans-serif;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 600;
  line-height: 1.25;
}

.page-heading p:last-child {
  margin: 12px auto 0;
  max-width: 620px;
  color: var(--arch-mid);
  font-size: 15px;
}

/* ---------- Header Strip ---------- */
.widget-box {
  background: var(--arch-white);
  border: 1px solid rgba(226,221,211,0.92);
  border-radius: var(--arch-radius);
  box-shadow: var(--arch-shadow-lg);
  overflow: hidden;
  animation: slideUp 0.45s cubic-bezier(0.23, 1, 0.32, 1) both;
}

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

.widget-title {
  background: linear-gradient(135deg, #2c2418 0%, #1f1b16 100%);
  padding: 20px 30px;
  border-bottom: 1px solid rgba(159,122,35,0.45);
  position: relative;
  overflow: hidden;
}

.widget-title::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255,255,255,0.015) 10px,
    rgba(255,255,255,0.015) 20px
  );
  pointer-events: none;
}

.widget-title h4 {
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--arch-white);
  margin: 0;
}

.widget-title .icon {
  display: block;
  width: 100%;
}

/* ---------- Form Content Area ---------- */
.widget-content.nopadding {
  padding: 34px 38px 38px;
}

/* ---------- Form: Horizontal Layout ---------- */
.form-horizontal .control-group {
  display: flex;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 20px;
  padding: 18px;
  border: 1px solid rgba(226,221,211,0.78);
  border-radius: var(--arch-radius-md);
  background: rgba(253,252,250,0.62);
  transition: var(--transition);
}

.form-horizontal .control-group:last-child {
  margin-bottom: 0;
}

.form-horizontal .control-group:hover {
  border-color: rgba(159,122,35,0.42);
  box-shadow: var(--arch-shadow);
}

/* ---------- Labels ---------- */
.control-label {
  font-family: 'Kanit', sans-serif;
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--arch-mid);
  min-width: 190px;
  max-width: 190px;
  padding-top: 10px;
  text-align: right;
  flex-shrink: 0;
  position: relative;
}

.control-label::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--arch-accent);
  border-radius: 50%;
  margin-left: 8px;
  vertical-align: middle;
  opacity: 0.7;
}

/* ---------- Controls ---------- */
.controls,
.controls-row {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ---------- Inputs & Selects ---------- */
input[type="text"],
input[type="email"],
input[type="tel"],
select,
textarea {
  font-family: var(--font-thai);
  font-size: 14px;
  color: var(--arch-black);
  background: var(--arch-input-bg);
  border: 1px solid var(--arch-border);
  border-radius: var(--arch-radius-md);
  padding: 11px 14px;
  width: 100%;
  outline: none;
  transition: var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus,
textarea:focus {
  border-color: var(--arch-accent);
  background: var(--arch-white);
  box-shadow: 0 0 0 3px rgba(184,134,11,0.12);
}

input[type="text"]::placeholder,
input[type="tel"]::placeholder {
  color: var(--arch-muted);
  font-weight: 300;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8a8a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  cursor: pointer;
}

textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
}

/* ---------- Bootstrap span helpers (re-map to flex widths) ---------- */
.span2  { flex: 0 0 calc(16.666% - 4px);  max-width: calc(16.666% - 4px); }
.span3  { flex: 0 0 calc(25% - 6px);      max-width: calc(25% - 6px); }
.span5  { flex: 0 0 calc(41.666% - 4px);  max-width: calc(41.666% - 4px); }
.span6  { flex: 0 0 calc(50% - 4px);      max-width: calc(50% - 4px); }
.span9  { flex: 0 0 calc(75% - 4px);      max-width: calc(75% - 4px); }
.span11 { flex: 0 0 100%;                 max-width: 100%; }
.span12 { flex: 0 0 100%;                 max-width: 100%; }

/* ---------- Checkbox Group ---------- */
.options-group {
  align-items: flex-start;
}

.options-group .control-label {
  padding-top: 14px;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
  align-items: start;
}

.controls > div.span3 {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0;
}

.options-grid > .span3 {
  flex: none;
  max-width: none;
  width: 100%;
}

.controls > div.span3 label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--arch-dark);
  cursor: pointer;
  transition: var(--transition);
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 9px;
  line-height: 1.55;
}

.controls > div.span3 label:hover {
  color: var(--arch-accent2);
  background: rgba(184,134,11,0.05);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--arch-accent);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 3px;
}

.option-with-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.controls > div.span3 .option-with-input input[type="text"] {
  margin-top: 0;
  margin-left: 26px;
  width: calc(100% - 26px);
  font-size: 13px;
  padding: 9px 11px;
}

/* ---------- Submit Button ---------- */
.btn.btn-success.btn-large {
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: var(--arch-white);
  background: linear-gradient(135deg, var(--arch-success) 0%, #24523c 100%);
  border: none;
  border-radius: var(--arch-radius-md);
  padding: 15px 28px;
  width: 100%;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 8px 20px rgba(47,107,79,0.28);
}

.btn.btn-success.btn-large::before {
  content: '▶  ';
  font-size: 11px;
  letter-spacing: 0;
  opacity: 0.7;
}

.btn.btn-success.btn-large:hover {
  background: linear-gradient(135deg, #24523c 0%, #1d4231 100%);
  box-shadow: 0 10px 26px rgba(47,107,79,0.36);
  transform: translateY(-1px);
}

.btn.btn-success.btn-large:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(58,107,53,0.3);
}

/* ---------- Row-fluid ---------- */
.row-fluid {
  width: 100%;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--arch-bg); }
::-webkit-scrollbar-thumb { background: var(--arch-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--arch-accent); }

/* ============================================================
   RESPONSIVE — Bootstrap-compatible breakpoints
   ============================================================ */

/* ---- Tablet (≤ 991px) ---- */
@media (max-width: 991px) {
  .container-fluid {
    width: 100%;
    max-width: 100%;
    padding: 0 16px;
  }

  .widget-content.nopadding {
    padding: 24px 20px 28px;
  }

  .control-label {
    min-width: 140px;
    max-width: 140px;
    font-size: 13px;
  }

  .span2  { flex: 0 0 calc(20% - 4px); max-width: calc(20% - 4px); }
  .span6  { flex: 0 0 calc(55% - 4px); max-width: calc(55% - 4px); }
  .span9  { flex: 0 0 calc(78% - 4px); max-width: calc(78% - 4px); }
}

/* ---- Mobile (≤ 767px) ---- */
@media (max-width: 767px) {
  #content {
    padding: 16px 0 40px;
  }

  .container-fluid {
    padding: 0 10px;
  }

  .widget-title {
    padding: 16px 18px;
  }

  .widget-title h4 {
    font-size: 13.5px;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .widget-content.nopadding {
    padding: 18px 14px 22px;
  }

  /* Stack label above input on mobile */
  .form-horizontal .control-group {
    flex-direction: column;
    gap: 6px;
  }

  .control-label {
    min-width: unset;
    max-width: unset;
    text-align: left;
    padding-top: 0;
    font-size: 13px;
  }

  .control-label::after {
    display: none;
  }

  .controls,
  .controls-row {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .options-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  /* Full width all span* on mobile */
  .span2,
  .span3,
  .span5,
  .span6,
  .span9,
  .span11,
  .span12 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Row with select + input: keep side by side */
  .controls-row {
    flex-direction: row;
  }

  .controls-row .span2 {
    flex: 0 0 110px;
    max-width: 110px;
  }

  .controls-row .span9 {
    flex: 1;
    max-width: unset;
  }

  .controls-row .span6 {
    flex: 1;
    max-width: unset;
  }

  .controls-row .span5 {
    flex: 1;
    max-width: unset;
  }

  /* Checkbox columns: stack */
  .controls > div.span3 {
    flex: 0 0 100%;
    max-width: 100%;
    border-bottom: 1px dashed var(--arch-border);
    padding-bottom: 10px;
    margin-bottom: 4px;
  }

  .controls > div.span3:last-child {
    border-bottom: none;
  }

  .btn.btn-success.btn-large {
    font-size: 14px;
    padding: 13px 20px;
  }
}

/* ---- Small Mobile (≤ 420px) ---- */
@media (max-width: 420px) {
  .widget-title h4 {
    font-size: 12.5px;
  }

  .control-label {
    font-size: 12.5px;
  }

  input[type="text"],
  input[type="tel"],
  select,
  textarea {
    font-size: 13.5px;
    padding: 8px 11px;
  }
}

/* ---------- Language switch (TH / EN) ---------- */
.lang-switch {
  margin-top: 14px;
  font-size: 14px;
  color: var(--arch-mid);
}

.lang-switch a {
  color: var(--arch-accent2);
  text-decoration: none;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
  transition: var(--transition);
}

.lang-switch a:hover {
  color: var(--arch-accent);
  background: rgba(159, 122, 35, 0.12);
}

.lang-switch a.is-active {
  color: var(--arch-dark);
  pointer-events: none;
  cursor: default;
}

.lang-switch .lang-sep {
  margin: 0 6px;
  color: var(--arch-muted);
  font-weight: 400;
}

html[lang="en"] .page-heading h1,
html[lang="en"] .control-label {
  letter-spacing: 0.01em;
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  body {
    background: white;
    background-image: none;
  }

  .widget-box {
    box-shadow: none;
    border: 1px solid #ccc;
  }

  .btn {
    display: none;
  }

}
