/* ============================================================
   HR System — Leave Request
   main.css
   ============================================================ */

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

:root {
  --vanilla:    #FFF7E5;
  --vanilla-dk: #F0E6CC;
  --rouge:      #D52122;
  --rouge-dk:   #B01A1B;
  --rouge-lt:   rgba(213,33,34,.08);
  --ink:        #1A0A0A;
  --muted:      #8A6A6A;
  --border:     rgba(213,33,34,.14);
  --border-sd:  rgba(213,33,34,.22);
  --shadow-sm:  0 2px 8px rgba(213,33,34,.07);
  --shadow-md:  0 6px 24px rgba(213,33,34,.11);
  --shadow-lg:  0 16px 48px rgba(213,33,34,.16);
  --r-card:     1.5rem;
  --r-btn:      .875rem;
  --r-input:    .75rem;
}

html, body { min-height: 100%; }
body {
  font-family: 'Sora', sans-serif;
  background: var(--vanilla);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* BG deco */
body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 92% -5%, rgba(213,33,34,.12) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at -8% 105%, rgba(213,33,34,.07) 0%, transparent 55%);
  pointer-events: none; z-index: 0;
}

.page-wrap {
  position: relative; z-index: 1;
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding-bottom: 5rem;
}

/* ── Banner ── */
.page-banner {
  width: 100%;
  background: var(--rouge);
  padding: 1.75rem 1.5rem 3.75rem;
  position: relative;
  overflow: hidden;
}
.page-banner::after {
  content: '';
  position: absolute; bottom: -1px; left: 0; right: 0; height: 2.25rem;
  background: var(--vanilla);
  border-radius: 2rem 2rem 0 0;
}
.banner-circle-1 {
  position: absolute; top: -50px; right: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  border: 45px solid rgba(255,247,229,.06); pointer-events: none;
}
.banner-circle-2 {
  position: absolute; bottom: 20px; left: -35px;
  width: 110px; height: 110px; border-radius: 50%;
  border: 28px solid rgba(255,247,229,.05); pointer-events: none;
}
.banner-circle-3 {
  position: absolute; top: 30px; right: 90px;
  width: 60px; height: 60px; border-radius: 50%;
  border: 14px solid rgba(255,247,229,.04); pointer-events: none;
}

.banner-inner {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  display: flex; align-items: flex-start; justify-content: space-between;
}
.banner-label {
  font-size: .58rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,247,229,.5);
  margin-bottom: .4rem;
}
.banner-title {
  font-size: 1.6rem; font-weight: 800; letter-spacing: -.035em;
  color: var(--vanilla); line-height: 1.1;
}
.banner-sub {
  font-size: .68rem; color: rgba(255,247,229,.55);
  margin-top: .35rem; font-weight: 500;
}
.banner-icon {
  width: 2.75rem; height: 2.75rem;
  background: rgba(255,247,229,.12);
  border: 1px solid rgba(255,247,229,.18);
  border-radius: .875rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: .15rem;
}
.banner-icon svg { width: 20px; height: 20px; stroke: var(--vanilla); }

/* ── Card ── */
.main-card {
  width: 100%; max-width: 480px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-md);
  overflow: visible;
  margin: -2rem auto 0;
  position: relative; z-index: 2;
  padding: .25rem 1.5rem 1.75rem;
}

/* ── Section label ── */
.section-label {
  display: flex; align-items: center; gap: .5rem;
  font-size: .58rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--rouge);
  margin: 1.5rem 0 .875rem;
}
.section-label::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(to right, var(--border-sd), transparent);
}
.s-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--rouge); flex-shrink: 0;
}

/* ── Layout helpers ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .875rem; }
.mb { margin-bottom: .875rem; }

/* ── Field ── */
.field { display: flex; flex-direction: column; }
.field-label {
  font-size: .62rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .35rem;
  display: flex; justify-content: space-between; align-items: center;
}

/* ── Input base ── */
.fi {
  width: 100%; height: 42px;
  background: var(--vanilla);
  border: 1.5px solid var(--border);
  border-radius: var(--r-input);
  padding: 0 .875rem;
  font-family: 'Sora', sans-serif;
  font-size: .8rem; font-weight: 500;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.fi::placeholder { color: var(--muted); font-weight: 400; }
.fi:focus { border-color: var(--rouge); box-shadow: 0 0 0 3px rgba(213,33,34,.1); background: #fff; }
.fi:disabled { opacity: .55; cursor: not-allowed; }
.fi[readonly] { background: var(--vanilla-dk); color: var(--muted); cursor: default; }
textarea.fi { height: auto; min-height: 84px; padding: .75rem .875rem; resize: none; line-height: 1.55; }
select.fi { cursor: pointer; }
input[type="date"].fi { cursor: pointer; }
input[type="date"].fi::-webkit-calendar-picker-indicator {
  opacity: .35; cursor: pointer;
  filter: invert(18%) sepia(80%) saturate(2000%) hue-rotate(340deg);
}

/* ── Loading shimmer ── */
.shimmer {
  background: linear-gradient(90deg, var(--vanilla) 25%, var(--vanilla-dk) 50%, var(--vanilla) 75%) !important;
  background-size: 200% 100% !important;
  animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Select chevron ── */
.sel-wrap { position: relative; }
.sel-wrap .chev {
  position: absolute; right: .75rem; top: 50%;
  transform: translateY(-50%); pointer-events: none;
  width: 14px; height: 14px; stroke: var(--muted);
}

/* ── NIP mono ── */
.nip-wrap { position: relative; }
.nip-hash {
  position: absolute; left: .875rem; top: 50%; transform: translateY(-50%);
  font-size: .7rem; font-weight: 700; color: var(--rouge);
  pointer-events: none; font-family: 'DM Mono', monospace;
}
#nipInput { padding-left: 2.25rem; font-family: 'DM Mono', monospace; font-size: .82rem; letter-spacing: .04em; }

/* ── Autocomplete dropdown ── */
.search-wrap { position: relative; }
#suggestionBox {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff;
  border: 1.5px solid var(--border-sd);
  border-radius: var(--r-input);
  box-shadow: var(--shadow-lg);
  max-height: 13rem; overflow-y: auto;
  z-index: 9999;
}
#suggestionBox::-webkit-scrollbar { width: 4px; }
#suggestionBox::-webkit-scrollbar-thumb { background: var(--vanilla-dk); border-radius: 4px; }
.dd-item {
  padding: .65rem .875rem;
  font-size: .8rem; font-weight: 500; cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  transition: background .1s, color .1s;
}
.dd-item:last-child { border-bottom: none; }
.dd-item:hover { background: var(--rouge-lt); color: var(--rouge); }
.dd-nip { font-family: 'DM Mono', monospace; font-size: .64rem; color: var(--muted); }

/* ── Days badge ── */
.days-wrap { position: relative; }
.days-badge {
  position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  font-size: .62rem; font-weight: 700;
  color: var(--rouge); background: var(--rouge-lt);
  border-radius: .375rem; padding: .15rem .5rem; pointer-events: none;
}

/* ── File upload area ── */
.file-area {
  border: 1.5px dashed var(--border-sd);
  border-radius: var(--r-input);
  padding: .875rem 1rem;
  display: flex; align-items: center; gap: .875rem;
  cursor: pointer; position: relative;
  background: var(--vanilla);
  transition: border-color .15s, background .15s;
}
.file-area:hover { border-color: var(--rouge); background: var(--rouge-lt); }
.file-area input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-ico {
  width: 2.1rem; height: 2.1rem; flex-shrink: 0;
  background: var(--rouge-lt); border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
}
.file-ico svg { width: 15px; height: 15px; stroke: var(--rouge); }
.file-main { font-size: .78rem; font-weight: 600; }
.file-sub  { font-size: .63rem; color: var(--muted); margin-top: .1rem; }

/* ── Toggle ── */
.toggle-input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-slider {
  display: block; width: 36px; height: 20px;
  background: #ddd; border-radius: 10px; position: relative;
  cursor: pointer; transition: background .2s;
}
.toggle-slider::after {
  content: ''; position: absolute;
  width: 14px; height: 14px; top: 3px; left: 3px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle-input:checked + .toggle-slider { background: var(--rouge); }
.toggle-input:checked + .toggle-slider::after { transform: translateX(16px); }

/* ── Submit button ── */
.submit-btn {
  width: 100%; height: 50px; margin-top: 1.5rem;
  background: var(--rouge); color: var(--vanilla);
  border: none; border-radius: var(--r-btn);
  font-family: 'Sora', sans-serif;
  font-size: .875rem; font-weight: 700;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  box-shadow: 0 4px 18px rgba(213,33,34,.35);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.submit-btn:hover { background: var(--rouge-dk); box-shadow: 0 6px 24px rgba(213,33,34,.42); }
.submit-btn:active { transform: scale(.99); }
.submit-btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.submit-btn svg { width: 16px; height: 16px; }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Overlay / Modal ── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(26,10,10,.5);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 1.5rem;
}
.overlay.show { display: flex; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-box {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-card);
  width: 100%; max-width: 380px;
  padding: 2rem; box-shadow: var(--shadow-lg);
  text-align: center;
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.modal-ico {
  width: 3.75rem; height: 3.75rem; border-radius: 50%;
  background: var(--rouge-lt);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
}
.modal-ico svg { width: 30px; height: 30px; stroke: var(--rouge); }
.modal-title { font-size: 1.1rem; font-weight: 800; letter-spacing: -.025em; }
.modal-sub { font-size: .7rem; color: var(--muted); margin-top: .25rem; }

.modal-actions { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.25rem; }
.btn-ok {
  width: 100%; height: 44px; background: var(--rouge); color: var(--vanilla);
  border: none; border-radius: var(--r-btn);
  font-family: 'Sora', sans-serif; font-size: .85rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .4rem;
  transition: background .15s;
}
.btn-ok:hover { background: var(--rouge-dk); }
.btn-new {
  width: 100%; height: 44px; background: var(--rouge-lt); color: var(--rouge);
  border: none; border-radius: var(--r-btn);
  font-family: 'Sora', sans-serif; font-size: .85rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .4rem;
  transition: background .15s;
}
.btn-new:hover { background: rgba(213,33,34,.13); }

/* ── Global loading overlay ── */
#globalLoading {
  position: fixed; inset: 0;
  background: rgba(26,10,10,.5);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1100; padding: 1.5rem;
}
.load-card {
  background: #fff; border-radius: 1.25rem;
  padding: 2rem; text-align: center;
  box-shadow: var(--shadow-lg); min-width: 220px;
}
.load-spin {
  width: 3rem; height: 3rem;
  border: 3px solid var(--rouge-lt);
  border-top-color: var(--rouge);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  margin: 0 auto 1rem;
}
.load-lbl { font-size: .78rem; font-weight: 600; color: var(--muted); }

/* ── Toast ── */
#toast {
  position: fixed; top: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--vanilla);
  border-radius: .875rem; padding: .7rem 1.25rem;
  font-size: .78rem; font-weight: 600;
  display: flex; align-items: center; gap: .5rem;
  box-shadow: var(--shadow-lg); z-index: 1200;
  min-width: 180px; max-width: 320px;
  animation: toastIn .25s ease;
}
#toast.hidden { display: none; }
#toast.error  { background: var(--rouge); }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ── File area error state ── */
.file-area.input-error {
  border-color: var(--rouge) !important;
  background: rgba(213,33,34,.04) !important;
  animation: errorShake .3s ease;
}

/* ── Input error state ── */
.fi.input-error {
  border-color: var(--rouge) !important;
  background: rgba(213,33,34,.04) !important;
  box-shadow: 0 0 0 3px rgba(213,33,34,.12);
  animation: errorShake .3s ease;
}
@keyframes errorShake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  60%      { transform: translateX(5px); }
}

/* ── Utility ── */
.hidden { display: none !important; }
