/* ============================================================================
   Teddybaeren Krankenhaus - Unified Design Tokens
   Single source of truth for color, spacing, radii, shadow, typography.
   Use these vars instead of hard-coded hex / px in page-level styles.
   ============================================================================ */
/* =========================================================
   GEEX SIDEBAR / CONTENT OVERLAP FIX
   Project: Teddydoc
   Reason:
   The Geex sidebar is fixed/absolute and overlaps header/content.
   This override must be loaded AFTER /css/style.css.
   ========================================================= */

:root {
    --teddy-sidebar-width: 290px;
}

/* Prevent page-wide horizontal overflow */
html,
body {
    overflow-x: hidden;
}

    /* Sidebar */
    body.geex-dashboard--with-sidebar .geex-sidebar.geex-sidebar--admin {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: var(--teddy-sidebar-width) !important;
        min-width: var(--teddy-sidebar-width) !important;
        max-width: var(--teddy-sidebar-width) !important;
        height: 100vh !important;
        z-index: 1050 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    /* Header must start after sidebar */
    body.geex-dashboard--with-sidebar .geex-header {
        margin-left: var(--teddy-sidebar-width) !important;
        width: calc(100% - var(--teddy-sidebar-width)) !important;
        max-width: calc(100% - var(--teddy-sidebar-width)) !important;
        left: var(--teddy-sidebar-width) !important;
        right: 0 !important;
        box-sizing: border-box !important;
    }

    /* Header inner wrapper must not exceed available width */
    body.geex-dashboard--with-sidebar .geex-header__wrapper {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Main content area */
    body.geex-dashboard--with-sidebar .geex-main-content {
        margin-left: var(--teddy-sidebar-width) !important;
        width: calc(100% - var(--teddy-sidebar-width)) !important;
        max-width: calc(100% - var(--teddy-sidebar-width)) !important;
        box-sizing: border-box !important;
    }

    /* Inner content must not add another sidebar offset */
    body.geex-dashboard--with-sidebar .geex-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Prevent wide content from pushing layout underneath the sidebar */
    body.geex-dashboard--with-sidebar .geex-content,
    body.geex-dashboard--with-sidebar .geex-content__wrapper,
    body.geex-dashboard--with-sidebar .geex-content__section-wrapper,
    body.geex-dashboard--with-sidebar .geex-content__section {
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Kindergarten grid safety */
    body.geex-dashboard--with-sidebar .kg-grid,
    body.geex-dashboard--with-sidebar .kg-scroll,
    body.geex-dashboard--with-sidebar .kg-grid__body,
    body.geex-dashboard--with-sidebar .kg-grid__header {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

/* Mobile / tablet */
@media (max-width: 1199.98px) {
    body.geex-dashboard--with-sidebar .geex-sidebar.geex-sidebar--admin {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    body.geex-dashboard--with-sidebar.geex-sidebar-open .geex-sidebar.geex-sidebar--admin {
        transform: translateX(0);
    }

    body.geex-dashboard--with-sidebar .geex-header,
    body.geex-dashboard--with-sidebar .geex-main-content {
        margin-left: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}
:root {
  /* ----- Brand ----- */
  --tk-brand:           #2563eb;
  --tk-brand-hover:     #1d4ed8;
  --tk-brand-soft:      #dbeafe;
  --tk-brand-fg:        #ffffff;

  /* ----- Capacity (semantic, used in slot grid) ----- */
  --tk-cap-free:        #16a34a;   /* < 50 %  */
  --tk-cap-free-bg:     #dcfce7;
  --tk-cap-tight:       #ca8a04;   /* 50-99 % */
  --tk-cap-tight-bg:    #fef9c3;
  --tk-cap-full:        #dc2626;   /* 100 %   */
  --tk-cap-full-bg:     #fee2e2;
  --tk-cap-locked:      #475569;
  --tk-cap-locked-bg:   #e2e8f0;

  /* ----- Surfaces ----- */
  --tk-surface:         #ffffff;
  --tk-surface-muted:   #f8fafc;
  --tk-surface-hover:   #f3f4f6;
  --tk-surface-elev:    #ffffff;

  /* ----- Borders ----- */
  --tk-border:          #d1d5db;
  --tk-border-soft:     #e5e7eb;
  --tk-border-strong:   #9ca3af;

  /* ----- Text ----- */
  --tk-text:            #111827;
  --tk-text-muted:      #4b5563;     /* 4.6:1 on white - passes AA */
  --tk-text-subtle:     #6b7280;
  --tk-text-inverse:    #ffffff;

  /* ----- Status ----- */
  --tk-success-bg:      #ecfdf5;
  --tk-success-fg:      #065f46;
  --tk-warning-bg:      #fffbeb;
  --tk-warning-fg:      #92400e;
  --tk-danger-bg:       #fef2f2;
  --tk-danger-fg:       #991b1b;
  --tk-info-bg:         #eff6ff;
  --tk-info-fg:         #1e40af;

  /* ----- Focus ----- */
  --tk-focus-ring:      0 0 0 3px rgba(37, 99, 235, .35);

  /* ----- Radii ----- */
  --tk-radius-sm:  6px;
  --tk-radius-md: 10px;
  --tk-radius-lg: 14px;
  --tk-radius-xl: 20px;

  /* ----- Shadows ----- */
  --tk-shadow-sm: 0 1px 2px rgba(17, 24, 39, .06);
  --tk-shadow-md: 0 4px 12px rgba(17, 24, 39, .08);
  --tk-shadow-lg: 0 12px 32px rgba(17, 24, 39, .12);

  /* ----- Spacing ----- */
  --tk-space-1: 4px;
  --tk-space-2: 8px;
  --tk-space-3: 12px;
  --tk-space-4: 16px;
  --tk-space-5: 20px;
  --tk-space-6: 24px;
  --tk-space-8: 32px;
  --tk-space-10: 40px;

  /* ----- Touch targets (>= 44 px on mobile) ----- */
  --tk-touch: 44px;
}

/* ----- Reusable badge classes for capacity (replace inline hex) ----- */
.tk-badge        { display: inline-flex; align-items: center; gap: 4px;
                   padding: 2px 8px; border-radius: 999px;
                   font-size: 12px; font-weight: 600; line-height: 1.4;
                   white-space: nowrap; }
.tk-badge--free  { background: var(--tk-cap-free-bg);   color: var(--tk-cap-free);   }
.tk-badge--tight { background: var(--tk-cap-tight-bg);  color: var(--tk-cap-tight);  }
.tk-badge--full  { background: var(--tk-cap-full-bg);   color: var(--tk-cap-full);   }
.tk-badge--locked{ background: var(--tk-cap-locked-bg); color: var(--tk-cap-locked); }
.tk-badge--info  { background: var(--tk-info-bg);       color: var(--tk-info-fg);    }

/* ----- Slot cell: shared between Calendar and OnSite ----- */
.tk-slot {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--tk-space-1);
  padding: var(--tk-space-3);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-md);
  background: var(--tk-surface);
  transition: border-color .15s, transform .15s, box-shadow .15s;
  cursor: pointer;
  min-height: 80px;
}
.tk-slot:hover { border-color: var(--tk-border-strong); box-shadow: var(--tk-shadow-sm); }
.tk-slot:focus-visible { outline: none; box-shadow: var(--tk-focus-ring); }

.tk-slot--free   { border-left: 4px solid var(--tk-cap-free); }
.tk-slot--tight  { border-left: 4px solid var(--tk-cap-tight); }
.tk-slot--full   { border-left: 4px solid var(--tk-cap-full);
                   background: var(--tk-cap-full-bg); cursor: not-allowed; }
.tk-slot--locked { border-left: 4px solid var(--tk-cap-locked);
                   background: var(--tk-cap-locked-bg);
                   color: var(--tk-text-muted); cursor: not-allowed; }

.tk-slot__time { font-weight: 600; font-size: 13px; color: var(--tk-text); }
.tk-slot__primary { font-size: 20px; font-weight: 700; line-height: 1.1; }
.tk-slot__meta { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; }

/* ----- Buttons get a unified "primary" treatment ----- */
.tk-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--tk-space-2);
  min-height: var(--tk-touch);
  padding: 0 var(--tk-space-4);
  border-radius: var(--tk-radius-md);
  border: 1px solid transparent;
  font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background .15s, border-color .15s;
  text-decoration: none;
}
.tk-btn--primary  { background: var(--tk-brand); color: var(--tk-brand-fg); }
.tk-btn--primary:hover { background: var(--tk-brand-hover); color: var(--tk-brand-fg); }
.tk-btn--ghost    { background: transparent; color: var(--tk-text);
                    border-color: var(--tk-border); }
.tk-btn--ghost:hover { background: var(--tk-surface-hover); color: var(--tk-text); }
.tk-btn--danger   { background: var(--tk-danger-fg); color: #fff; }
.tk-btn--danger:hover { background: #7f1d1d; color: #fff; }
.tk-btn:focus-visible { outline: none; box-shadow: var(--tk-focus-ring); }
.tk-btn[disabled], .tk-btn.is-loading { opacity: .55; cursor: not-allowed; }

/* ----- Forms ----- */
.tk-input, .tk-select, .tk-textarea {
  width: 100%; min-height: var(--tk-touch);
  padding: var(--tk-space-2) var(--tk-space-3);
  border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-md);
  background: var(--tk-surface);
  font-size: 16px;  /* prevents iOS zoom on focus */
  color: var(--tk-text);
}
.tk-input:focus-visible, .tk-select:focus-visible, .tk-textarea:focus-visible {
  outline: none; border-color: var(--tk-brand); box-shadow: var(--tk-focus-ring);
}

/* ----- Slot grid: responsive ----- */
.tk-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--tk-space-2);
}
@media (max-width: 600px) {
  .tk-grid { grid-template-columns: 1fr; }
}

/* ----- Toast (replaces ad-hoc error divs) ----- */
.tk-toast {
  position: fixed; right: var(--tk-space-4); bottom: var(--tk-space-4);
  max-width: 380px; padding: var(--tk-space-3) var(--tk-space-4);
  background: var(--tk-surface); border: 1px solid var(--tk-border);
  border-radius: var(--tk-radius-md); box-shadow: var(--tk-shadow-lg);
  z-index: 1080;
}
.tk-toast--success { border-left: 4px solid var(--tk-cap-free); }
.tk-toast--warning { border-left: 4px solid var(--tk-cap-tight); }
.tk-toast--danger  { border-left: 4px solid var(--tk-cap-full);  }

/* ----- Modal helpers (mobile-fullscreen) ----- */
@media (max-width: 600px) {
  .modal-dialog.tk-modal-mobile-full {
    margin: 0; max-width: 100%; min-height: 100vh;
  }
  .modal-dialog.tk-modal-mobile-full .modal-content {
    border-radius: 0; min-height: 100vh;
  }
}

/* ----- Spinner inline ----- */
.tk-spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: tk-spin .7s linear infinite;
}
@keyframes tk-spin { to { transform: rotate(360deg); } }

/* ----- Required field marker ----- */
.tk-required { color: var(--tk-cap-full); font-weight: 700; margin-left: 2px; }
/* ============================================================
   Layout fixes — sidebar + main content gutter
   Prevents the OnSite/Calendar grid from touching the sidebar.
   ============================================================ */

/* Geex's main content wrapper — give it a real left gutter on desktop.
   The sidebar is ~260px in this template. Adjust if yours differs. */
.geex-main-content,
.main-content,
.page-content {
    padding-left: 24px;
    padding-right: 24px;
    box-sizing: border-box;
}

@media (min-width: 1200px) {
    .geex-main-content,
    .main-content,
    .page-content {
        padding-left: 32px;
        padding-right: 32px;
    }
}

/* OnSite/Calendar page header + scroll body should never overflow */
.booking-grid,
.booking-scroll {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* belt + suspenders */
}

    /* If the grid uses a Bootstrap .row with negative margins, neutralize it */
    .booking-grid > .row,
    .booking-scroll > .row {
        margin-left: 0;
        margin-right: 0;
    }

/* The two-column day grid: give it a small inner gap so cells don't kiss */
.booking-grid__body {
    column-gap: 12px;
    padding-right: 4px; /* breathing room for the scrollbar */
}

/* Slot cells should never have negative margin */
.slot-cell {
    margin: 0 !important;
}

/* Sidebar: make sure its z-index sits above the page content
   so even if a panel hugs the edge, the sidebar wins visually. */
.geex-sidebar,
aside.sidebar,
.sidebar-wrapper {
    z-index: 1040;
}

/* Tighter responsive layout: stack to one column earlier */
@media (max-width: 992px) {
    .booking-grid__body {
        grid-template-columns: 1fr !important;
    }

    .booking-grid__header {
        grid-template-columns: 1fr !important;
    }

        .booking-grid__header > div:nth-child(2) {
            display: none; /* hide second day header in stacked view */
        }
    /* In stacked mode, prepend the day name to each cell group instead */
    .booking-grid__body .slot-cell[data-day-label]::before {
        content: attr(data-day-label);
        display: block;
        font-weight: 700;
        color: #475569;
        margin-bottom: 4px;
        font-size: 13px;
    }
}
/* ============================================================
   LAYOUT FIX — Sidebar + main content offset
   
   The Geex theme uses padding-inline-start on .geex-main-content
   to push the content past the fixed sidebar. This only works
   when html[data-nav="side"] is set. When localStorage is empty
   on first load, data-nav isn't set at all and the sidebar
   overlaps the content.
   
   Solution: make the offset unconditional via :not([data-nav="top"]).
   ============================================================ */

/* Sidebar is fixed at left: 22px, min-width: 310px.
   Content must start after: 22 + 310 + 30 gap = 362px minimum.
   We use the same breakpoint values as the existing theme rules. */

html:not([data-nav="top"]) .geex-main-content {
    padding-inline-start: 400px !important;
}

@media only screen and (max-width: 1920px) {
    html:not([data-nav="top"]) .geex-main-content {
        padding-inline-start: 380px !important;
    }
}

@media only screen and (max-width: 1600px) {
    html:not([data-nav="top"]) .geex-main-content {
        padding-inline-start: 370px !important;
    }
}

@media only screen and (max-width: 1440px) {
    html:not([data-nav="top"]) .geex-main-content {
        padding-inline-start: 340px !important;
    }
}

/* Below 1199px: sidebar collapses, no offset needed */
@media only screen and (max-width: 1199px) {
    html:not([data-nav="top"]) .geex-main-content {
        padding-inline-start: 22px !important;
    }
}

/* Also ensure the content div fills the remaining width properly */
html:not([data-nav="top"]) .geex-content {
    min-width: 0; /* prevents flex blowout */
    overflow-x: hidden;
}

/* Hard safety net: if data-nav is completely missing,
   treat it the same as "side" */
html:not([data-nav]) .geex-main-content {
    padding-inline-start: 380px !important;
}

@media only screen and (max-width: 1440px) {
    html:not([data-nav]) .geex-main-content {
        padding-inline-start: 340px !important;
    }
}

@media only screen and (max-width: 1199px) {
    html:not([data-nav]) .geex-main-content {
        padding-inline-start: 22px !important;
    }
}

/* Slot/booking grids: never overflow the content area */
.booking-grid,
.booking-scroll,
.booking-grid__body {
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}