/* =============================================================
   ws-theme.css — WorkSupport 공통 디자인 시스템
   -------------------------------------------------------------
   · 서비스 전체(길라잡이 / 학사달력 / 시간표 / 신규기능)가
     동일한 색·간격·타이포·컴포넌트를 쓰도록 하는 단일 기준 파일.
   · 기존 클래스명(.btn .input .panel .table .topbar ...)도 함께
     재정의하여, 예전 화면도 자동으로 새 디자인을 따라간다.
   · 콘셉트: 밝고 부드러운 화이트 베이스 + 잔잔한 인디고 포인트
   ============================================================= */

/* ---------- 1. 디자인 토큰 ---------- */
:root{
  /* 브랜드 */
  --ws-primary:        #3f6fe4;
  --ws-primary-hover:  #3560cf;
  --ws-primary-soft:   #eaf0ff;
  --ws-primary-border: #c9daff;

  --ws-accent:         #16b3a0;   /* 민트 — 보조 강조 */
  --ws-accent-soft:    #e3f8f5;

  --ws-warn:           #e8912f;
  --ws-warn-soft:      #fff4e3;
  --ws-danger:         #e0524f;
  --ws-danger-soft:    #ffeceb;
  --ws-success:        #2fa06a;
  --ws-success-soft:   #e6f6ee;

  /* 중립 */
  --ws-bg:        #f6f8fc;
  --ws-surface:   #ffffff;
  --ws-surface-2: #fbfcff;
  --ws-line:      #e6eaf3;
  --ws-line-soft: #f0f3f9;

  --ws-text:      #1c2438;
  --ws-text-2:    #4a5468;
  --ws-muted:     #7c869c;
  --ws-disabled:  #aeb6c6;

  /* 타이포 */
  --ws-font: "Pretendard", "Noto Sans KR", -apple-system, BlinkMacSystemFont,
             "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
  --ws-fs-xs: 12px;
  --ws-fs-sm: 13px;
  --ws-fs-md: 14px;
  --ws-fs-lg: 16px;
  --ws-fs-xl: 20px;
  --ws-fs-2xl: 26px;

  /* 라운드 */
  --ws-r-sm: 8px;
  --ws-r-md: 12px;
  --ws-r-lg: 16px;
  --ws-r-xl: 20px;
  --ws-r-full: 999px;

  /* 그림자 — 옅고 넓게 */
  --ws-shadow-sm: 0 1px 2px rgba(28,36,56,.05);
  --ws-shadow:    0 2px 10px rgba(28,36,56,.06);
  --ws-shadow-md: 0 8px 24px rgba(28,36,56,.08);
  --ws-shadow-lg: 0 18px 48px rgba(28,36,56,.12);

  /* 간격 */
  --ws-gap-xs: 6px;
  --ws-gap-sm: 10px;
  --ws-gap:    16px;
  --ws-gap-lg: 24px;
  --ws-gap-xl: 32px;

  /* 레이아웃 */
  --ws-header-h: 60px;
  --ws-sidebar-w: 236px;
  --ws-sidebar-w-collapsed: 68px;
  --ws-container: 1280px;

  --ws-transition: .18s cubic-bezier(.4,0,.2,1);

  /* 레거시 변수 호환 (assets/app.css 를 쓰던 화면) */
  --bg: var(--ws-bg);
  --card: var(--ws-surface);
  --line: var(--ws-line);
  --txt: var(--ws-text);
  --muted: var(--ws-muted);
  --pri: var(--ws-primary);
  --danger: var(--ws-danger);
}

/* ---------- 2. 기본 ---------- */
*, *::before, *::after{ box-sizing: border-box; }

html{ -webkit-text-size-adjust: 100%; }

body{
  margin:0;
  font-family: var(--ws-font);
  font-size: var(--ws-fs-md);
  line-height: 1.55;
  color: var(--ws-text);
  background: var(--ws-bg);
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4{ margin:0; font-weight:700; letter-spacing:-.01em; color: var(--ws-text); }
h1{ font-size: var(--ws-fs-2xl); }
h2{ font-size: var(--ws-fs-xl); }
h3{ font-size: var(--ws-fs-lg); }
h4{ font-size: var(--ws-fs-md); }
p{ margin:0 0 var(--ws-gap-sm); }

a{ color: var(--ws-primary); text-decoration:none; }
a:hover{ text-decoration:underline; }

::selection{ background: var(--ws-primary-soft); }

/* 스크롤바 — 얇고 눈에 덜 띄게 */
.ws-scroll::-webkit-scrollbar,
.ws-main::-webkit-scrollbar,
.ws-table-wrap::-webkit-scrollbar{ width:10px; height:10px; }
.ws-scroll::-webkit-scrollbar-thumb,
.ws-main::-webkit-scrollbar-thumb,
.ws-table-wrap::-webkit-scrollbar-thumb{
  background:#d6dceb; border-radius: var(--ws-r-full); border:3px solid transparent; background-clip: content-box;
}
.ws-scroll::-webkit-scrollbar-thumb:hover,
.ws-main::-webkit-scrollbar-thumb:hover{ background:#bcc5da; background-clip: content-box; }

/* ---------- 3. 유틸 ---------- */
.ws-hidden, .hidden{ display:none !important; }
.ws-row{ display:flex; align-items:center; gap: var(--ws-gap-sm); flex-wrap:wrap; }
.ws-col{ display:flex; flex-direction:column; gap: var(--ws-gap-sm); }
.ws-spread{ display:flex; align-items:center; justify-content:space-between; gap: var(--ws-gap-sm); }
.ws-grow{ flex:1 1 auto; min-width:0; }
.ws-right{ margin-left:auto; }
.ws-muted, .muted{ color: var(--ws-muted); font-size: var(--ws-fs-sm); }
.ws-strong{ font-weight:700; }
.ws-truncate{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ws-center{ text-align:center; }
.ws-ta-r, .ta-r{ text-align:right; }
.ws-mt{ margin-top: var(--ws-gap); }
.ws-mt-sm{ margin-top: var(--ws-gap-sm); }

/* ---------- 4. 버튼 ---------- */
.ws-btn, .btn{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:38px; padding:0 14px;
  border:1px solid var(--ws-line);
  border-radius: var(--ws-r-md);
  background: var(--ws-surface);
  color: var(--ws-text);
  font-family: inherit; font-size: var(--ws-fs-md); font-weight:600;
  cursor:pointer; white-space:nowrap;
  transition: background var(--ws-transition), border-color var(--ws-transition),
              box-shadow var(--ws-transition), transform var(--ws-transition);
}
.ws-btn:hover, .btn:hover{ background: var(--ws-surface-2); border-color:#d3dbeb; }
.ws-btn:active, .btn:active{ transform: translateY(1px); }
.ws-btn:focus-visible, .btn:focus-visible{
  outline:none; box-shadow: 0 0 0 3px var(--ws-primary-soft), 0 0 0 1px var(--ws-primary);
}
.ws-btn:disabled, .btn:disabled{
  color: var(--ws-disabled); background: var(--ws-line-soft);
  border-color: var(--ws-line); cursor:not-allowed; transform:none;
}

.ws-btn--primary, .btn--primary{
  background: var(--ws-primary); border-color: var(--ws-primary); color:#fff;
  box-shadow: 0 1px 2px rgba(63,111,228,.28);
}
.ws-btn--primary:hover, .btn--primary:hover{ background: var(--ws-primary-hover); border-color: var(--ws-primary-hover); }

.ws-btn--soft{
  background: var(--ws-primary-soft); border-color: var(--ws-primary-border); color: var(--ws-primary-hover);
}
.ws-btn--soft:hover{ background:#dfe9ff; }

.ws-btn--ghost, .btn--ghost{ background: transparent; border-color: var(--ws-line); color: var(--ws-text-2); }
.ws-btn--ghost:hover, .btn--ghost:hover{ background: var(--ws-line-soft); }

.ws-btn--danger, .btn--danger{ background: var(--ws-danger); border-color: var(--ws-danger); color:#fff; }
.ws-btn--danger:hover, .btn--danger:hover{ filter: brightness(.95); }

.ws-btn--sm, .btn--sm{ height:30px; padding:0 10px; font-size: var(--ws-fs-sm); border-radius: var(--ws-r-sm); }
.ws-btn--lg{ height:46px; padding:0 22px; font-size: var(--ws-fs-lg); border-radius: var(--ws-r-lg); }
.ws-btn--block{ width:100%; }
.ws-btn--icon{ width:38px; padding:0; }

/* ---------- 5. 폼 ---------- */
.ws-field{ display:flex; flex-direction:column; gap:6px; margin-bottom: var(--ws-gap-sm); }
.ws-label, label{
  display:block; font-size: var(--ws-fs-sm); font-weight:600; color: var(--ws-text-2); margin:0;
}
.ws-help{ font-size: var(--ws-fs-xs); color: var(--ws-muted); }

.ws-input, .ws-select, .ws-textarea,
.input, input[type="text"], input[type="password"], input[type="number"],
input[type="date"], input[type="time"], input[type="email"], input[type="search"],
select, textarea{
  width:100%;
  min-height:38px;
  padding:8px 12px;
  border:1px solid var(--ws-line);
  border-radius: var(--ws-r-md);
  background: var(--ws-surface);
  color: var(--ws-text);
  font-family: inherit; font-size: var(--ws-fs-md); font-weight:500;
  transition: border-color var(--ws-transition), box-shadow var(--ws-transition);
}
.ws-input::placeholder, .input::placeholder, textarea::placeholder{ color: var(--ws-disabled); font-weight:400; }

.ws-input:focus, .ws-select:focus, .ws-textarea:focus,
.input:focus, input:focus, select:focus, textarea:focus{
  outline:none; border-color: var(--ws-primary);
  box-shadow: 0 0 0 3px var(--ws-primary-soft);
}
.ws-textarea, textarea{ min-height:96px; resize:vertical; line-height:1.6; }

.ws-select, select{
  appearance:none;
  background-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%237c869c' d='M6 8 0 0h12z'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 12px center;
  padding-right:32px;
}

.ws-check{ display:inline-flex; align-items:center; gap:8px; font-size: var(--ws-fs-md); cursor:pointer; }
.ws-check input{ width:16px; height:16px; min-height:0; accent-color: var(--ws-primary); cursor:pointer; }

/* ---------- 6. 카드 / 패널 ---------- */
.ws-card, .panel{
  background: var(--ws-surface);
  border:1px solid var(--ws-line);
  border-radius: var(--ws-r-lg);
  box-shadow: var(--ws-shadow);
  padding: var(--ws-gap);
}
.ws-card--flat{ box-shadow:none; }
.ws-card--soft{ background: var(--ws-surface-2); box-shadow:none; }

.ws-card__head, .panel__head{
  display:flex; align-items:center; justify-content:space-between;
  gap: var(--ws-gap-sm); flex-wrap:wrap;
  margin: -4px 0 var(--ws-gap);
}
.ws-card__title{ display:flex; align-items:center; gap:8px; font-size: var(--ws-fs-lg); font-weight:700; }
.ws-card__title .ws-ico{ font-size:18px; line-height:1; }
.ws-card__body{ min-height:0; }

.ws-section-title{
  display:flex; align-items:center; gap:8px;
  font-size: var(--ws-fs-lg); font-weight:700; margin-bottom: var(--ws-gap-sm);
}

/* ---------- 7. 배지 / 칩 ---------- */
.ws-badge, .badge, .pill{
  display:inline-flex; align-items:center; gap:4px;
  padding:3px 9px; border-radius: var(--ws-r-full);
  font-size: var(--ws-fs-xs); font-weight:700; line-height:1.5;
  background: var(--ws-line-soft); color: var(--ws-text-2); border:1px solid transparent;
}
.ws-badge--primary, .pill{ background: var(--ws-primary-soft); color: var(--ws-primary-hover); border-color: var(--ws-primary-border); }
.ws-badge--accent { background: var(--ws-accent-soft);  color:#0d7f71; }
.ws-badge--warn, .badge--notice{ background: var(--ws-warn-soft); color:#a4620d; border-color:#f6dcb8; }
.ws-badge--danger { background: var(--ws-danger-soft);  color:#b83b38; }
.ws-badge--success{ background: var(--ws-success-soft); color:#1d7a4e; }

.ws-chip{
  display:inline-flex; align-items:center; gap:6px;
  height:30px; padding:0 12px; border-radius: var(--ws-r-full);
  border:1px solid var(--ws-line); background:var(--ws-surface);
  font-size: var(--ws-fs-sm); font-weight:600; color: var(--ws-text-2);
  cursor:pointer; transition: all var(--ws-transition);
}
.ws-chip:hover{ border-color: var(--ws-primary-border); background: var(--ws-primary-soft); }
.ws-chip.is-active{ background: var(--ws-primary); border-color: var(--ws-primary); color:#fff; }

/* ---------- 8. 탭 ---------- */
.ws-tabs, .tabs{
  display:flex; gap:4px; flex-wrap:wrap;
  padding:4px; margin-bottom: var(--ws-gap);
  background: var(--ws-line-soft); border-radius: var(--ws-r-md);
}
.ws-tab, .tab{
  border:none; background:transparent;
  padding:8px 16px; border-radius: var(--ws-r-sm);
  font-family:inherit; font-size: var(--ws-fs-md); font-weight:600; color: var(--ws-muted);
  cursor:pointer; transition: all var(--ws-transition);
}
.ws-tab:hover, .tab:hover{ color: var(--ws-text); background: rgba(255,255,255,.7); }
.ws-tab.is-active, .tab.is-active{
  background: var(--ws-surface); color: var(--ws-primary);
  box-shadow: var(--ws-shadow-sm);
}

/* ---------- 9. 표 ---------- */
.ws-table-wrap, .tablewrap{
  overflow:auto; border:1px solid var(--ws-line); border-radius: var(--ws-r-md); background: var(--ws-surface);
}
.ws-table, .table{ width:100%; border-collapse:separate; border-spacing:0; font-size: var(--ws-fs-sm); }
.ws-table th, .table th{
  position:sticky; top:0; z-index:1;
  padding:11px 12px; text-align:left;
  font-size: var(--ws-fs-xs); font-weight:700; letter-spacing:.02em;
  color: var(--ws-muted); background: var(--ws-surface-2);
  border-bottom:1px solid var(--ws-line); white-space:nowrap;
}
.ws-table td, .table td{
  padding:11px 12px; border-bottom:1px solid var(--ws-line-soft);
  color: var(--ws-text-2); vertical-align:middle;
}
.ws-table tbody tr:last-child td, .table tbody tr:last-child td{ border-bottom:none; }
.ws-table tbody tr:hover td, .table tbody tr:hover td{ background: var(--ws-surface-2); }
.ws-table--clickable tbody tr{ cursor:pointer; }

/* ---------- 10. 빈 상태 / 로딩 ---------- */
.ws-empty{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
  padding: 44px 16px; text-align:center; color: var(--ws-muted);
}
.ws-empty__icon{ font-size:34px; opacity:.55; }
.ws-empty__title{ font-size: var(--ws-fs-md); font-weight:700; color: var(--ws-text-2); }
.ws-empty__desc{ font-size: var(--ws-fs-sm); }

.ws-skeleton{
  border-radius: var(--ws-r-sm);
  background: linear-gradient(90deg,#eef1f7 25%,#f7f9fc 37%,#eef1f7 63%);
  background-size: 400% 100%;
  animation: ws-shimmer 1.3s ease-in-out infinite;
}
@keyframes ws-shimmer{ 0%{background-position:100% 50%} 100%{background-position:0 50%} }

.ws-spinner{
  width:18px; height:18px; border-radius:50%;
  border:2px solid var(--ws-primary-border); border-top-color: var(--ws-primary);
  animation: ws-spin .7s linear infinite; display:inline-block;
}
@keyframes ws-spin{ to{ transform: rotate(360deg); } }

/* ---------- 11. 모달 ---------- */
.ws-modal-back, .modal-backdrop, .modalback{
  position:fixed; inset:0; z-index:1000;
  display:flex; align-items:center; justify-content:center; padding:16px;
  background: rgba(20,27,45,.42);
  backdrop-filter: blur(2px);
  opacity:0; visibility:hidden;
  transition: opacity var(--ws-transition), visibility var(--ws-transition);
}
.ws-modal-back.is-open, .modal-backdrop.show{ opacity:1; visibility:visible; }
.modalback{ opacity:1; visibility:visible; }

.ws-modal, .modal{
  width:min(680px, 96vw); max-height:88vh;
  display:flex; flex-direction:column;
  background: var(--ws-surface);
  border:1px solid var(--ws-line);
  border-radius: var(--ws-r-xl);
  box-shadow: var(--ws-shadow-lg);
  overflow:hidden;
  transform: translateY(10px) scale(.99);
  transition: transform var(--ws-transition);
}
.ws-modal-back.is-open .ws-modal, .modal-backdrop.show .modal{ transform:none; }
.ws-modal--sm{ width:min(440px,96vw); }
.ws-modal--lg{ width:min(940px,96vw); }

.ws-modal__head, .modal-header, .modal__head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:16px 20px; border-bottom:1px solid var(--ws-line);
}
.ws-modal__title, .modal-title, .modal__title{ font-size: var(--ws-fs-lg); font-weight:700; }
.ws-modal__body, .modal-body, .modal__body{ padding:20px; overflow:auto; flex:1 1 auto; }
.ws-modal__foot, .modal-footer, .modal__foot{
  display:flex; align-items:center; justify-content:flex-end; gap:8px;
  padding:14px 20px; border-top:1px solid var(--ws-line); background: var(--ws-surface-2);
}
.ws-icon-btn, .icon-btn{
  width:32px; height:32px; display:inline-flex; align-items:center; justify-content:center;
  border:none; border-radius: var(--ws-r-sm); background:transparent;
  color: var(--ws-muted); font-size:15px; cursor:pointer; transition: all var(--ws-transition);
}
.ws-icon-btn:hover, .icon-btn:hover{ background: var(--ws-line-soft); color: var(--ws-text); }

/* ---------- 12. 알림 ---------- */
.ws-alert{
  display:flex; align-items:flex-start; gap:10px;
  padding:12px 14px; border-radius: var(--ws-r-md);
  font-size: var(--ws-fs-sm); font-weight:500;
  border:1px solid transparent;
}
.ws-alert--info   { background: var(--ws-primary-soft); color:#2a4fa8; border-color: var(--ws-primary-border); }
.ws-alert--warn   { background: var(--ws-warn-soft);    color:#8f5709; border-color:#f6dcb8; }
.ws-alert--danger { background: var(--ws-danger-soft);  color:#a8332f; border-color:#f7cdcb; }
.ws-alert--success{ background: var(--ws-success-soft); color:#1a6a45; border-color:#c4e8d5; }

/* 토스트 */
.ws-toast-host{ position:fixed; right:18px; bottom:18px; z-index:2000; display:flex; flex-direction:column; gap:8px; }
.ws-toast{
  min-width:220px; max-width:340px;
  padding:12px 14px; border-radius: var(--ws-r-md);
  background:#20293e; color:#fff; font-size: var(--ws-fs-sm); font-weight:600;
  box-shadow: var(--ws-shadow-lg);
  animation: ws-toast-in .22s ease-out;
}
.ws-toast--danger { background:#b8403c; }
.ws-toast--success{ background:#1f7d54; }
@keyframes ws-toast-in{ from{ opacity:0; transform: translateY(8px); } to{ opacity:1; transform:none; } }

/* ---------- 13. 반응형 ----------
   기준 브레이크포인트
     · ~1279px  작은 데스크톱 / 큰 태블릿(가로)
     · ~1024px  태블릿 → 사이드 내비를 서랍(drawer)으로
     · ~768px   작은 태블릿(세로) / 큰 폰
     · ~480px   폰
------------------------------------------------- */

/* 태블릿 */
@media (max-width: 1024px){
  :root{ --ws-gap-lg: 20px; --ws-gap-xl: 24px; }
  .ws-grid--4{ grid-template-columns: repeat(2, minmax(0,1fr)); }
  .ws-grid--3{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* 큰 폰 / 작은 태블릿 */
@media (max-width: 768px){
  :root{ --ws-fs-2xl: 22px; --ws-fs-xl: 18px; --ws-gap-lg: 18px; }

  .ws-card, .panel{ padding: 14px; border-radius: var(--ws-r-md); }
  .ws-modal__body, .modal-body{ padding:16px; }
  .ws-modal__head, .modal-header{ padding:14px 16px; }
  .ws-modal__foot, .modal-footer{ padding:12px 16px; flex-wrap:wrap; }
  .ws-modal__foot .ws-btn{ flex:1 1 auto; }

  /* 모바일에서는 모달을 아래에서 올라오는 시트로 */
  .ws-modal-back, .modal-backdrop{ align-items:flex-end; padding:0; }
  .ws-modal, .modal{
    width:100%; max-width:none; max-height:92vh;
    border-radius: var(--ws-r-xl) var(--ws-r-xl) 0 0;
    transform: translateY(20px);
  }
  .ws-modal--sm, .ws-modal--lg{ width:100%; }

  /* 터치 영역 확보 */
  .ws-btn, .btn{ height:42px; padding:0 16px; }
  .ws-btn--sm, .btn--sm{ height:34px; padding:0 12px; }
  .ws-btn--icon{ width:42px; }
  .ws-input, .input, input, select, textarea{ min-height:42px; font-size:15px; } /* iOS 확대 방지 */
  .ws-check input{ width:20px; height:20px; }
  .ws-icon-btn, .icon-btn{ width:38px; height:38px; }
  .ws-tab, .tab{ padding:9px 14px; }

  /* 그리드는 모두 1열 */
  .ws-grid--2, .ws-grid--3, .ws-grid--4, .ws-grid--auto{ grid-template-columns: minmax(0,1fr); }

  /* 표는 가로 스크롤 허용 */
  .ws-table-wrap, .tablewrap{ -webkit-overflow-scrolling: touch; }
  .ws-table, .table{ min-width:520px; }

  /* 탭이 넘칠 때 가로 스크롤 */
  .ws-tabs, .tabs{ flex-wrap:nowrap; overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .ws-tabs::-webkit-scrollbar, .tabs::-webkit-scrollbar{ display:none; }
  .ws-tab, .tab{ flex:0 0 auto; }

  .ws-toast-host{ left:12px; right:12px; bottom:12px; }
  .ws-toast{ max-width:none; }
}

/* 폰 */
@media (max-width: 480px){
  :root{ --ws-fs-2xl: 20px; --ws-fs-xl: 17px; --ws-gap: 12px; --ws-gap-lg: 16px; }
  .ws-card, .panel{ padding:13px; }
  .ws-card__head, .panel__head{ margin-bottom:12px; }
  .ws-empty{ padding:32px 12px; }
}

/* 가로 모드(낮은 높이)에서는 시트를 전체 높이로 */
@media (max-width: 900px) and (orientation: landscape){
  .ws-modal, .modal{ max-height:96vh; }
}

/* 안전영역(노치) 대응 */
@supports (padding: max(0px)){
  @media (max-width: 768px){
    .ws-modal__foot, .modal-footer{ padding-bottom: max(12px, env(safe-area-inset-bottom)); }
    .ws-toast-host{ bottom: max(12px, env(safe-area-inset-bottom)); }
  }
}

/* 모션 최소화 선호 */
@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.01ms !important;
  }
}
