/* ─── Global ─────────────────────────────────────────────────────────────── */
body {
  background: #f0f2f5;
  font-size: 0.9rem;
}

.main-content {
  padding: 0 1.5rem 2rem;
  max-width: 100%;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-size: 3rem;
  text-align: center;
  color: #0d6efd;
  margin-bottom: 0.5rem;
}

/* ─── Page header ─────────────────────────────────────────────────────────── */
.page-header {
  padding: 1.25rem 0 1rem;
  border-bottom: 2px solid #dee2e6;
  margin-bottom: 1.25rem;
}

/* ─── Flash messages ──────────────────────────────────────────────────────── */
.flash-container {
  margin-top: 1rem;
}

/* ─── Role badges ─────────────────────────────────────────────────────────── */
.role-badge-admin   { background-color: #dc3545; color: #fff; padding: .25em .6em; border-radius: .375rem; font-size: .75em; }
.role-badge-editor  { background-color: #0d6efd; color: #fff; padding: .25em .6em; border-radius: .375rem; font-size: .75em; }
.role-badge-viewer  { background-color: #6c757d; color: #fff; padding: .25em .6em; border-radius: .375rem; font-size: .75em; }

/* ─── Events table ────────────────────────────────────────────────────────── */
.events-table {
  font-size: 0.85rem;
  min-width: 900px;
}

.events-table thead th {
  white-space: nowrap;
  font-weight: 600;
  vertical-align: middle;
}

.events-table td {
  vertical-align: middle;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.events-table .notes-cell {
  max-width: 150px;
}

.events-table tr.editable-row:hover {
  background: #f8f9ff;
  cursor: pointer;
}

.events-table .row-actions {
  white-space: nowrap;
  width: 90px;
}

.events-table .row-actions .btn {
  padding: 0.15rem 0.4rem;
  font-size: 0.8rem;
}

/* Tags in table */
.tag-pill {
  display: inline-block;
  background: #e7f3ff;
  color: #0d6efd;
  border: 1px solid #b6d4fe;
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 0.78rem;
  margin: 1px;
  white-space: nowrap;
}

/* Inline edit row */
.inline-edit-row td {
  background: #fffbeb !important;
  vertical-align: middle;
}

.inline-edit-row input,
.inline-edit-row select,
.inline-edit-row textarea {
  min-width: 0;
}

/* ─── Column settings panel ───────────────────────────────────────────────── */
.col-settings-panel {
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ─── Calendar ────────────────────────────────────────────────────────────── */
#fullCalendar {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  min-height: 600px;
}

.fc-event {
  cursor: pointer;
  font-size: 0.8rem;
  border-radius: 4px !important;
}

/* ─── Event modal ─────────────────────────────────────────────────────────── */
.modal-xl { max-width: min(95vw, 1100px); }

/* Meta block */
.meta-block {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: #555;
  border: 1px solid #dee2e6;
}

/* ─── History ─────────────────────────────────────────────────────────────── */
.history-list {
  max-height: 500px;
  overflow-y: auto;
}

.history-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child { border-bottom: none; }

.changes-list { font-size: 0.82rem; }

.change-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 2px;
}

.change-field {
  font-weight: 600;
  min-width: 120px;
  color: #555;
}

.change-old {
  background: #ffeef0;
  color: #cb2431;
  padding: 1px 5px;
  border-radius: 3px;
  text-decoration: line-through;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-new {
  background: #e6ffed;
  color: #22863a;
  padding: 1px 5px;
  border-radius: 3px;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Notification rows in modal ──────────────────────────────────────────── */
.notif-row {
  background: #f8f9fa;
  position: relative;
}

/* ─── Tagify customizations ───────────────────────────────────────────────── */
.tagify {
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  min-height: 38px;
  --tag-bg: #e7f3ff;
  --tag-text-color: #0d6efd;
  --tag-border-color: #b6d4fe;
}

.tagify:focus-within {
  border-color: #86b7fe;
  box-shadow: 0 0 0 0.25rem rgba(13,110,253,.25);
}

/* ─── Loading spinner overlay ─────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-content { padding: 0 0.75rem 2rem; }
  .page-header  { flex-wrap: wrap; }
  .events-table td, .events-table th { font-size: 0.78rem; }
}

/* ── Responsible persons autocomplete ─────────────────── */
.ac-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    right: 0;
    z-index: 1055;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    max-height: 200px;
    overflow-y: auto;
    padding: 4px 0;
}
.ac-item {
    padding: 7px 14px;
    cursor: pointer;
    font-size: .9rem;
    outline: none;
}
.ac-item:hover,
.ac-item:focus { background: #e8f0fe; }

/* ── Conflict alert inside modal ──────────────────────── */
#conflictAlert { animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

/* ── Today row highlight ───────────────────────────── */
tr.today-anchor td {
    background: #fff8e1 !important;
    border-top: 2px solid #ffc107 !important;
    border-bottom: 2px solid #ffc107 !important;
}
tr.today-anchor td:first-child::before {
    content: "▶ ";
    color: #ffc107;
    font-size: .7rem;
}

/* ── Double-click row hint ─────────────────────────── */
tr.event-row:hover td { background: rgba(13, 110, 253, .04); }
tr.event-row { cursor: pointer; }
/* Prevent dblclick opening modal when clicking action buttons */
tr.event-row td.col-actions { cursor: default; }
