/* =========================================================
 *
 *  comm.css
 *  Premium Responsive Board UI
 *  - PC: 고급 테이블형 게시판
 *  - Mobile: 카드형 게시판
 *  - Search / Toast / Tooltip / Admin table 포함
 *
 * ========================================================= */


/* ================================
   Global small reset
================================ */

label {
  display: inline-block !important;
  width: auto;
}

img {
  display: inline-block !important;
  width: auto;
  max-width: 100%;
}

a {
  display: inline-block;
  color: inherit;
  text-decoration: none;
}

a:hover,
a:focus,
a:active {
  text-decoration: none;
}


/* ================================
   Premium Design Tokens
================================ */

:root {
  --bb-page-bg: #f8fafc;

  --bb-bg: #ffffff;
  --bb-surface: rgba(255, 255, 255, 0.96);
  --bb-surface-soft: #f9fafb;

  --bb-head: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
  --bb-head-solid: #f7f9fc;

  --bb-text: #0f172a;
  --bb-text-soft: #334155;
  --bb-muted: #64748b;
  --bb-muted-2: #94a3b8;

  --bb-line: rgba(15, 23, 42, 0.10);
  --bb-line-soft: rgba(15, 23, 42, 0.07);
  --bb-line-strong: rgba(15, 23, 42, 0.16);

  --bb-accent: #2563eb;
  --bb-accent-dark: #1d4ed8;
  --bb-accent-soft: rgba(37, 99, 235, 0.08);
  --bb-accent-soft-2: rgba(37, 99, 235, 0.13);

  --bb-success: #16a34a;
  --bb-danger: #dc2626;
  --bb-warning: #f59e0b;

  --bb-radius-sm: 10px;
  --bb-radius: 16px;
  --bb-radius-lg: 20px;

  --bb-shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --bb-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --bb-shadow-hover: 0 18px 46px rgba(15, 23, 42, 0.13);

  --bb-focus: 0 0 0 4px rgba(37, 99, 235, 0.18);

  --bb-font-size: 15px;
  --bb-font-size-sm: 13px;
}


/* ================================
   Form controls
================================ */

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
select,
textarea {
  -webkit-tap-highlight-color: transparent;
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;

  width: 100%;
  min-height: 38px;
  padding: 0 12px;

  border-radius: 10px;
  border: 1px solid var(--bb-line);
  background: #ffffff;
  color: var(--bb-text);

  font-size: inherit;
  line-height: 1.4;
  vertical-align: middle;

  outline: none;
  box-shadow: none;

  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    background-color .18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: var(--bb-focus);
}

input:invalid,
select:invalid,
textarea:invalid {
  box-shadow: none;
}


/* ================================
   Board Search Area
================================ */

.bbs-search-tablebox {
  width: auto;
  margin: 0 0 14px auto;
  border-collapse: separate;
  border-spacing: 8px 0;
}

.bbs-search-tablebox td,
.bbs-search-tablebox th {
  padding: 0 !important;
  vertical-align: middle;
}

.bbs-search-options {
  height: 42px !important;
  min-width: 120px;
  padding: 0 36px 0 14px !important;

  border-radius: 12px !important;
  border: 1px solid var(--bb-line) !important;
  background:
    #ffffff
    linear-gradient(180deg, rgba(255,255,255,1), rgba(248,250,252,.9));

  color: var(--bb-text-soft);
  font-size: 14px;
  font-weight: 600;

  cursor: pointer;
}

.bbs-search-input {
  height: 42px !important;
  min-width: 240px;

  border-radius: 12px !important;
  border: 1px solid var(--bb-line) !important;
  background: #ffffff;

  color: var(--bb-text);
  font-size: 14px;
  text-align: left !important;
}

.bbs-search-input::placeholder {
  color: var(--bb-muted-2);
}

.bbs-search-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;

  height: 42px;
  min-width: 74px;
  padding: 0 18px;

  border-radius: 12px;
  border: 1px solid var(--bb-accent);
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;

  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.2px;

  cursor: pointer;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);

  transition:
    transform .18s ease,
    box-shadow .18s ease,
    background .18s ease;
}

.bbs-search-btn:hover {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.30);
  transform: translateY(-1px);
}

.bbs-search-btn:active {
  transform: translateY(0);
  box-shadow: 0 5px 12px rgba(37, 99, 235, 0.20);
}


/* ================================
   Base table reset
================================ */

table {
  width: 100%;
  border: 0;
}

td,
th {
  vertical-align: middle;
  font-weight: normal;
}


/* =========================================================
   Main Board Table : .bbstable
========================================================= */

.bbstable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;

  background: var(--bb-surface);
  border: 1px solid var(--bb-line);
  border-radius: var(--bb-radius-lg);
  overflow: hidden;

  color: var(--bb-text);
  box-shadow: var(--bb-shadow);

  backdrop-filter: blur(8px);
}

/* header */
.bbstable thead {
  background: var(--bb-head-solid);
}

.bbstable th {
  height: 54px;
  padding: 0 14px;

  background: var(--bb-head);
  color: var(--bb-text-soft);

  text-align: center;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.3px;

  border-bottom: 1px solid var(--bb-line);
  border-right: 1px solid var(--bb-line-soft);

  white-space: nowrap;
}

.bbstable th:last-child {
  border-right: 0;
}

/* body */
.bbstable tbody tr {
  background: #ffffff;
  transition:
    background-color .18s ease,
    box-shadow .18s ease;
}

.bbstable tbody tr:nth-child(even) {
  background: rgba(248, 250, 252, 0.72);
}

.bbstable td {
  height: 54px;
  padding: 10px 14px;

  color: var(--bb-text);
  text-align: center;
  font-size: var(--bb-font-size);
  font-weight: 500;
  letter-spacing: -0.25px;

  border-bottom: 1px solid var(--bb-line-soft);
  border-right: 1px solid var(--bb-line-soft);

  box-sizing: border-box;
}

.bbstable td:last-child {
  border-right: 0;
}

.bbstable tbody tr:last-child td {
  border-bottom: 0;
}

/* hover */
.bbstable tbody tr:hover {
  background: rgba(37, 99, 235, 0.035);
}

.bbstable tbody tr:hover td {
  color: #0f172a;
}

/* title cell */
.bbstable td.displayblock {
  text-align: left !important;
  font-weight: 700;
}

.bbstable td.displayblock a {
  display: inline;
  max-width: 100%;
  color: var(--bb-text);
}

.bbstable td.displayblock a:hover {
  color: var(--bb-accent);
}

/* 일반 링크 */
.bbstable a {
  color: inherit;
  text-decoration: none;
}

.bbstable a:hover {
  color: var(--bb-accent);
  text-decoration: none;
}

/* 첨부 아이콘 */
.bbstable img {
  vertical-align: middle;
}

/* 조회수 같은 작은 정보 */
.bbstable td.actions,
.bbstable td.comma,
.bbstable td.notcomma {
  color: var(--bb-text-soft);
}

/* 공지사항 행 */
.bbstable tr.notice-title {
  position: relative;
  background:
    linear-gradient(90deg, rgba(37,99,235,.10) 0%, rgba(255,255,255,.98) 52%, rgba(255,255,255,.98) 100%);
}

.bbstable tr.notice-title td {
  font-weight: 700;
}

.bbstable tr.notice-title td:first-child {
  position: relative;
}

.bbstable tr.notice-title td:first-child:before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 4px;
  border-radius: 999px;
  background: var(--bb-accent);
}

/* 공지 텍스트 */
.bbstable tr.notice-title span {
  font-weight: 800;
}

/* focus */
.bbstable :is(a, button, input, select, textarea):focus {
  outline: none;
}

.bbstable :is(a, button, input, select, textarea):focus-visible {
  box-shadow: var(--bb-focus);
  border-radius: 8px;
}


/* =========================================================
   Mobile Card Board
========================================================= */

@media (max-width: 640px) {

  .bbs-search-tablebox,
  .bbs-search-tablebox tbody,
  .bbs-search-tablebox tr,
  .bbs-search-tablebox td,
  .bbs-search-tablebox th {
    display: block;
    width: 100%;
  }

  .bbs-search-tablebox {
    margin-bottom: 14px;
    border-spacing: 0;
  }

  .bbs-search-tablebox td,
  .bbs-search-tablebox th {
    padding-bottom: 8px !important;
  }

  .bbs-search-options,
  .bbs-search-input,
  .bbs-search-btn {
    width: 100% !important;
    min-width: 100% !important;
  }

  .bbstable {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    background: transparent;
    backdrop-filter: none;
  }

  .bbstable thead,
  .bbstable colgroup {
    display: none;
  }

  .bbstable tbody {
    display: block;
  }

  .bbstable tbody tr {
    display: block;

    margin: 12px 0;
    padding: 0;

    background: #ffffff;
    border: 1px solid var(--bb-line);
    border-radius: 18px;
    overflow: hidden;

    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  }

  .bbstable tbody tr:nth-child(even) {
    background: #ffffff;
  }

  .bbstable tbody tr:hover {
    background: #ffffff;
  }

  .bbstable tr.notice-title {
    border-color: rgba(37, 99, 235, 0.22);
    background: #ffffff;
    box-shadow: 0 14px 32px rgba(37, 99, 235, 0.11);
  }

  .bbstable tr.notice-title:before {
    content: "공지";
    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin: 14px 14px 0;
    height: 26px;
    padding: 0 10px;

    border-radius: 999px;
    background: rgba(37, 99, 235, 0.10);
    color: var(--bb-accent);

    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.2px;
  }

  .bbstable td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    min-height: 42px;
    height: auto;
    padding: 10px 14px;

    border-right: 0;
    border-bottom: 1px solid var(--bb-line-soft);

    text-align: right;
    font-size: 14px;
    color: var(--bb-text-soft);
  }

  .bbstable td:last-child {
    border-bottom: 0;
  }

  .bbstable td::before {
    content: attr(data-label);
    flex: 0 0 auto;

    color: var(--bb-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.2px;
    white-space: nowrap;
  }

  /* 숨김 컬럼 */
  .bbstable td.displaynone {
    display: none !important;
  }

  /* 제목 컬럼 */
  .bbstable td.displayblock {
    display: block;
    padding: 15px 14px 13px;

    text-align: left !important;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.45;

    color: var(--bb-text);
    background:
      linear-gradient(180deg, rgba(248,250,252,.85), rgba(255,255,255,1));
  }

  .bbstable td.displayblock::before {
    display: none;
  }

  .bbstable td.displayblock a {
    display: -webkit-box;
    width: 100%;

    color: var(--bb-text);

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .bbstable td.displayblock a:hover {
    color: var(--bb-accent);
  }

  .bbstable td img {
    max-height: 24px;
  }
}


/* =========================================================
   Admin / Form Table : .bbsmaintable
========================================================= */

.bbsmaintable {
  --ax-head-bg: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
  --ax-head-bd: rgba(15, 23, 42, 0.14);
  --ax-row-bd: rgba(15, 23, 42, 0.09);
  --ax-v-bd: rgba(15, 23, 42, 0.09);
  --ax-text: #0f172a;
  --ax-head-t: #334155;
  --ax-muted: #64748b;
  --ax-accent: #2563eb;
  --ax-hover: rgba(37, 99, 235, 0.035);
  --ax-radius: 18px;
  --ax-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);

  width: 100%;
  table-layout: fixed;
  color: var(--ax-text);
  background: #ffffff;
  border-collapse: collapse;
}

.tRadius {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--ax-radius);
  overflow: hidden;
  border: 1px solid var(--ax-v-bd);
  box-shadow: var(--ax-shadow);
}

.bbsmaintable th,
.bbsmaintable td {
  font-size: 15px;
  text-align: center;
  vertical-align: middle;
  line-height: 1.45;
}

.bbsmaintable thead th {
  padding: 13px 12px;

  background: var(--ax-head-bg);
  color: var(--ax-head-t);

  font-weight: 800;
  letter-spacing: -0.25px;

  border-bottom: 1px solid var(--ax-head-bd);
}

.bbsmaintable tbody td {
  padding: 12px 12px;
  background: #ffffff;
  color: var(--ax-text);
}

.bbsmaintable tbody tr + tr td {
  border-top: 1px solid var(--ax-row-bd);
}

.bbsmaintable thead th + th,
.bbsmaintable tbody td + td {
  border-left: 1px solid var(--ax-v-bd);
}

.bbsmaintable thead th:first-child,
.bbsmaintable tbody td:first-child,
.bbsmaintable tfoot td:first-child {
  border-left: 1px solid var(--ax-v-bd);
}

.bbsmaintable thead th:last-child,
.bbsmaintable tbody td:last-child,
.bbsmaintable tfoot td:last-child {
  border-right: 1px solid var(--ax-v-bd);
}

.bbsmaintable tfoot td {
  padding: 10px 12px;
  border-top: 1px solid var(--ax-row-bd);
  border-left: 1px solid var(--ax-v-bd);
  background: #f8fafc;
  color: var(--ax-muted);
}

.bbsmaintable a {
  color: inherit;
  text-decoration: none;
}

.bbsmaintable a:hover {
  color: var(--ax-accent);
}

.bbsmaintable :is(a, button, input, select, textarea):focus {
  outline: none;
}

.bbsmaintable :is(a, button, input, select, textarea):focus-visible {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
  border-radius: 8px;
}

.bg-fff {
  background: #ffffff !important;
}


/* ================================
   Loading
================================ */

.khloading-container,
.khloading {
  width: 100px;
  height: 100px;
  position: relative;
  border-radius: 100%;
}

.khloading-container {
  margin: 25% auto;
}

.khloading {
  border: 2px solid transparent;
  border-color: transparent #ffffff transparent #ffffff;
  animation: rotate-loading 1.5s linear infinite;
  transform-origin: 50% 50%;
}

.khloading-container:hover .khloading {
  border-color: transparent var(--bb-accent) transparent var(--bb-accent);
}

#khloading-text {
  animation: loading-text-opacity 2s linear infinite;
  color: #ffffff;
  font-size: 1em;
  font-weight: 800;
  margin-top: 45px;
  opacity: 0;
  position: absolute;
  text-align: center;
  text-transform: uppercase;
  top: 0;
  width: 100px;
}

@keyframes rotate-loading {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

@keyframes loading-text-opacity {
  0% {
    opacity: 1;
  }

  20% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}


/* ================================
   Tooltip
================================ */

[data-tooltip] {
  position: relative;
}

[data-tooltip]:before,
[data-tooltip]:after {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  z-index: 9999;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  transition: all .18s ease;
  pointer-events: none;
}

[data-tooltip]:before {
  content: attr(data-tooltip);
  top: -34px;
  height: auto;
  min-height: 28px;
  padding: 7px 10px;

  border-radius: 10px;
  background: #0f172a;
  color: #ffffff;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.2px;

  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

[data-tooltip]:after {
  content: "";
  top: -8px;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 7px solid #0f172a;
}

[data-tooltip]:not([data-tooltip=""]):hover:before,
[data-tooltip]:not([data-tooltip=""]):hover:after {
  visibility: visible;
  opacity: 1;
}


/* ================================
   Toast
================================ */

#toast-container {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;

  width: calc(100% - 32px);
  max-width: 360px;
  text-align: center;
}

.toast {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 42px;
  padding: 11px 16px;
  margin: 8px auto;

  border-radius: 999px;
  background: rgba(15, 23, 42, 0.94);
  color: #ffffff;

  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;

  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.28);

  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  animation: toast-animation .28s forwards;
}

@keyframes toast-animation {
  0% {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }

  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-hide {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
}


/* ================================
   Small screen refine
================================ */

@media (max-width: 767px) {
  :root {
    --bb-radius: 14px;
    --bb-radius-lg: 16px;
  }

  .bbstable {
    box-shadow: none;
  }

  .bbsmaintable th,
  .bbsmaintable td {
    font-size: 14px;
    padding: 10px 8px;
  }
}


/* ================================
   Reduced motion
================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}