/* ==========================================================================
   Dischedule - Master Design System & Stylesheet
   ========================================================================== */

:root {
  /* Color Palette */
  --color-primary: #4F46E5;
  --color-primary-hover: #4338CA;
  --color-primary-light: #EEF2FF;
  --color-primary-focus: rgba(79, 70, 229, 0.25);

  --color-discord: #5865F2;
  --color-discord-hover: #4752C4;
  --color-discord-light: #F2F3FD;

  --color-success: #10B981;
  --color-success-bg: #ECFDF5;
  --color-danger: #EF4444;
  --color-danger-bg: #FEF2F2;
  --color-warning: #F59E0B;
  --color-warning-bg: #FFFBEB;
  --color-info: #0EA5E9;
  --color-info-bg: #F0F9FF;

  /* Neutrals (Light Theme) */
  --bg-body: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-subtle: #F1F5F9;
  --border-color: #E2E8F0;
  --border-light: #F1F5F9;

  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-subtle: #94A3B8;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Variables */
[data-theme="dark"] {
  --bg-body: #0B0F19;
  --bg-surface: #131B2E;
  --bg-subtle: #1E293B;
  --border-color: #243048;
  --border-light: #1E293B;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-subtle: #64748B;

  --color-primary-light: #1E1B4B;
  --color-discord-light: #1A1C3B;
  --color-success-bg: #064E3B;
  --color-danger-bg: #7F1D1D;
  --color-warning-bg: #78350F;
  --color-info-bg: #082F49;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.theme-transitioning,
body.theme-transitioning * {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease !important;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  text-decoration: none;
  opacity: 0.85;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* Layout Elements */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.app-sidebar {
  width: 260px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-discord));
  color: #FFF;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  padding: 0 12px 6px 12px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-item a:hover {
  color: var(--text-main);
  background-color: var(--bg-subtle);
}

.nav-item.active a {
  color: var(--color-primary);
  background-color: var(--color-primary-light);
  font-weight: 600;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
}

.nav-badge {
  margin-left: auto;
  background-color: var(--color-primary);
  color: #FFF;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Main Container */
.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: calc(100% - 260px);
  max-width: calc(100% - 260px);
  overflow-x: hidden;
  box-sizing: border-box;
}

.app-layout.no-sidebar .app-main,
.app-main.no-sidebar {
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* Navbar */
.app-navbar {
  height: 60px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.navbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 14px 8px 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background-color: var(--bg-subtle);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--color-primary);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1.2;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #FFF;
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--border-color);
}

.btn-discord {
  background-color: var(--color-discord);
  color: #FFF;
}
.btn-discord:hover {
  background-color: var(--color-discord-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background-color: var(--color-danger);
  color: #FFF;
}
.btn-danger:hover {
  background-color: #DC2626;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

/* Content Area */
.app-content {
  flex: 1;
  padding: 24px;
}

/* Cards */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.card-body {
  padding: 20px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  color: var(--text-main);
  font-size: 13.5px;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-focus);
}

.form-error {
  color: var(--color-danger);
  font-size: 12px;
  margin-top: 4px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 16px;
  overflow-y: auto;
}

.modal-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 580px;
  max-height: min(90vh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  margin: auto;
  border: 1px solid var(--border-color);
}

.modal-dialog form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background-color: var(--bg-surface);
}

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  overscroll-behavior: contain;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-subtle);
  flex-shrink: 0;
}

/* Toasts (Bottom-Right Positioned) */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 380px;
  padding: 14px 18px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transform: translateY(20px) scale(0.95);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.toast.show {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.toast-success { border-left: 4px solid var(--color-success); }
.toast-error   { border-left: 4px solid var(--color-danger); }
.toast-warning { border-left: 4px solid var(--color-warning); }
.toast-info    { border-left: 4px solid var(--color-info); }

/* Calendar Grid Engine */
.calendar-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
}

.calendar-header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 12px;
  background-color: var(--bg-surface);
}

.calendar-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-month-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-main);
  margin: 0;
  min-width: 150px;
}

.calendar-filters-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-view-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-mode-tabs {
  display: flex;
  background-color: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 2px;
}

.view-tab {
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: var(--transition);
}

.view-tab:hover {
  color: var(--text-main);
}

.view-tab.active {
  background-color: var(--bg-surface);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

/* Month Grid (Compact & Icon-Only, No Horizontal Overflow) */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  background-color: var(--border-color);
  border-bottom: 1px solid var(--border-color);
  gap: 1px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.calendar-day-head {
  background-color: var(--bg-subtle);
  padding: 7px 2px;
  text-align: center;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-cell {
  background-color: var(--bg-surface);
  height: 56px;
  min-height: 56px;
  max-height: 56px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  transition: background-color 0.15s ease;
  user-select: none;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
}

.calendar-cell:hover {
  background-color: var(--bg-subtle);
}

.calendar-cell.selected {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
  z-index: 4;
}

.calendar-cell.other-month {
  background-color: var(--bg-body);
  opacity: 0.35;
}

.calendar-cell.today {
  background-color: var(--color-primary-light);
}

.cell-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  line-height: 1;
}

.cell-date-num {
  font-weight: 700;
  font-size: 11px;
  color: var(--text-main);
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.calendar-cell.today .cell-date-num {
  background-color: var(--color-primary);
  color: #FFF;
}

.cell-count-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--color-primary);
  border: 1px solid var(--border-color);
  line-height: 1.1;
}

.cell-icons-row {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
  max-height: 20px;
  margin-top: auto;
}

.event-icon-badge {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.event-icon-badge:hover {
  transform: scale(1.2);
}

/* Interactive Floating Event Details Popover */
.calendar-popover {
  position: fixed;
  z-index: 1000;
  width: 320px;
  max-width: 90vw;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: none;
  animation: popoverFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.calendar-popover.active {
  display: block;
}

.popover-header {
  padding: 10px 14px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popover-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.popover-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 11px;
}

.popover-close:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

.popover-body {
  padding: 4px 0;
  max-height: 260px;
  overflow-y: auto;
}

.popover-event-item {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

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

.popover-event-item:hover {
  background-color: var(--bg-subtle);
}

.popover-event-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.popover-event-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-event-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.popover-footer {
  padding: 8px 14px;
  background-color: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@keyframes popoverFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(4px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Time Grid (Week / Day) */
.time-grid-container {
  display: flex;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  overflow-y: auto;
  max-height: 600px;
  width: 100%;
  max-width: 100%;
}

.time-grid-hours {
  width: 54px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-surface);
}

.time-grid-header-corner {
  height: 40px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.time-hour-slot {
  height: 48px;
  font-size: 11px;
  color: var(--text-subtle);
  text-align: right;
  padding-right: 8px;
  transform: translateY(-8px);
}

.time-grid-days {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(var(--day-cols, 7), minmax(0, 1fr));
  position: relative;
  min-width: 0;
  width: 100%;
}

.time-day-col {
  border-right: 1px solid var(--border-color);
  position: relative;
  height: 1192px; /* 40px header + 24 hours * 48px */
  min-width: 0;
}

.time-day-col.is-today-col {
  background-color: rgba(79, 70, 229, 0.02);
}

.time-day-col-header {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
  z-index: 6;
}

.col-date-badge {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.col-date-badge.active-badge {
  background-color: var(--color-primary);
  color: #FFF;
}

.time-slot-line {
  height: 48px;
  border-bottom: 1px dashed var(--border-color);
  cursor: pointer;
}

.time-slot-line:hover {
  background-color: var(--bg-subtle);
}

.current-time-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--color-danger);
  z-index: 10;
  pointer-events: none;
}

.current-time-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-danger);
}

.time-event-block {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 5px;
  padding: 2px;
  color: #FFF;
  font-size: 11.5px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  z-index: 5;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.time-event-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
  z-index: 8;
}

.time-event-title {
  font-weight: 700;
  font-size: 11.5px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.time-event-meta {
  font-size: 10px;
  opacity: 0.9;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.agenda-table-row {
  transition: background-color 0.15s ease;
}

.agenda-table-row:hover {
  background-color: var(--bg-subtle);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-primary { background-color: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background-color: var(--color-success-bg); color: var(--color-success); }
.badge-danger  { background-color: var(--color-danger-bg); color: var(--color-danger); }
.badge-warning { background-color: var(--color-warning-bg); color: var(--color-warning); }
.badge-info    { background-color: var(--color-info-bg); color: var(--color-info); }

/* Dropdown System */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown-menu {
  display: none;
  position: absolute;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 100;
  overflow: hidden;
  animation: dropdownFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-menu.show {
  display: block !important;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.dropdown-item:hover {
  background-color: var(--bg-subtle);
  color: var(--color-primary);
}

.dropdown-item i {
  color: var(--text-muted);
  font-size: 14px;
  transition: color 0.15s ease;
}

.dropdown-item:hover i {
  color: var(--color-primary);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 4px 0;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Rules */
@media (max-width: 1024px) {
  #sidebar-toggle-btn {
    display: inline-flex !important;
  }
  #sidebar-close-btn {
    display: inline-flex !important;
  }
  .app-sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow-xl);
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
  }
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 35;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 860px) {
  .calendar-header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px 14px;
  }
  .calendar-title-group {
    justify-content: space-between;
    width: 100%;
  }
  .calendar-filters-bar {
    width: 100%;
  }
  .calendar-filters-bar input,
  .calendar-filters-bar select {
    flex: 1;
    min-width: 100px;
  }
  .calendar-view-controls {
    justify-content: space-between;
    width: 100%;
  }
  .view-mode-tabs {
    flex: 1;
    justify-content: space-around;
  }
}

@media (max-width: 640px) {
  .app-content {
    padding: 12px;
  }
  .calendar-month-title {
    font-size: 15px;
  }
  .calendar-cell {
    min-height: 65px;
    padding: 3px 4px;
  }
  .cell-date-num {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }
  .event-pill {
    font-size: 9.5px;
    padding: 2px 4px;
  }
  .toast-container {
    bottom: 16px;
    right: 16px;
    max-width: calc(100vw - 32px);
  }
  .toast {
    min-width: 240px;
    padding: 10px 14px;
  }
  .navbar-search {
    display: none;
  }
}

