/* Tourcube Guide Portal - Custom Styles */

/* ============================================
   Fix Gap Above Header
   ============================================ */

/* Remove any gap/space above the header by ensuring body and nk-wrap start at top */
.nk-body {
    margin: 0 !important;
    padding: 0 !important;
}

.nk-app-root {
    margin: 0 !important;
    padding: 0 !important;
}

.nk-wrap {
    margin: 0 !important;
    padding: 0 !important;
}

/* Ensure header starts at the very top with no gap */
.nk-header:first-child {
    margin-top: 0 !important;
}

/* Authentication Pages - Background Image Overlay */
.auth-bg-overlay {
    background:
        linear-gradient(90deg, rgba(8, 12, 18, 0.72), rgba(8, 12, 18, 0.48)),
        rgba(0, 0, 0, 0.35);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-bg-content .form-note-s2,
.auth-bg-content .form-note-s2 a {
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
}

.auth-bg-content .form-note-s2 a {
    font-weight: 600;
    text-decoration-color: rgba(255, 255, 255, 0.8);
    text-underline-offset: 3px;
}

.auth-bg-content .form-note-s2 a:hover {
    color: #f5f8ff !important;
    text-decoration-color: #fff;
}

.auth-bg-content .auth-contrast-link {
    color: #fff !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.75);
    text-decoration-color: rgba(255, 255, 255, 0.8) !important;
    text-underline-offset: 3px;
}

.auth-bg-content .auth-contrast-link:hover,
.auth-bg-content .auth-contrast-link:focus {
    color: #f5f8ff !important;
    text-decoration-color: #fff !important;
}

.auth-bg-content .auth-contrast-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 3px;
}

.auth-bg-content .form-label-group .auth-contrast-link {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.45rem;
    border-radius: 4px;
    background: rgba(15, 67, 116, 0.96);
    color: #fff !important;
    text-shadow: none;
    text-decoration: none;
}

.auth-bg-content .form-label-group .auth-contrast-link:hover,
.auth-bg-content .form-label-group .auth-contrast-link:focus {
    background: #0a2f52;
    color: #fff !important;
    text-decoration: none;
}

.auth-bg-content .form-label-group .auth-contrast-link:focus-visible {
    outline-color: rgba(15, 67, 116, 0.35);
}

/* Authentication Pages - Logo Size and Centering */
.nk-wrap-nosidebar .nk-auth-body .brand-logo {
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.nk-wrap-nosidebar .nk-auth-body .brand-logo .logo-link {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.nk-wrap-nosidebar .nk-auth-body .brand-logo .logo-link .logo-img.logo-light,
.nk-wrap-nosidebar .nk-auth-body .brand-logo .logo-link .logo-img.logo-dark {
    max-width: 70% !important;
    width: 70% !important;
    height: auto !important;
}

/* Guide Homepage Specific Styles */
.trip-table-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.trip-table-row:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Form Button States */
.btn-form-complete {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.btn-form-pending {
    background-color: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: white !important;
}

.btn-form-expired {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

.btn-form-disabled {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
    cursor: not-allowed !important;
}

/* Forms Due Section */
.forms-due-item {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin-bottom: 1rem;
}

.forms-due-item.overdue {
    border-left-color: #dc3545;
}

.portal-form-tile-link {
    display: block;
    color: inherit;
    cursor: pointer;
    text-decoration: none;
}

.portal-form-tile-link:hover {
    color: inherit;
    text-decoration: none;
}

.portal-form-tile-link:focus-visible {
    outline: 3px solid rgba(9, 113, 191, 0.35);
    outline-offset: 2px;
}

.portal-form-tile-action {
    white-space: nowrap;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .nk-tb-col {
        padding: 0.5rem;
    }

    .forms-due-item {
        padding: 0.75rem;
    }

    /* Responsive Tables - Better horizontal scrolling */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        border-radius: 0.375rem;
    }

    /* Smaller padding on mobile tables */
    .table-responsive table td,
    .table-responsive table th {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

    /* Ensure table links are tappable on mobile */
    .table-responsive table a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
}

/* Tab Navigation Enhancement */
.nav-tabs .nav-link.active {
    font-weight: 600;
}

/* Avatar Enhancement */
.user-avatar-header {
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Sidebar Logo Styling */
.nk-sidebar .nk-sidebar-brand .logo-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: hidden !important;
}

.nk-sidebar .nk-sidebar-brand .logo-img {
    max-width: 180px !important;
    max-height: 50px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Hide Guide Portal text in sidebar */
.nk-sidebar .nk-sidebar-brand .nio-version {
    display: none !important;
}

/* ============================================
   V6 Layout Specific Styles (Horizontal Header)
   ============================================ */

/* Header Logo Styling */
.nk-header .nk-header-brand .logo-link {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    text-align: left !important;
}

.nk-header .nk-header-brand .logo-img {
    max-width: 258px !important;
    max-height: 72px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

/* Header Menu Active State */
.nk-header-menu .nk-menu .nk-menu-item.active .nk-menu-link,
.nk-header-menu .nk-menu .nk-menu-item.current-page .nk-menu-link {
    color: #6576ff !important;
    font-weight: 600 !important;
}

/* Badge in Header Menu */
.nk-header-menu .nk-menu .nk-menu-link .badge {
    display: inline-block;
    vertical-align: middle;
}

/* User Avatar in Header */
.nk-header .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Mobile Menu Improvements */
@media (max-width: 991px) {
    .nk-header-menu .nk-menu {
        padding: 1rem 0;
    }

    .nk-header-menu .nk-menu .nk-menu-item {
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .nk-header-menu .nk-menu .nk-menu-link {
        padding: 0.75rem 1.5rem;
    }
}

/* Fix for logo in mobile header */
.nk-header-mobile .nk-header-brand .logo-img {
    max-width: 200px !important;
    max-height: 57px !important;
}

/* Ensure trip table rows are still hoverable */
.trip-table-row {
    cursor: pointer !important;
    transition: background-color 0.2s ease;
}

.trip-table-row:hover {
    background-color: rgba(0, 0, 0, 0.02) !important;
}

/* Fix Guide Profile Avatar to be perfectly round */
.user-card-s2 .user-avatar {
    width: 120px !important;
    height: 120px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
}

.user-card-s2 .user-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
}

.user-card-s2 .user-avatar span {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    font-size: 3rem !important;
}

/* ============================================
   Fix Dashlite .gap-N Collision with Bootstrap 5 .gap Utility
   ============================================
   Dashlite ships two `.gap-N` rule sets:
     1. Bootstrap utility: `gap: 0.75rem !important;`  (flex/grid gap)
     2. Legacy spacer:     `height: 0.75rem;`          (empty divider blocks)
   The spacer is declared AFTER the utility, so any `.d-flex.gap-2` collapses
   the flex container to 12px and its children overflow the next sibling.
   Neutralize the spacer height when `.gap-N` is combined with a flex/grid
   container; keep the gap utility semantics intact. */
.d-flex.gap-0, .d-flex.gap-1, .d-flex.gap-2, .d-flex.gap-3, .d-flex.gap-4, .d-flex.gap-5,
.d-inline-flex.gap-0, .d-inline-flex.gap-1, .d-inline-flex.gap-2, .d-inline-flex.gap-3, .d-inline-flex.gap-4, .d-inline-flex.gap-5,
.d-grid.gap-0, .d-grid.gap-1, .d-grid.gap-2, .d-grid.gap-3, .d-grid.gap-4, .d-grid.gap-5,
.d-inline-grid.gap-0, .d-inline-grid.gap-1, .d-inline-grid.gap-2, .d-inline-grid.gap-3, .d-inline-grid.gap-4, .d-inline-grid.gap-5 {
    height: auto;
}

/* -------------------------------------------------------------------------
   Booking-level Save Offline button (#160).
   Ported from guest-portal #163. Mirrors the old .save-offline-btn state
   machine but lives once per page at the top of the documents section.
   ------------------------------------------------------------------------- */
@keyframes save-offline-spin {
  to { transform: rotate(360deg); }
}

.booking-save-offline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.2s, color 0.2s;
}

.booking-save-offline-btn.is-saved {
  background-color: #1ee0ac;
  border-color: #1ee0ac;
  color: #fff;
}

.booking-save-offline-btn.is-saved:hover {
  background-color: #1ac795;
  border-color: #1ac795;
}

.booking-save-offline-btn.is-error {
  background-color: #e85347;
  border-color: #e85347;
  color: #fff;
}

.booking-save-offline-btn.is-error:hover {
  background-color: #d63b30;
  border-color: #d63b30;
}

.booking-save-offline-btn.is-loading .icon {
  animation: save-offline-spin 0.8s linear infinite;
}

/* Defense layer 3: hide the button on desktop viewports even if the server
   somehow emitted it (e.g. tablet UA but desktop-sized window). */
@media (min-width: 1367px) {
  .booking-save-offline-btn {
    display: none !important;
  }
}

/* Per-doc View button — narrow screens collapse to icon-only so the doc
   title stays readable. */
@media (max-width: 575.98px) {
  .view-doc-btn__label {
    display: none;
  }
}

/* DEVCUR-1709 — Whole document tile is clickable (guide + vendor views).
   The View button carries `.stretched-link`, expanding its hit area over the
   `.list-group-item` (already `position: relative`). These rules just signal
   the affordance: pointer cursor + subtle hover wash across the row. The View
   button keeps its own styling and stays the visible action. */
.doc-tile-clickable {
  cursor: pointer;
}

.doc-tile-clickable:hover {
  background-color: rgba(9, 113, 191, 0.06);
}

/* `.btn` is `position: relative`, which would trap the stretched-link's
   `::after` inside the button. Reset it to `static` so the overlay escapes to
   the `.list-group-item` and covers the entire row. */
.doc-tile-clickable .stretched-link {
  position: static;
}

/* DEVCUR-1709 — Trip Documents table (trip.html): make the whole row clickable.
   The row is the positioned ancestor so the download anchor's stretched-link
   `::after` covers every cell. The download anchor is not a `.btn`, so it stays
   `position: static` and no reset is needed. */
.doc-row-clickable {
  position: relative;
  cursor: pointer;
}

.doc-row-clickable:hover > td {
  background-color: rgba(9, 113, 191, 0.06);
}
