/* =========================
   Variables
========================= */
:root{
  --sidebar-w: 230px;
  --sidebar-w-collapsed: 78px;
}

/* =========================
   Base
========================= */
html, body{
  overflow-x: hidden; /* กันล้นขวาทั้งระบบ */
}

.navbar{ position: sticky; top:0; z-index: 1070; }

body{
  font-family: "Google Sans","Noto Sans Thai",system-ui,-apple-system,"Segoe UI",sans-serif;
  background: #f7f8fb;
}

/* =========================
   Sidebar
========================= */
.sidebar{
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  position: sticky;
  top: 0;
  background: #fff;
  overflow-y: auto;
  z-index: 1040;
}

.sidebar .loc-text{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================
   Content
========================= */
.content-wrap{
  padding: 16px;
  width: 100%;
  max-width: 100%;
}

/* =========================
   Sidebar active location
========================= */
.sidebar-locs .list-group-item{
  position: relative;
  border: 0;
  border-radius: 0;
  color: #333;
}

.sidebar-locs .list-group-item:hover{
  background: rgba(13,110,253,.06);
}

.sidebar .sidebar-locs .list-group-item.active-loc{
  background: rgba(13,110,253,.12);
  font-weight: 600;
  color: #0d6efd;
}

.sidebar .sidebar-locs .list-group-item.active-loc::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: #0d6efd;
  border-radius: 0 4px 4px 0;
}

/* =========================
   Desktop: Collapsed
========================= */
.sidebar-collapsed .sidebar{
  width: var(--sidebar-w-collapsed);
  min-width: var(--sidebar-w-collapsed);
}

.sidebar-collapsed .sidebar .loc-text{ display:none; }
.sidebar-collapsed .sidebar .list-group-item{ justify-content:center; }

/* =========================
   Mobile Sidebar
========================= */
.sidebar-close{ display:none; }

@media (max-width: 991.98px){

  .sidebar{
    position: fixed;
    top: 0;
    left: calc(var(--sidebar-w) * -1);
    height: 100vh;
    transition: left .2s ease;
    z-index: 1060;
  }

  body.sidebar-open .sidebar{ left:0; }

  body.sidebar-open::before{
    content:"";
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1055;
  }

  .sidebar-close{
    display: inline-flex;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    align-items: center;
    justify-content: center;
    z-index: 1070;
  }
}

/* =========================
   Card
========================= */
.card{
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 8px 26px rgba(0,0,0,.05);
}

/* =========================
   Hero
========================= */
.hero-card{
  border-radius: 22px;
  background:
    radial-gradient(900px 220px at 20% 0%, rgba(13,110,253,.10), transparent 60%),
    radial-gradient(700px 240px at 100% 20%, rgba(32,201,151,.12), transparent 55%),
    #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
  overflow: hidden;
}

.hero-inner{
  padding: 22px;
  display: flex;
  gap: 18px;
}

.hero-left{
  flex: 1 1 auto;
  min-width: 0; /* กันข้อความดัน layout */
}

.hero-title{ font-weight: 800; }

/* ✅ FIX หลัก: ไม่ดันจอในมือถือ */
.hero-sub{
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 991.98px){
  .hero-inner{ flex-direction: column; }

  .hero-sub{
    white-space: normal;      /* มือถือขึ้นบรรทัด */
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
  }
}

/* =========================
   Place Cards
========================= */
.place-card{
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 10px 26px rgba(0,0,0,.05);
}

.place-media{
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f1f3f5;
}

.place-media img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.place-body{
  padding: 14px 14px 16px;
  min-width: 0; /* กันข้อความดัน */
}

.place-title{
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* fallback เมื่อไม่มีรูป */
.place-card.img-missing .place-media::after{
  content: "ยังไม่มีรูปสถานที่";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(0,0,0,.45);
  font-weight: 800;
}

/* =========================
   FullCalendar (clean & unified)
========================= */

/* base */
.fc, .fc * { box-sizing: border-box; }
.fc{
  max-width: 100%;
  --fc-border-color: rgba(0,0,0,.08);
  --fc-today-bg-color: rgba(13,110,253,.06);
}

/* grid & border */
.fc .fc-scrollgrid,
.fc .fc-scrollgrid td,
.fc .fc-scrollgrid th{
  border-color: rgba(0,0,0,.08);
}

/* header (อา. จ. ...) */
.fc .fc-col-header-cell{
  background: rgba(0,0,0,.02);
}
.fc .fc-col-header-cell-cushion{
  padding: 2px 4px;
  font-weight: 700;
  color: rgba(0,0,0,.70);
  text-decoration: none;
}

/* day number */
.fc .fc-daygrid-day-number{
  padding: 2px 4px;
  font-weight: 700;
  color: rgba(13,110,253,.95);
  text-decoration: none;
}

/* today cell */
.fc .fc-day-today{
  background: rgba(13,110,253,.06) !important;
}

/* =========================
   Buttons
========================= */
.fc .fc-button{
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,.15);
  background: #f8f9fa;
  color: #212529;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
  transition: all .15s ease;
}

/* hover */
.fc .fc-button:hover{
  background: #e9ecef;
  color: #000;
  border-color: rgba(0,0,0,.35);
}

/* focus / active */
.fc .fc-button:focus,
.fc .fc-button:active{
  background: #dee2e6;
  color: #000;
  border-color: rgba(0,0,0,.45);
  box-shadow: none;
}

/* active view (month/week/day) */
.fc .fc-button-primary.fc-button-active{
  background: rgba(13,110,253,.15);
  border-color: rgba(13,110,253,.45);
  color: #0d6efd;
}

/* today button */
.fc .fc-today-button{
  background: rgba(13,110,253,.12);
  border-color: rgba(13,110,253,.35);
  color: #0d6efd;
  font-weight: 700;
}
.fc .fc-today-button:hover{
  background: rgba(13,110,253,.20);
  border-color: rgba(13,110,253,.55);
  color: #0b5ed7;
}

/* segmented button group */
.fc .fc-button-group .fc-button{
  box-shadow: none;
  border-radius: 0;
}
.fc .fc-button-group .fc-button:first-child{
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
.fc .fc-button-group .fc-button:last-child{
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* =========================
   Events
========================= */
.fc .fc-daygrid-event{
  border-radius: 10px;
  padding: 2px 6px;
  font-size: 11px;
  border: 0;
  box-shadow: 0 6px 16px rgba(0,0,0,.06);
}

/* =========================
   Mobile only
========================= */
@media (max-width: 576px){

  .fc{ font-size: 12px; }

  .fc .fc-toolbar{
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
  }

  .fc .fc-toolbar-chunk{
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }

  .fc .fc-button{
    padding: .28rem .55rem;
    font-size: 12px;
  }

  .fc .fc-toolbar-title{
    font-size: 16px;
    font-weight: 900;
    letter-spacing: .2px;
    color: rgba(0,0,0,.80);
    white-space: normal;
  }

  .fc .fc-daygrid-day-frame{
    min-height: 72px;
  }
}

/* force width */
.fc .fc-view-harness,
.fc .fc-scrollgrid,
.fc table{
  width: 100% !important;
}
