/* ===== Hostel Management — page-specific styles ===== */

/* Quick actions */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.quick-card {
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.quick-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.quick-card .ic {
  font-size: 1.5rem;
  color: var(--gold-600);
  margin-bottom: var(--space-2);
}
.quick-card h4 {
  font-size: 1.05rem;
  margin-bottom: 8px;
}
.quick-card p {
  font-size: 0.85rem;
  color: var(--grey-600);
  margin-bottom: var(--space-3);
  line-height: 1.5;
}
.quick-card .card-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--navy-900);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.quick-card .card-link:hover {
  color: var(--gold-600);
}

/* Sidebar Layout */
.section:has(.hostel-layout) {
  padding-top: 32px !important;
}

.hostel-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 32px;
  align-items: start;
}

/* Sidebar Menu */
.sidebar-menu {
  position: sticky;
  top: 100px;
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tab-btn {
  background: transparent;
  border: none;
  text-align: left;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--grey-600);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  display: flex;
  align-items: center;
  gap: 12px;
}
.tab-btn i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}
.tab-btn:hover {
  background: var(--grey-100);
  color: var(--navy-900);
}
.tab-btn.active {
  background: var(--gold-100);
  color: var(--gold-600);
  font-weight: 600;
}

/* Tab Content */
.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}
.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Content Styling */
.content-box {
    background: var(--white);
    border: 1px solid var(--grey-300);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-3);
}
.content-box h2 {
  font-size: 1.4rem;
  color: var(--navy-900);
  margin-bottom: var(--space-2);
  margin-top: 1.5rem;
  font-weight: 600;
  border-left: 5px solid var(--gold-500);
  padding-left: 12px;
}
.content-box h2:first-child {
  margin-top: 0;
}
.content-box h3 {
  font-size: 1.25rem;
  color: var(--navy-900);
  margin: var(--space-4) 0 var(--space-2);
  font-weight: 600;
  border-left: 5px solid var(--gold-500);
  padding-left: 12px;
}
.content-box p {
  color: var(--grey-700);
  line-height: 1.6;
  margin-bottom: 12px;
  font-size: 1.05rem;
}
.content-box > *:last-child {
  margin-bottom: 0;
}
.content-box .indent-group {
  margin-left: 1.2rem;
}
.content-box li {
  margin-bottom: 8px;
}
.content-box li::marker {
  color: var(--gold-500);
}

/* specific components inside tabs */
.hostel-carousel {
  position: relative;
  width: 100%;
  height: 350px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-3);
  background: var(--grey-100);
}
.hostel-carousel img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease-in-out;
}
.hostel-carousel img.active {
  opacity: 1;
}

/* Contacts Grid */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.contact-card {
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
}
.contact-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  border: 2px solid var(--white);
  box-shadow: var(--shadow-sm);
}
.contact-card h4 {
  font-size: 1.05rem;
  margin-bottom: 2px;
  color: var(--navy-900);
}
.contact-card .role {
  font-size: 0.82rem;
  color: var(--gold-600);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.contact-card a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--grey-600);
  margin-bottom: 6px;
}
.contact-card a:hover {
  color: var(--gold-600);
}
.contact-card > *:last-child {
  margin-bottom: 0;
}

/* Escalation Matrix */
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}
.matrix-table th {
  background: var(--navy-900);
  color: var(--white);
  text-align: left;
  padding: 12px 16px;
  font-size: 0.9rem;
  border: 1px solid var(--navy-900);
}
.matrix-table td {
  padding: 12px 16px;
  border: 1px solid var(--grey-300);
  font-size: 0.95rem;
  color: var(--grey-700);
}
.matrix-table tbody tr:nth-child(even) {
  background: var(--grey-50);
}

/* Hostel directory (reused) */
.hostel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.hostel-card {
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.hostel-photo {
  aspect-ratio: 16/10;
  position: relative;
}
.hostel-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hostel-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--navy-950);
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 5px 12px;
  border-radius: 999px;
}
.hostel-tag.girls {
  background: var(--gold-600);
}
.hostel-body {
  padding: var(--space-2);
}
.hostel-body h4 {
  font-size: 1.1rem;
}
.hostel-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--grey-600);
}

/* Fees table (reused) */
.fee-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.fee-table thead tr {
  background: var(--navy-900);
}
.fee-table thead th {
  color: var(--white);
  text-align: left;
  padding: 14px 18px;
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
}
.fee-table tbody td {
  padding: 14px 18px;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--grey-300);
}
.fee-table tbody tr:nth-child(even) {
  background: var(--grey-50);
}
.fee-table .due {
  color: var(--orange-500);
  font-weight: 700;
}

/* Maintenance request form (reused) */
.maint-form {
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.priority-group {
  display: flex;
  gap: 10px;
}
.priority-opt {
  flex: 1;
  text-align: center;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: 9px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grey-600);
  cursor: pointer;
  transition: all 0.2s ease;
}
.priority-opt input {
  display: none;
}
.priority-opt:has(input:checked) {
  border-color: var(--gold-500);
  background: var(--gold-100);
  color: var(--navy-900);
}

/* Process grid */
.process-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.process-step {
  background: var(--grey-50);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--grey-200);
}
.process-num {
  width: 32px;
  height: 32px;
  background: var(--navy-900);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 12px;
}
.process-step h4 {
  font-size: 1rem;
  margin-bottom: 6px;
}
.process-step p {
  font-size: 0.9rem;
  color: var(--grey-600);
  margin: 0;
  line-height: 1.4;
}

/* Responsive */
@media (max-width: 1080px) {
  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .hostel-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-menu {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: var(--space-2);
  }
  .tab-btn {
    white-space: nowrap;
  }
  .contact-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 768px) {
  .quick-grid {
    grid-template-columns: 1fr;
  }
  .hostel-grid {
    grid-template-columns: 1fr;
  }
  .process-grid {
    grid-template-columns: 1fr;
  }
  .priority-group {
    flex-direction: column;
  }
  .matrix-table {
    font-size: 0.85rem;
  }
  .hostel-carousel {
    height: 250px;
  }
  .content-box {
    padding: var(--space-2);
  }
  .contact-card {
    padding: var(--space-2);
  }
}

/* ===== Quill WYSIWYG Content Overrides inside .content-box ===== */
.content-box .ql-editor {
  padding: 0 !important;
  font-family: inherit !important;
  overflow-y: visible !important;
}

.content-box .ql-editor h2 {
  font-size: 1.4rem !important;
  color: var(--navy-900) !important;
  margin-bottom: var(--space-2) !important;
  margin-top: 1.5rem !important;
  font-weight: 600 !important;
  border-left: 5px solid var(--gold-500) !important;
  padding-left: 12px !important;
}

.content-box .ql-editor h2:first-child {
  margin-top: 0 !important;
}

.content-box .ql-editor h3 {
  font-size: 1.25rem !important;
  color: var(--navy-900) !important;
  margin: var(--space-4) 0 var(--space-2) !important;
  font-weight: 600 !important;
  border-left: 5px solid var(--gold-500) !important;
  padding-left: 12px !important;
}

.content-box .ql-editor p {
  color: var(--grey-700) !important;
  line-height: 1.6 !important;
  margin-bottom: 12px !important;
  font-size: 1.05rem !important;
}

.content-box .ql-editor .indent-group {
  margin-left: 1.2rem;
}

.content-box .ql-editor ul,
.content-box .ql-editor ol {
  padding-left: 1.5rem !important;
  margin-bottom: 12px !important;
}

.content-box .ql-editor li {
  margin-bottom: 8px !important;
  font-size: 1.05rem !important;
  color: var(--grey-700) !important;
}

/* ==========================================================================
   TAG-BASED STYLING FOR ADMIN / WYSIWYG RAW HTML CONTENT
   Scoped to .tab-pane > .ql-editor (DB content with no class names)
   All common HTML tags are styled so content looks great without any classes.
   ========================================================================== */

.tab-pane > .ql-editor {
  font-family: var(--font-body, 'Inter', sans-serif);
  font-size: 1rem;
  color: var(--grey-700, #444);
  line-height: 1.7;
  overflow-y: visible !important;
}

/* ---- Section containers: every first child section block ---- */
/* Give each top-level block a "card" feel */
.tab-pane > .ql-editor > h1,
.tab-pane > .ql-editor > h2 {
  /* Reset any ql-editor overrides */
  margin-top: 2rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  padding-left: 0;
}

/* ---- Headings ---- */
.tab-pane > .ql-editor h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--navy-900, #0a192f);
  border-left: 5px solid var(--gold-500, #c8972b);
  padding-left: 14px;
  margin-top: 0;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.tab-pane > .ql-editor h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--navy-900, #0a192f);
  border-left: 5px solid var(--gold-500, #c8972b);
  padding-left: 12px;
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  line-height: 1.35;
}

.tab-pane > .ql-editor h2:first-child {
  margin-top: 0;
}

.tab-pane > .ql-editor h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy-900, #0a192f);
  border-left: 4px solid var(--gold-400, #d4a84b);
  padding-left: 10px;
  margin-top: 1.6rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.tab-pane > .ql-editor h4 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy-900, #0a192f);
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

.tab-pane > .ql-editor h5,
.tab-pane > .ql-editor h6 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--grey-600, #666);
  margin-top: 1rem;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Paragraphs ---- */
.tab-pane > .ql-editor p {
  color: var(--grey-700, #4a4a4a);
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 0.85rem;
  margin-top: 0;
}

/* ---- Strong / Em / Mark ---- */
.tab-pane > .ql-editor strong,
.tab-pane > .ql-editor b {
  color: var(--navy-900, #0a192f);
  font-weight: 700;
}

.tab-pane > .ql-editor em,
.tab-pane > .ql-editor i {
  font-style: italic;
  color: inherit;
}

.tab-pane > .ql-editor mark {
  background: var(--gold-100, #fef9ec);
  color: var(--navy-900, #0a192f);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ---- Unordered / Ordered Lists ---- */
.tab-pane > .ql-editor ul,
.tab-pane > .ql-editor ol {
  padding-left: 1.6rem;
  margin-bottom: 1rem;
  margin-top: 0.25rem;
}

.tab-pane > .ql-editor ul {
  list-style-type: disc;
}

.tab-pane > .ql-editor ol {
  list-style-type: decimal;
}

.tab-pane > .ql-editor li {
  font-size: 1rem;
  color: var(--grey-700, #4a4a4a);
  line-height: 1.65;
  margin-bottom: 0.45rem;
}

.tab-pane > .ql-editor li::marker {
  color: var(--gold-500, #c8972b);
  font-weight: 700;
}

/* Nested lists */
.tab-pane > .ql-editor ul ul,
.tab-pane > .ql-editor ol ol,
.tab-pane > .ql-editor ul ol,
.tab-pane > .ql-editor ol ul {
  margin-top: 0.3rem;
  margin-bottom: 0.3rem;
}

/* ---- Links ---- */
.tab-pane > .ql-editor a {
  color: var(--gold-600, #b07d20);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.tab-pane > .ql-editor a:hover {
  color: var(--navy-900, #0a192f);
}

/* ---- Blockquote ---- */
.tab-pane > .ql-editor blockquote {
  border-left: 4px solid var(--gold-400, #d4a84b);
  background: var(--grey-50, #f9f9f9);
  margin: 1.25rem 0;
  padding: 0.85rem 1.25rem;
  border-radius: 0 var(--radius-md, 8px) var(--radius-md, 8px) 0;
  color: var(--grey-600, #666);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.65;
}

/* ---- Inline Code / Code blocks ---- */
.tab-pane > .ql-editor code {
  background: var(--grey-100, #f0f0f0);
  color: var(--navy-900, #0a192f);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  padding: 2px 6px;
  border-radius: 4px;
}

.tab-pane > .ql-editor pre {
  background: var(--navy-900, #0a192f);
  color: #e2e8f0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.88rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md, 8px);
  overflow-x: auto;
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* ---- Horizontal Rule ---- */
.tab-pane > .ql-editor hr {
  border: none;
  border-top: 1px solid var(--grey-200, #e5e5e5);
  margin: 1.75rem 0;
}

/* ---- Images ---- */
.tab-pane > .ql-editor img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md, 8px);
  margin: 0.75rem 0;
  box-shadow: var(--shadow-sm, 0 1px 4px rgba(0,0,0,.08));
}

/* ---- Tables ---- */
.tab-pane > .ql-editor table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
}

.tab-pane > .ql-editor table thead tr {
  background: var(--navy-900, #0a192f);
}

.tab-pane > .ql-editor table thead th {
  color: #fff;
  text-align: left;
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--navy-900, #0a192f);
}

.tab-pane > .ql-editor table tbody td {
  padding: 11px 16px;
  border: 1px solid var(--grey-200, #e5e5e5);
  color: var(--grey-700, #4a4a4a);
  vertical-align: top;
  line-height: 1.5;
}

.tab-pane > .ql-editor table tbody tr:nth-child(even) {
  background: var(--grey-50, #f9f9f9);
}

.tab-pane > .ql-editor table tbody tr:hover {
  background: var(--gold-50, #fffbf0);
}

/* ---- Definition / Description lists ---- */
.tab-pane > .ql-editor dl {
  margin-bottom: 1rem;
}

.tab-pane > .ql-editor dt {
  font-weight: 700;
  color: var(--navy-900, #0a192f);
  margin-top: 0.75rem;
}

.tab-pane > .ql-editor dd {
  margin-left: 1.5rem;
  color: var(--grey-700, #4a4a4a);
}

/* ---- Details / Summary (accordion-like) ---- */
.tab-pane > .ql-editor details {
  border: 1px solid var(--grey-200, #e5e5e5);
  border-radius: var(--radius-md, 8px);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.tab-pane > .ql-editor summary {
  font-weight: 600;
  color: var(--navy-900, #0a192f);
  cursor: pointer;
  user-select: none;
}

/* ---- Quill-specific indent classes (data-indent) ---- */
.tab-pane > .ql-editor .ql-indent-1 { padding-left: 2em; }
.tab-pane > .ql-editor .ql-indent-2 { padding-left: 4em; }
.tab-pane > .ql-editor .ql-indent-3 { padding-left: 6em; }
.tab-pane > .ql-editor .ql-indent-4 { padding-left: 8em; }

/* ---- Quill alignment helpers ---- */
.tab-pane > .ql-editor .ql-align-center { text-align: center; }
.tab-pane > .ql-editor .ql-align-right  { text-align: right; }
.tab-pane > .ql-editor .ql-align-justify { text-align: justify; }

/* ---- Visual section separator: spacing between consecutive blocks ---- */
.tab-pane > .ql-editor h2 + p,
.tab-pane > .ql-editor h3 + p,
.tab-pane > .ql-editor h4 + p {
  margin-top: 0;
}

/* Last element no extra margin */
.tab-pane > .ql-editor > *:last-child {
  margin-bottom: 0;
}

/* ---- Responsive table overflow ---- */
@media (max-width: 640px) {
  .tab-pane > .ql-editor table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 0.85rem;
  }
}

/* ---- Override Quill Snow's own editor chrome when used as renderer ---- */
/* The ql-snow .ql-editor rule adds padding, min-height, etc. We strip those  */
/* when the editor is inside a tab-pane (read-only content display mode).     */
.tab-pane > .ql-editor {
  border: none !important;
  min-height: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  /* Quill Snow wraps with .ql-container border; we ensure none leaks through */
  outline: none !important;
}
