/* ============================================
   Meeting Room Calendar - Weekly View Styles
   v5.0 - Unified CI Color: #1a3a6b (Navy Blue)
   Aligned with Register Auditorium Calendar
   ============================================ */

/* --- Color Variables --- */
:root {
  --mrc-primary:               #1a3a6b;
  --mrc-primary-dark:          #0f2548;
  --mrc-primary-light:         #2062b8;
  --mrc-primary-lighter:       #2868a8;
  --mrc-primary-bg:            #eef3fb;
  --mrc-primary-bg-hover:      #ddeaf8;
  --mrc-primary-border:        #b3cce8;
  --mrc-primary-faint:         #f4f7fc;
  --mrc-booking-gradient-start: #2062b8;
  --mrc-booking-gradient-mid:   #1a3a6b;
  --mrc-booking-gradient-end:   #2868a8;
  --mrc-booking-border:         #0d2d55;

  /* Proceed (pending/waiting) — Amber/Yellow */
  --mrc-proceed-gradient-start: #b45309;
  --mrc-proceed-gradient-mid:   #d97706;
  --mrc-proceed-gradient-end:   #f59e0b;
  --mrc-proceed-border:         #92400e;

  /* Today highlight */
  --mrc-today-badge: #f5a623;

  /* Page background (matches auditorium wrapper) */
  --mrc-page-bg: #f5f2ec;
}

/* --- Base --- */
.mrc-calendar-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 0.5rem;
  font-family: 'Sarabun', 'Noto Sans Thai', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1e293b;
  background: var(--mrc-page-bg);
  min-height: 100vh;
  box-sizing: border-box;
}

.mrc-calendar-wrapper *,
.mrc-calendar-wrapper *::before,
.mrc-calendar-wrapper *::after {
  box-sizing: border-box;
}

/* ==============================
   Navigation Bar
   ============================== */
.mrc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 14px 20px;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  gap: 0.75rem;
}

.mrc-nav__title {
  text-align: center;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.mrc-nav__title h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--mrc-primary);
  line-height: 1.4;
}

.mrc-nav__btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  background: var(--mrc-primary);
  color: #ffffff !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s ease;
  white-space: nowrap;
}

.mrc-nav__btn:hover {
  background: var(--mrc-primary-dark);
  color: #ffffff !important;
  text-decoration: none !important;
}

.mrc-nav__today {
  display: inline-block;
  padding: 3px 18px;
  background: #ffffff;
  color: var(--mrc-primary) !important;
  text-decoration: none !important;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1.5px solid var(--mrc-primary);
  transition: background 0.2s ease;
}

.mrc-nav__today:hover {
  background: var(--mrc-primary-bg);
  color: var(--mrc-primary-dark) !important;
  text-decoration: none !important;
}

/* ==============================
   Calendar Grid
   ============================== */
.mrc-grid {
  overflow-x: hidden;
  border-radius: 14px;
  border: none;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.07);
  background: #ffffff;
}

/* ==============================
   Table
   ============================== */
.mrc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
  min-width: 0;
}

.mrc-table__corner {
  width: 72px;
  min-width: 72px;
  background: var(--mrc-primary);
  font-size: 0.85rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 10px 4px 8px;
  text-align: center;
  border-bottom: 2px solid var(--mrc-primary-dark);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  left: 0;
  z-index: 3;
}

/* ==============================
   Day Headers
   ============================== */
.mrc-table__day-header {
  padding: 10px 4px 8px;
  text-align: center;
  background: var(--mrc-primary);
  border-bottom: 2px solid var(--mrc-primary-dark);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
  color: #ffffff;
  user-select: none;
}

.mrc-table__day-header:last-child {
  border-right: none;
}

.mrc-table__day-header--today {
  background: var(--mrc-primary-light);
  border-bottom: 2px solid var(--mrc-primary-dark);
}

/* Weekend header — darker muted tone (matches auditorium #243a5e) */
.mrc-table__day-header--weekend {
  background: #243a5e;
}

.mrc-table__day-header--weekend .mrc-day-label {
  color: rgba(255, 255, 255, 0.55);
}

.mrc-table__day-header--weekend .mrc-day-number {
  color: rgba(255, 255, 255, 0.85);
}

.mrc-table__day-header--weekend .mrc-day-month {
  color: rgba(255, 255, 255, 0.45);
}

/* Weekend + Today combo */
.mrc-table__day-header--weekend.mrc-table__day-header--today {
  background: #2d3f5e;
  border-bottom: 2px solid var(--mrc-primary-dark);
}

.mrc-day-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 2px;
  opacity: 0.85;
}

.mrc-table__day-header--today .mrc-day-label {
  color: rgba(255, 255, 255, 0.8);
}

.mrc-day-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
}

.mrc-table__day-header--today .mrc-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--mrc-today-badge);
  color: var(--mrc-primary);
  font-size: 1.1rem;
}

.mrc-day-month {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 1px;
  opacity: 0.8;
}

.mrc-table__day-header--today .mrc-day-month {
  color: rgba(255, 255, 255, 0.8);
}

/* ==============================
   Time Column
   ============================== */
.mrc-table__time {
  width: 72px;
  min-width: 72px;
  padding: 4px 8px 0 0;
  font-size: 0.76rem;
  font-weight: 500;
  color: #999;
  text-align: right;
  background: #ffffff;
  border-right: 1px solid #d0d0d0;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: top;
  position: sticky;
  left: 0;
  z-index: 2;
  line-height: 1;
}

/* ==============================
   Table Cells
   ============================== */
.mrc-table__cell {
  border-right: 1px solid #e5e5e5;
  border-bottom: 1px solid #e8e8e8;
  height: 44px;
  padding: 0;
  vertical-align: top;
  position: relative;
  transition: background 0.15s ease;
}

.mrc-table__cell:last-child {
  border-right: none;
}

.mrc-table__cell--free:hover {
  background: var(--mrc-primary-faint);
}

.mrc-table__cell--today {
  background: #f7fafc;
}

/* Weekend cell — light gray tint (matches auditorium #f0f0f0) */
.mrc-table__cell--weekend.mrc-table__cell--free {
  background: #f0f0f0;
}

.mrc-table__row:nth-child(even) .mrc-table__cell--weekend.mrc-table__cell--free {
  background: #eaebee;
}

.mrc-table__cell--weekend.mrc-table__cell--free:hover {
  background: #e4e5e9;
}

/* ==============================
   Booked Cell — Absolute Fill
   ============================== */
.mrc-table__cell--booked {
  position: relative;
  padding: 0;
  background: transparent;
  border-bottom-color: #e8e8e8;
}

/* Stack wrapper */
.mrc-booking-stack {
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mrc-booking {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 5px;
  overflow: hidden;
  cursor: default;
  transition: box-shadow 0.2s ease;

  /* CI Navy gradient — matches auditorium event-approved-main */
  background: linear-gradient(170deg,
    var(--mrc-booking-gradient-start) 0%,
    var(--mrc-booking-gradient-end) 100%);
  color: #ffffff;
  border-left: 3px solid var(--mrc-booking-border);
  box-shadow: 0 2px 8px rgba(26, 58, 107, 0.25);
}

.mrc-booking:hover {
  box-shadow: 0 4px 16px rgba(26, 58, 107, 0.35);
}

/* Confirmed — same as default */
.mrc-booking--confirmed {
  background: linear-gradient(170deg,
    var(--mrc-booking-gradient-start) 0%,
    var(--mrc-booking-gradient-end) 100%);
  border-left-color: var(--mrc-booking-border);
}

/* Proceed (pending/waiting — amber/yellow) */
.mrc-booking--proceed {
  background: linear-gradient(170deg,
    var(--mrc-proceed-gradient-start) 0%,
    var(--mrc-proceed-gradient-end) 100%);
  border-left-color: var(--mrc-proceed-border);
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.25);
  color: #ffffff;
}

.mrc-booking--proceed:hover {
  box-shadow: 0 4px 16px rgba(180, 83, 9, 0.4);
}

/* Inner content */
.mrc-booking__inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
  padding: 5px 7px 4px 7px;
  min-height: 0;
  overflow: hidden;
}

.mrc-booking__title {
  font-weight: 700;
  font-size: 0.76rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.mrc-booking__author {
  font-size: 0.68rem;
  font-weight: 500;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 1px;
}

.mrc-booking__time {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  opacity: 0.92;
  white-space: nowrap;
  flex-shrink: 0;
}

.mrc-booking__time::before {
  content: '\1F552';
  font-size: 0.68rem;
  line-height: 1;
}

/* ==============================
   Legend
   ============================== */
.mrc-legend {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 14px;
  padding: 14px 20px;
  background: #ffffff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  font-size: 0.85rem;
  color: #444;
  flex-wrap: wrap;
}

.mrc-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mrc-legend__color {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid #ccc;
  flex-shrink: 0;
}

.mrc-legend__color--free {
  background: #ffffff;
  border-color: #ccc;
}

.mrc-legend__color--confirmed {
  background: linear-gradient(170deg, var(--mrc-primary-light), var(--mrc-primary));
  border-left: 3px solid var(--mrc-booking-border);
}

.mrc-legend__color--proceed {
  background: linear-gradient(170deg, var(--mrc-proceed-gradient-start), var(--mrc-proceed-gradient-end));
  border-left: 3px solid var(--mrc-proceed-border);
}

.mrc-legend__color--weekend {
  background: #f0f0f0;
  border-color: #ccc;
}

/* ==============================
   Responsive - Tablet
   ============================== */
@media (max-width: 900px) {
  .mrc-table__corner,
  .mrc-table__time {
    width: 52px;
    min-width: 52px;
    font-size: 0.68rem;
  }

  .mrc-nav__btn {
    padding: 8px 12px;
    font-size: 0.8rem;
  }

  .mrc-day-number {
    font-size: 1.1rem;
  }
}

@media (max-width: 768px) {
  .mrc-calendar-wrapper {
    padding: 0.5rem 0.25rem;
  }

  .mrc-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 10px 12px;
  }

  .mrc-nav__title {
    order: -1;
    flex-basis: 100%;
  }

  .mrc-nav__title h2 {
    font-size: 0.95rem;
  }

  .mrc-table__corner,
  .mrc-table__time {
    width: 44px;
    min-width: 44px;
    font-size: 0.62rem;
  }

  .mrc-table__cell {
    height: 38px;
  }

  .mrc-booking__inner {
    padding: 4px 6px 4px 6px;
  }

  .mrc-booking__title {
    font-size: 0.68rem;
  }

  .mrc-booking__time {
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  .mrc-table__corner,
  .mrc-table__time {
    width: 38px;
    min-width: 38px;
    font-size: 0.58rem;
  }

  .mrc-day-label {
    font-size: 0.55rem;
  }

  .mrc-day-number {
    font-size: 0.95rem;
  }

  .mrc-day-month {
    display: none;
  }
}

/* ==============================
   Print
   ============================== */
@media print {
  .mrc-nav__btn,
  .mrc-nav__today {
    display: none;
  }

  .mrc-calendar-wrapper {
    padding: 0;
    background: #ffffff;
    min-height: unset;
  }

  .mrc-grid {
    box-shadow: none;
    border-radius: 0;
  }

  .mrc-booking {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    box-shadow: none;
  }
}

