:root {
  --main: #492f88;
  --main-hover: #5a3a9e;
  --secondary: #3574b7;
  --secondary-hover: #4690d0;
  --hover: #eef4fb;
  --today: orangered;
  --text: #1a1a2e;
  --text-subtle: #492f88b2;
  --event: #492f882a;
  --outline: #798094;
  --outline-dark: #485374;
  --background: #ffffff;
}

@font-face {
  font-family: "Roboto Slab";
  src: url("./fonts/RobotoSlab-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
}

/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background-color: var(--background);
  overflow-y: scroll;
  scrollbar-gutter: stable both-edges;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Logo and toolbar */
.toolbar {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 1vh;
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 2000;
}

.toolbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 90vw;
  max-width: 90vw;
  box-sizing: border-box;
  background-color: white !important;
  z-index: 10;
  margin-bottom: 0.5rem;
  position: relative;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo img {
  height: 70px;
  width: auto;
}

.logo-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo__title,
.logo__subtitle {
  font-family: "Roboto Slab", serif;
  font-weight: normal;
  text-decoration: none;
  color: #000;
}

.logo__title {
  font-size: 26px;
}

.logo__subtitle {
  font-size: 14px;
}

.month-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  /*gap: 1rem;*/
  width: auto;
  min-width: min(300px, 50vw);
}

#calendar-title {
  min-width: min(300px, 50vw);
  text-align: center;
  margin: 0;
  padding: 10px;
}

.month-change {
  background-color: transparent;
  border: none;
}

.month-change i {
  font-size: 2rem;
  color: #000 !important;
}

.month-change:hover i {
  color: var(--secondary) !important;
}

/* Filter buttons and status text */
.toolbar .right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.filter-buttons {
  display: flex;
  gap: 10px;
}

.login-buttons {
  display: flex;
  gap: 10px;
}

#filter,
#filter-clear,
#filter-confirm,
#btnSaveUser,
#btnCreateUserConfirm,
#btnCreateUser,
#btnSaveOrg,
#btnCreateOrgConfirm,
#btnCreateOrg,
#btnSaveLocation,
#btnCreateLocationConfirm,
#btnCreateLocation,
#btnCreateContact,
#btnCreateContactConfirm,
#btnSaveContact,
#login-submit,
#reserve-submit,
#add-event,
#ev-save,
#ev-recurrence,
#rec-save,
#collision-close-btn {
  padding: 5px;
  font-size: 14px;
  background-color: var(--secondary);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

#btnCreateUserConfirm:disabled,
#btnCreateUserConfirm[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

#filter:hover,
#filter-clear:hover,
#filter-confirm:hover,
#btnSaveUser:hover,
#btnCreateUserConfirm:hover,
#btnCreateUser:hover,
#btnSaveOrg:hover,
#btnCreateOrgConfirm:hover,
#btnCreateOrg:hover,
#btnSaveLocation:hover,
#btnCreateLocationConfirm:hover,
#btnCreateLocation:hover,
#btnCreateContact:hover,
#btnCreateContactConfirm:hover,
#btnSaveContact:hover,
#login-submit:hover,
#reserve-submit:hover,
#add-event:hover,
#ev-save:hover,
#ev-recurrence:hover,
#rec-save:hover,
#collision-close-btn:hover {
  background-color: var(--main);
}

#delete-event {
  padding: 6px 12px;
  font-size: 14px;
  margin-top: 1rem;
  background-color: var(--secondary);
  border: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

#edit-event {
  padding: 6px 12px;
  font-size: 14px;
  margin-top: 1rem;
  background-color: var(--secondary);
  border: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

#edit-event:hover {
  background-color: var(--main-hover, #5a3a9e) !important;
  font-weight: bold;
}

.day-add {
  position: absolute;
  top: 6px;
  left: 6px;
  background: none;
  border: none;
  color: var(--outline);
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
  z-index: 2;
}
.day-add:hover {
  color: var(--main);
  transform: scale(1.5);
}
.day-add:focus {
  outline: none;
}

#weekly-wrapper .weekly-day-header .weekly-day-header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#weekly-wrapper .weekly-day-header .day-add {
  position: static;
  top: auto;
  left: auto;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding: 0;
  margin-right: 6px;
  transform: none;
}

#weekly-wrapper .weekly-day-header .day-add:hover {
  color: var(--secondary);
  transform: none;
}

#login-btn {
  padding: 5px;
  font-size: 14px;
  background-color: #5ca862;;
  border: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
#logout-btn {
  padding: 5px;
  font-size: 14px;
  background-color: var(--secondary);
  border: none;
  display: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

.view-btn {
  padding: 5px;
  font-size: 14px;
  background-color: var(--secondary);
  border: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
.view-toggle {
  display: flex;
  gap: 10px;
}

.view-btn:disabled {
  background-color: grey;
}

#active-login,
#active-view,
#active-filter {
  margin: 0;
  font-size: 14px;
  color: var(--text-subtle);
}

#loading {
  width: 100%;
  overflow: visible;
  margin: 0 auto;
}

#loading #calendar-wrapper {
  width: 100%;
  overflow: visible;
  margin: 0 auto;
}

/* Skeleton loading animation */
#loading #skeleton-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 90vw;
  max-width: 90vw;
  margin: 0 auto;
  overflow: visible !important;
  outline: 1px solid var(--outline);
}

#loading .day.skeleton-loading {
  background: linear-gradient(
    90deg,
    #fff 0%,
    #f5f5f5 50%,
    #fff 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

#loading .day.skeleton-loading:nth-child(7n+6),
#loading .day.skeleton-loading:nth-child(7n+7) {
  background: linear-gradient(
    90deg,
    #f3f3f3 0%,
    #f8f8f8 50%,
    #f3f3f3 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

#loading .skeleton-shimmer {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

#loading .day.skeleton-loading .label-primary.skeleton-shimmer {
  background-color: var(--main);
  background-image: linear-gradient(
    90deg,
    var(--main) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    var(--main) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

#loading .day.skeleton-loading.today .label-primary.skeleton-shimmer {
  background-color: var(--today);
  background-image: linear-gradient(
    90deg,
    var(--today) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    var(--today) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

#loading .day.skeleton-loading.other-month .label-primary.skeleton-shimmer {
  background-color: var(--secondary);
  background-image: linear-gradient(
    90deg,
    var(--secondary) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    var(--secondary) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

#loading .day.skeleton-loading .event-sp.skeleton-shimmer {
  background-color: var(--event);
  background-image: linear-gradient(
    90deg,
    var(--event) 0%,
    rgba(255, 255, 255, 0.4) 50%,
    var(--event) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  animation-delay: calc(var(--delay, 0) * 0.1s);
  margin-top: 3px;
  padding: 2px 6px;
  min-height: 15px;
  height: 15px;
}

#loading .day.skeleton-loading .event-db.skeleton-shimmer {
  background-color: #e8f5e9;
  background-image: linear-gradient(
    90deg,
    #e8f5e9 0%,
    rgba(255, 255, 255, 0.4) 50%,
    #e8f5e9 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  animation-delay: calc(var(--delay, 0) * 0.1s);
  margin-top: 3px;
  padding: 2px 6px;
  min-height: 15px;
  height: 15px;
}

#loading .day.skeleton-loading .event-sp.skeleton-shimmer:nth-child(2),
#loading .day.skeleton-loading .event-db.skeleton-shimmer:nth-child(2) {
  --delay: 1;
}

#loading .day.skeleton-loading .event-sp.skeleton-shimmer:nth-child(3),
#loading .day.skeleton-loading .event-db.skeleton-shimmer:nth-child(3) {
  --delay: 2;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}


.add-event-wrapper {
  display: flex;
  justify-content: flex-end;
  width: 90vw;
  max-width: 90vw;
  margin: 20px auto;
}

/* Calendar grid */
#calendar-wrapper {
  width: 100%;
  overflow: visible;
  margin: 0 auto;
}

#calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 90vw;
  max-width: 90vw;
  margin: 0 auto;
  overflow: visible !important;
  outline: 1px solid var(--outline);
}

/* Day cells */
.day {
  border: 1px solid #ccc;
  padding: 5px;
  min-height: 120px;
  max-height: 120px;
  background-color: #fff;
  position: relative;
  text-align: right;
  overflow: visible;
}
.day.header {
  background-color: var(--main);
  color: #fff;
  font-weight: bold;
  text-align: center;
  border: 1px solid var(--main);
  min-height: auto;
}
.day:nth-child(7n+6):not(.header),
.day:nth-child(7n+7):not(.header) {
  background-color: #f3f3f3;
}
.day.today {
  outline: 3px solid var(--today);
  border-radius: 6px;
  outline-offset: -3px;
}
.day.today .label-primary {
  background-color: var(--today) !important;
}
.day.other-month strong {
  background-color: var(--secondary);
}
.day:not(.header):hover {
  background-color: var(--hover);
  outline: 2px solid var(--secondary);
  border-radius: 6px;
  outline-offset: -2px;
}

.day::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #fff;
  border-radius: 6px;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
}
.day:hover::after {
  opacity: 1;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

/* Date label in each day */
.label-primary {
  background-color: var(--main);
  color: #fff;
  width: 1.7em;
  height: 1.7em;
  line-height: 1.7em;
  text-align: center;
  border-radius: 50%;
  display: inline-block;
  font-weight: bold;
}
.fa-solid {
  color: var(--main) !important;
  width: 1em;
  height: 1em;
  padding-right: 5px;
}

/* Events styling */
.event-sp,
.event-db {
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
  gap: 8px;
}
.event-sp {
  background-color: var(--event);
}
.event-db {
  background-color: #e8f5e9;
}
.event-sp:hover {
  background-color: var(--hover);
  outline: 2px solid var(--secondary);
  border-radius: 6px;
  outline-offset: -2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}
.event-db:hover {
  background-color: #fff;
  outline: 2px solid #7bdc83;
  border-radius: 6px;
  outline-offset: -2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-container {
  position: relative;
  z-index: 1000;
}
.event-wrapper {
  max-height: 5.9em;
  position: relative;
  pointer-events: auto;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.2s;
  z-index: 1;
}

.event-container.has-overflow:hover {
  z-index: 5001;
}

.event-container.has-overflow:hover .event-wrapper {
  max-height: unset;
  position: absolute;
  top: 0;
  left: -20px;
  width: 100%;
  overflow: visible;
  background: #fff !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.377);
  border: 2px solid var(--outline);
  border-radius: 6px;
  padding-bottom: 4px;
  padding: 15px;
  opacity: 1;
  pointer-events: auto;
  z-index: 5002;
}

body.modal-open .event-container:hover .event-wrapper {
  position: relative !important;
  box-shadow: none !important;
  border: none !important;
  overflow: hidden !important;
  max-height: 4.8em !important;
  z-index: 1 !important;
  pointer-events: none !important;
  background: transparent !important;
}

/* Event content (time and title/organizer) */
.event-content {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.event-content .time {
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
  color: #000;
}
.event-content .subtle {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 500px;
  color: var(--text-subtle);
}

.event-location {
  color: var(--text);
}

.event-title {
  color: var(--text);
  opacity: 0.6;
}

.event-content .subtle-w {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  color: var(--text-subtle);
}


/* Modal overlay and box */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 3000 !important;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 600px;
  max-width: 95vw;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  font-size: 18px;
  z-index: 3000 !important;
}
.modal-filter .modal-box {
	width: 700px;
}
.modal-settings .modal-box {
	width: 430px;
}
.modal-create-user .modal-box {
	width: 430px;
}
.modal-create-contact .modal-box {
	width: 430px;
}
.modal-edit-user .modal-box {
	width: 430px;
}
.modal-edit-contact .modal-box {
	width: 430px;
}
.modal-users .modal-box {
	width: 800px;
}
.modal-contacts .modal-box {
	width: 800px;
}
.modal-orgs .modal-box {
	width: 700px;
}
.modal-create-org .modal-box {
	width: 500px;
}
.modal-create-org .modal-box .modal-body {
  height: 300px;
}
.modal-edit-org .modal-box {
	width: 500px;
}
.modal-edit-org .modal-box .modal-body {
  height: 300px;
}
.modal-create-location .modal-box {
	width: 500px;
}
.modal-create-location .modal-box .modal-body {
  height: 300px;
}
.modal-edit-location .modal-box {
	width: 500px;
}
.modal-edit-location .modal-box .modal-body {
  height: 300px;
}
.modal-reserve .modal-box {
	width: 300px;
}
.modal-login .modal-box {
	width: 300px;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  margin-bottom: 16px;
  border-bottom: 1px solid #000;
}
.modal-title {
  font-size: 20px;
}
.modal-close {
  cursor: pointer;
  font-size: 25px;
}
.modal-close i {
  color: #000 !important;
}
.modal-body {
  max-height: 80vh;
  overflow-y: auto;
}
.modal-body table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0px;
}
.modal-body td {
  padding: 6px 0;
  border-bottom: 1px solid #ddd;
  vertical-align: top;
}
.modal-body td:first-child {
  font-weight: bold;
  width: 30%;
  white-space: nowrap;
  color: #333;
  text-align: left;
}
.modal-body td:last-child {
  width: 70%;
  color: #222;
  text-align: left;
}
.modal-footer {
  text-align: right;
  margin-top: 5px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-footer-center {
  text-align: center;
  margin-top: 5px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.modal-body input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 25px;
  height: 25px;
  border: 2px solid var(--main, #333);
  border-radius: 4px;
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-body input[type="checkbox"]:checked {
  background-color: var(--main, #492f88);
  border-color: var(--main, #492f88);
}

.modal-body input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;       
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: translate(-50%, -58%) rotate(45deg);
  box-sizing: content-box;
}

.select2-container--open {
  z-index: 5000 !important;
}

.select2-container--open {
  z-index: 5000 !important;
}

.modal-body .select2-container { width: 100% !important; }

.modal-body .select2-container--default .select2-selection--single {
  min-height: 44px;
  height: auto;
  border: 2px solid var(--input-border, #8aa0b3);
  border-radius: 8px;
  background: #fff;
  padding: 10px 36px 10px 12px;
  display: flex;
  align-items: center;
  transition: border-color .2s ease, box-shadow .2s ease;
  box-sizing: border-box;
}

.modal-body .select2-container--default.select2-container--focus .select2-selection--single,
.modal-body .select2-container--default .select2-selection--single:focus {
  border-color: var(--main, #492f88);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--main, #492f88) 20%, transparent);
}

.modal-body .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  font-size: 14px;
  color: var(--text, #1b2a3a);
  padding: 0;
  display: flex;
  align-items: center;
  height: 100%;
}

.modal-body .select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: #9aa7b2;
}

.modal-body .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  width: 28px;
  right: 6px;
}

.modal-body .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text, #1b2a3a) transparent transparent transparent;
  border-width: 6px 5px 0 5px;
  margin-left: -5px;
  margin-top: -2px;
}

.modal-body .select2-container--default.select2-container--disabled .select2-selection--single {
  background: #f5f7fa;
  opacity: .75;
  cursor: not-allowed;
}

.modal-body .select2-container .select2-dropdown {
  border: 2px solid var(--input-border, #8aa0b3);
  border-radius: 8px;
  overflow: hidden;
}

.modal-body .select2-results__option {
  padding: 8px 12px;
  font-size: 14px;
}

.modal-body .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
  background: var(--main, #492f88);
  color: #fff;
}

/* Safari-specific fix for Select2 height to match input fields */
@supports (-webkit-appearance: none) {
  .modal-body .select2-container--default .select2-selection--single {
    min-height: 44px;
    height: 44px;
  }
  
  .modal-body .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 24px;
  }
}

.btn.btn-green {
  background: #2e7d32;
  padding: 6px 12px;
  font-size: 14px;
  margin-top: 1rem;
  border: none;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}
.btn.btn-green:hover {
  background: #1b5e20;
}

/* Modal buttons */
.btn-create-user,
.btn-create-org,
.btn-create-location,
.btn-create-contact,
.modal-button {
  background: var(--main, #492f88);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-create-user:hover,
.btn-create-org:hover,
.btn-create-location:hover,
.btn-create-contact:hover,
.modal-button:hover,
#edit-event:hover,
.btn-primary:hover {
  background: var(--main-hover, #5a3a9e);
}

.btn-create-user:disabled,
.btn-create-org:disabled,
.btn-create-location:disabled,
.btn-create-contact:disabled,
.modal-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.modal-button-red,
#rec-cancel {
  background: #dc3545 !important;
  font-size: 14px;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  font-weight: bold;
}

.modal-button-red:hover,
#rec-cancel:hover {
  background: #c82333 !important;
}

.modal-actions{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-top:16px;
}
.modal-actions .left{
  display:flex;
  align-items:center;
  gap:8px;
}
.modal-actions .right{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
}


#weekly-wrapper {
  width: 90vw;
  max-width: 90vw;
  margin: 0 auto;
  overflow-x: auto;
  background: var(--background);
}

#weekly-wrapper table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  table-layout: fixed;
}

#weekly-wrapper th.weekly-day-header {
  width: 100px;
}

#weekly-wrapper th.corner {
  width: 50px;
}


#weekly-wrapper th,
#weekly-wrapper td {
  border: 1px solid #ccc;
  padding: 6px;
  position: relative;
  vertical-align: top;
}

#weekly-wrapper thead th {
  background: var(--main);
  color: #fff;
  font-weight: bold;
  text-align: center;
  border: 2px solid var(--outline-dark);
}

#weekly-wrapper tbody th {
  background: var(--background);
  color: var(--text-subtle);
  border-right: 2px solid #ddd;
}

#weekly-wrapper .weekly-event-content{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:0}
#weekly-wrapper .weekly-event-content .title{font-weight:bold;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}
#weekly-wrapper .weekly-event-content .location{color:var(--text-subtle);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}
#weekly-wrapper td.weekly-day-cell{overflow:hidden}
#weekly-wrapper .weekly-event-default,
#weekly-wrapper .weekly-event-reservation,
#weekly-wrapper .weekly-event-allday{overflow:hidden}

#weekly-wrapper .weekly-event-default,
#weekly-wrapper .weekly-event-reservation,
#weekly-wrapper .weekly-event-allday {
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px transparent;
  transition: background-color 0.2s, box-shadow 0.2s;
}

#weekly-wrapper .weekly-event-default {
  background: var(--event);
  color: var(--text);
  box-shadow: inset 0 0 0 2px lightskyblue;
}
#weekly-wrapper .weekly-event-default:hover {
  background: var(--hover);
  box-shadow: inset 0 0 0 2px var(--secondary);
}

#weekly-wrapper .weekly-event-reservation {
  background: #b8eeb4;
  box-shadow: inset 0 0 0 2px #5ebe52;
}

#weekly-wrapper .weekly-event-reservation:hover {
  background: #d8f5d4;
  color: var(--text);
  box-shadow: inset 0 0 0 2px #7bdc83;
}

#weekly-wrapper .weekly-event-allday {
  background: var(--secondary);
  color: #fff;
  box-shadow: inset 0 0 0 2px var(--main);
}
#weekly-wrapper .weekly-event-allday:hover {
  background: var(--secondary-hover);
  box-shadow: inset 0 0 0 2px var(--main-hover);
}

#weekly-wrapper td.weekly-day-last {
  border-right: 2px solid var(--outline);
}

#weekly-wrapper th.weekly-time-cell {
  background: var(--background);
  border-left: 2px solid var(--outline);
  border-right: 2px solid var(--outline);
  color: var(--text-subtle);
}
.event-container.has-overflow .event-wrapper {
  background: #fff;
  z-index: 5001;
}

body.modal-open .event-container.has-overflow:hover {
  z-index: 1; /* posuň popup menu dolů, když je otevřený modal */
}

.modal-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--text);
}

.label-checkbox {
  flex-direction: row !important;
  justify-content: left;
  align-items: center;
}

.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="date"],
.modal-body input[type="email"],
.modal-body input[type="password"],
.modal-body input[type="time"],
.modal-body input[type="datetime-local"],
.modal-body textarea,
.modal-body select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--outline);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
}

.modal-body input[disabled],
.modal-body input[readonly]{
  background:#e6eaec;
  color: var(--text);
  cursor: not-allowed;
  opacity: 1;
}

.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
  border-color: var(--secondary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,174,239,0.15);
}

@media (max-width: 1800px) {
  #calendar {
    width: 100%;
    max-width: 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    overflow: visible;
  }
  #weekly-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow: visible;
  }
  .toolbar-inner { 
    flex-wrap: wrap; 
  }
  .month-wrapper { 
    position: static; transform: none; left: auto; order: 2; width: 100%; justify-content: center; 
  }
  #calendar-wrapper {
    overflow: visible;
  }
  #loading #skeleton-calendar {
    width: 100%;
    max-width: 100%;
  }
}

@media screen and (max-width: 940px) {
  .logo__subtitle {
    display: none;
  }
  .event-content .subtle-w{
    display: none !important;
  }
  .subtle{
    display: none !important;
  }
  .event-content .time {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 800px) {
  .toolbar-inner {
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
  }
  .month-wrapper {
    position: static;
    transform: none;
    margin: 0.5rem 0;
    justify-content: center;
  }
  .logo__subtitle {
    display: inline-block;
  }
  .logo, .icon-toolbar {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 500px) {
  .toolbar {
    position: sticky;
    top: 0;
    left: 0;
  }
  .day {
    padding: 2px;
  }
  .label-primary {
    width: 1.3em;
    height: 1.3em;
    line-height: 1.3em;
    font-size: 12px;
    padding: 2px;
  }
  .event-sp,
  .event-db {
    font-size: 12px;
    padding: 2px 4px;
  }
  #weekly-calendar {
  	min-width: 800px;
  }
  #weekly-wrapper {
    overflow-x: scroll;
    width: 100%;
  }
  .event-content .subtle-w{
    display: block !important;
  }
}

@media (hover: none) and (pointer: coarse) {
  .event-container.has-overflow:hover .event-wrapper {
    position: relative;
    max-height: 5.9em;
    overflow: hidden;
    pointer-events: auto;
  }
  .event-container.expanded .event-wrapper {
    pointer-events: auto;
  }
}

/* NEW WEEKLY DISPLAY */
:root { --hour-h: 60px; --header-h: 30px; }
#weekly-calendar {
  display: grid;
  grid-template-columns: 30px repeat(7, 1fr);
  position: relative;
  border-top: 1px solid #ccc;
  border-left: 1px solid #ccc;
}
.cell {
  border-right: 1px solid #7d7d7d;
  border-bottom: 1px solid #ccc;
  position: relative;
  height: 60px;
  z-index: 1;
}
#weekly-wrapper {
  height: 80vh;
  overflow-y: auto;
  position: relative;
}
.header-week {
  display: grid;
  position: sticky;
  top: 0;
  z-index: 20;
  background: white;
  grid-template-columns: 30px repeat(7, 1fr);
  grid-column: 1 / -1;
  grid-row: 1;
}
.header-week .hcell {
  height: var(--header-h);
  background: var(--main, #492f88);
  color: #fff;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  justify-content: center;
  border-right: 1px solid #7d7d7d;
  border-bottom: 1px solid #ccc;
}
.header-week .hcell.today {
  background-color: var(--today) !important;
}
.header-week .hcell .hcell-inner {
  display: inline-flex;
  align-items: center;
  gap: 25px;
}
.header-week .hcell .hcell-inner span {
  margin-right: 10px;
}
.add-event-btn {
  position: static;
  margin: 0;
  width: 5px;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  color: #fff;
}
.add-event-btn:hover {
  color: var(--secondary);
  transform: scale(1.1);
}
.time { 
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.half-line { 
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px dashed #c9c9c9;
}
.overlay { 
  grid-row: 2 / span 24;
  position: relative;
}
.event {
  position: absolute;
  background: #e8e0f5;
  color: var(--text);
  border-radius: 5px;
  font-size: 13px;
  font-weight: bold;
  padding: 2px 4px;
  box-sizing: border-box;
  overflow: hidden;
  line-height: 1.2;
  z-index: 10;
}
.event:hover {
  background-color: var(--hover);
  outline: 2px solid var(--secondary);
  border-radius: 6px;
  outline-offset: -2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* TOOLBAR */
.icon-toolbar {
  display: flex;
  gap: 0px;
  align-items: center;
}
.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  width: 30px;
  position: relative;
  font-size: 26px;
  color: var(--text);
  transition: color 0.2s ease, transform 0.2s ease;
}
.icon-item span {
  font-size: 12px;
  color: #333;
  margin-bottom: 2px;
  margin-top: 0px;
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.icon-item:hover {
  color: var(--main);
  transform: translateY(2px);
}
.icon-item:hover span {
  opacity: 1;
  transform: translateY(0);
}

.user-labels {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 50px;
  max-width: 140px;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  align-self: stretch;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right:-15px;
  margin-left:0px;
  margin-bottom: 7px;
}
.user-labels span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}

.v-divider{
  position: relative;
  width: 1px;
  align-self: stretch;
  margin: 0 5px;
}
.v-divider::before{
  content:"";
  position:absolute;
  left:0; right:0;
  top:30%;
  bottom:0;
  background: linear-gradient(
    to bottom,
    transparent 0%,
    var(--divider, #ced0d4) 100%
  );
}

/* TOOLBAR SETTINGS */
.modal-body .form-row {
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body .form-row label {
  width: 100px;
  font-weight: 200;
  text-align: right;
  margin-top: 2px;
  margin-right: 10px;
}

/* ACTION BUTTONS */
.actions-cell {
  display: flex;
  gap: 10px;
  font-size: 18px;
  cursor: pointer;
  height: 15px;
}

.actions-cell i {
  opacity: 0.5;
  transition: 0.2s;
}

.action-edit:hover {
  opacity: 1;
  color: var(--main);
}

.action-delete:hover {
  opacity: 1;
  color: #c00;
}

/* TOOLBAR USERS */
.users-modal-box {
  max-height: 800px;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.users-fixed-top {
  padding: 10px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 20;
}

.users-scroll-body {
  overflow-y: auto;
  max-height: 500px;
  padding: 0;
}

.users-table thead th {
  position: sticky;
  top: 0;
  background: #fafafa;
  z-index: 10;
  border-bottom: 2px solid #ddd;
}

.users-table td, 
.users-table th {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.users-table tr:hover {
  white-space: nowrap;
  background: #e3eef9;
}

.users-table tr td {
  border-bottom: 0px solid #ddd;
  height: 20px;
  padding: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.users-table thead th {
  text-align: left !important;
  padding-left: 5px;
  height: 25px;
}

.users-table {
  table-layout: fixed;
  width: 100%;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 210px;   /* Email */
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 110px;   /* Příjmení */
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  width: 60px;   /* Role */
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  width: 250px;   /* Organizace */
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  width: 45px;   /* Akce (ikony) */
  text-align: center;
}

/* CONTACTS TABLE - specific column widths */
.modal-contacts .users-table th:nth-child(1),
.modal-contacts .users-table td:nth-child(1) {
  width: 150px;   /* Příjmení */
}

.modal-contacts .users-table th:nth-child(2),
.modal-contacts .users-table td:nth-child(2) {
  width: 150px;   /* Jméno */
}

.modal-contacts .users-table th:nth-child(3),
.modal-contacts .users-table td:nth-child(3) {
  width: 200px;   /* Email */
}

.modal-contacts .users-table th:nth-child(4),
.modal-contacts .users-table td:nth-child(4) {
  width: 150px;   /* Telefon */
}

.modal-contacts .users-table th:nth-child(5),
.modal-contacts .users-table td:nth-child(5) {
  width: 45px;   /* Akce (ikony) */
  text-align: center;
}

/* TOOLBAR USER ORGS */
.org-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.org-row {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.org-delete {
  cursor: pointer;
  opacity: 0.5;
  transition: 0.2s;
}

.org-delete:hover {
  opacity: 1;
  color: #c00;
}

.org-input-wrapper {
  position: relative;
  width: 100%;
}

.org-input {
  width: 100%;
  padding: 6px 8px;
}

.org-dropdown {
  position: absolute;
  top: 34px;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  max-height: 150px;
  overflow-y: auto;
  display: none;
  z-index: 30;
  font-size: 14px;
}

.org-option {
  padding: 6px 10px;
  cursor: pointer;
}

.org-option:hover {
  background: #eee;
}

.org-add-btn {
  padding: 4px 10px;
  font-size: 14px;
  text-align: left;
  border:0px;
  background: none;
  border-radius: 10px;
}

.org-add-btn:hover {
  background: #d6e8f7;
}

.org-tag {
  display: inline-block;
  background: var(--main);
  color: white;
  padding: 2px 6px;
  margin: 0px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
}

/* TOOLBAR ORGANIZATIONS */
.orgs-modal-box {
  max-height: 700px;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.orgs-fixed-top {
  padding: 10px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 20;
}

.orgs-scroll-body {
  overflow-y: auto;
  max-height: 500px;
  padding: 0;
}

.orgs-table thead th {
  position: sticky;
  top: 0;
  background: #fafafa;
  z-index: 10;
  border-bottom: 2px solid #ddd;
}

.orgs-table td, 
.orgs-table th {
  white-space: nowrap;
  text-overflow: ellipsis;
}

.orgs-table tr:hover {
  white-space: nowrap;
  background: #e3eef9;
}

.orgs-table tr td {
  border-bottom: 0px solid #ddd;
  height: 20px;
  padding: 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.orgs-table thead th {
  text-align: left !important;
  padding-left: 5px;
  height: 25px;
}

.orgs-table {
  table-layout: fixed;
  width: 100%;
}

.orgs-table th:nth-child(1),
.orgs-table td:nth-child(1) {
  width: 290px;   /* Title */
}

.orgs-table th:nth-child(2),
.orgs-table td:nth-child(2) {
  width: 280px;   /* Zodpovedna osoba */
}

.orgs-table th:nth-child(3),
.orgs-table td:nth-child(3) {
  width: 45px;   /* Akce (ikony) */
  text-align: center;
}

/* RESPONSIBLE PERSON */
.dropdown-wrapper {
  width: 100%;
  position: relative;
}

.dropdown-list {
  position: absolute;
  top: 35px;
  left: 0;
  right: 0;
  border: 1px solid #ccc;
  background: white;
  max-height: 200px;
  overflow-y: auto;
  z-index: 20;
}

.dropdown-list.hidden {
  display: none;
}

.dropdown-item {
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
}

.dropdown-item span {
  font-size: 13px;
  padding-top: 3px;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: #f0f0f0;
}

.email-tag {
  white-space: nowrap;
  background: var(--main);
  color: white;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
}

/* Calendar footer – Facebook nad copyrightem, zarovnáno ke spodku (jako landing) */
.calendar-footer {
  width: 100%;
  margin-top: auto;
  padding-top: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-shrink: 0;
  text-align: center;
}
.calendar-footer-fb {
  display: block;
  color: var(--main);
  text-decoration: none;
  transition: color 0.2s ease, transform 0.2s ease;
}
.calendar-footer-fb:hover {
  color: var(--main-hover);
  transform: scale(1.15);
}
.calendar-footer-fb:active {
  transform: scale(1.05);
}
.calendar-footer-fb .bi-facebook {
  font-size: 2rem;
}
.calendar-copyright {
  display: block;
  font-size: 1rem;
  color: var(--text-subtle);
}
.calendar-copyright a {
  color: inherit;
  text-decoration: none;
}
.calendar-copyright a:hover {
  text-decoration: underline;
}
