/* === Vacation Calendar — Industrial Warm === */

:root {
  --bg: #F5F2ED;
  --bg-card: #FFFFFF;
  --bg-hover: #EDE9E3;
  --text: #2C2825;
  --text-muted: #8A837A;
  --text-light: #B5AFA7;
  --border: #E0DBD4;
  --border-strong: #C8C1B8;

  --accent: #D4622B;
  --accent-light: #F4DDD0;
  --accent-hover: #BF5524;

  --weekend: #E8E4F0;
  --holiday: #F2D4D4;
  --holiday-border: #D4897A;
  --preholiday: #FFF3DA;
  --today-bg: #FFF8E0;
  --today-ring: #E8B830;
  --selected: #D4E8F0;

  --birthday-gradient: linear-gradient(135deg, #F7C59F, #E8A87C);

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(44,40,37,0.06);
  --shadow-md: 0 4px 12px rgba(44,40,37,0.08);
  --shadow-lg: 0 8px 30px rgba(44,40,37,0.12);
  --transition: 0.2s ease;

}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Manrope', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* === Header === */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__logo {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  object-fit: contain;
}

.header__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header__subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.header__controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header__year {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  min-width: 60px;
  text-align: center;
  color: var(--accent);
}

.header__actions {
  display: flex;
  gap: 8px;
}

/* === Buttons === */

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
  padding: 8px 10px;
  font-size: 18px;
  line-height: 1;
}
.btn--ghost:hover { background: var(--bg-hover); }

.btn--outline {
  background: transparent;
  border: 1.5px solid var(--border-strong);
  color: var(--text);
}
.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--primary {
  background: var(--accent);
  color: white;
}
.btn--primary:hover { background: var(--accent-hover); }

.btn--danger {
  background: transparent;
  color: #B54A3A;
  border: 1.5px solid #D4897A;
}
.btn--danger:hover {
  background: #FDF0EE;
}

.btn--small {
  font-size: 12px;
  padding: 5px 10px;
}

.btn--full { width: 100%; justify-content: center; }

.btn--icon {
  padding: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  border-radius: 6px;
}
.btn--icon:hover { background: var(--bg-hover); color: var(--text); }

/* === Filter Bar === */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  border-radius: 20px;
  background: var(--bg);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}
.filter-chip:hover { border-color: var(--border-strong); }
.filter-chip.active { border-color: currentColor; background: var(--bg-card); }
.filter-chip.inactive { opacity: 0.35; }

.filter-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: var(--transition);
}
.filter-chip.active .filter-chip__dot { border-radius: 3px; }

.filter-chip__vac-date {
  color: var(--text-muted);
  font-weight: 500;
  margin-left: 2px;
}

/* === Calendar Grid === */

.calendar {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 20px 24px 40px;
}

@media (min-width: 1800px) {
  .calendar { grid-template-columns: repeat(6, 1fr); }
}

@media (min-width: 1400px) and (max-width: 1799px) {
  .calendar { grid-template-columns: repeat(4, 1fr); }
}

/* === Month Card === */

.month {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: visible;
  transition: box-shadow var(--transition);
}
.month:hover { box-shadow: var(--shadow-md); }

.month__name {
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.month__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px;
}

.month__dow {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-light);
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* === Day Cell === */

.day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  overflow: visible;
  user-select: none;
}
.day:hover { background: var(--bg-hover); }
.day.empty { cursor: default; background: transparent; }
.day.empty:hover { background: transparent; }

.day__num {
  font-size: 13px;
  font-weight: 600;
  position: relative;
  z-index: 2;
  line-height: 1;
}

.day.weekend { background: var(--weekend); }
.day.weekend:hover { background: #DCD8EA; }
.day.holiday { background: var(--holiday); outline: 1.5px solid var(--holiday-border); outline-offset: -1.5px; }
.day.preholiday { background: var(--preholiday); }
.day.today {
  background: var(--today-bg);
  box-shadow: 0 0 0 2px var(--today-ring);
  z-index: 3;
  animation: pulse-today 3s ease-in-out infinite;
}

@keyframes pulse-today {
  0%, 100% { box-shadow: 0 0 0 2px var(--today-ring); }
  50% { box-shadow: 0 0 0 4px rgba(232,184,48,0.3); }
}

.day.selected {
  background: var(--selected) !important;
  outline: 2px solid #7AB8D4;
  outline-offset: -2px;
}

.day__bd {
  position: absolute;
  top: 1px;
  right: 1px;
  font-size: 10px;
  line-height: 1;
  z-index: 2;
}

/* Vacation bars inside day cells */
.day__bars {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  display: flex;
  flex-direction: column-reverse;
  gap: 1px;
  z-index: 1;
}

.vac-bar {
  height: 4px;
  border-radius: 2px;
  opacity: 0;
  transition: opacity var(--transition);
}
.vac-bar.visible { opacity: 0.85; }
.vac-bar:hover { opacity: 1; }

/* === Day Tooltip === */

.day__tip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 100;
  line-height: 1.4;
}
.day__tip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--text);
}
.day:hover .day__tip { opacity: 1; }

/* === Birthday Badge (in header) === */

.header__bd {
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--birthday-gradient);
  font-size: 12px;
  font-weight: 600;
  color: #5A3A1A;
  white-space: nowrap;
}

/* === Birthdate selects in edit form === */

.bd-select {
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.bd-select:focus { outline: none; border-color: var(--accent); }

.bd-year-input {
  width: 110px;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.bd-year-input:focus { outline: none; border-color: var(--accent); }

/* === Popup / Modal === */

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,40,37,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.popup {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 360px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: slide-up 0.2s ease;
}

.popup--wide { width: 480px; }

@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.popup__close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  transition: var(--transition);
}
.popup__close:hover { background: var(--bg-hover); color: var(--text); }

.popup__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-right: 30px;
}

.popup__dates {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 500;
}

.popup__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 50vh;
  overflow-y: auto;
}

.popup__emp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-size: 13px;
  font-weight: 500;
}
.popup__emp-item:hover { background: var(--bg-hover); }

.popup__emp-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* === Side Panel === */

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44,40,37,0.3);
  z-index: 200;
  animation: fade-in 0.15s ease;
}

.panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slide-in-right 0.2s ease;
}

@keyframes slide-in-right {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel__header h3 {
  font-size: 16px;
  font-weight: 700;
}

.panel__content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.panel__footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

/* Employee list in panel */
.emp-card {
  padding: 10px 12px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: var(--transition);
  gap: 8px;
}
.emp-card:hover { background: var(--bg-hover); }

.emp-card__info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.emp-card__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.emp-card__name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emp-card__meta {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

/* Employee edit form */
.form-group {
  margin-bottom: 14px;
}
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group input[type="text"],
.form-group input[type="date"] {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--transition);
}
.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.vac-list {
  margin-top: 16px;
}
.vac-list__title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.vac-list__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.vac-list__item:last-child { border-bottom: none; }

.vac-list__dates {
  flex: 1;
  font-weight: 500;
}

.vac-list__add {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.vac-list__add input {
  padding: 6px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 12px;
  background: var(--bg);
  width: 130px;
}
.vac-list__add input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* === Birthday Modal === */

.popup--birthday {
  text-align: center;
  padding: 36px 24px;
}

.bd-icon { font-size: 48px; margin-bottom: 12px; }
.bd-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}
.bd-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}
.bd-age {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* === Vacation context tooltip === */
.vac-tooltip {
  position: fixed;
  background: var(--text);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  z-index: 300;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  max-width: 250px;
  line-height: 1.5;
}

/* === Responsive === */

@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 10px;
  }
  .calendar {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  .filter-bar { padding: 8px 16px; }
  .panel { width: 100vw; }
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Selection hint === */
.selection-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 100;
  animation: slide-up 0.2s ease;
  pointer-events: none;
}
