/* ── Lernplan Planer – Main Stylesheet ───────────────────────────── */

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #1f2937;
  background: #f9fafb;
}
a { color: #4f46e5; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Container ──────────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 1rem 1.5rem; }

/* ── Navbar ─────────────────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem;
  background: #4f46e5;
  color: #fff;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.navbar a, .navbar button, .navbar span { color: #fff; }
.navbar-brand a { font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.navbar-links { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.navbar-links a { font-size: 0.9rem; text-decoration: none; opacity: 0.9; }
.navbar-links a:hover { opacity: 1; text-decoration: underline; }
.navbar-user { font-size: 0.85rem; opacity: 0.8; }
.semester-selector select {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.semester-selector select option { color: #1f2937; background: #fff; }

/* Dropdown */
.dropdown { position: relative; }
.dropdown-toggle {
  background: none; border: none; cursor: pointer;
  font-size: 0.9rem; opacity: 0.9; padding: 0;
}
.dropdown-toggle:hover { opacity: 1; }
.dropdown-menu {
  display: none; position: absolute; top: 100%; right: 0;
  background: #fff; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 160px; z-index: 100; padding: 0.25rem 0;
}
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu.show { display: block; }
.dropdown-menu a {
  display: block; padding: 0.4rem 1rem; color: #1f2937;
  font-size: 0.85rem;
}
.dropdown-menu a:hover { background: #f3f4f6; text-decoration: none; }

/* ── Flash messages ─────────────────────────────────────────────── */
.flash-messages { margin-bottom: 1rem; }
.flash {
  padding: 0.75rem 1rem; border-radius: 6px; margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.flash-success { background: #d1fae5; color: #065f46; }
.flash-danger { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }
.flash-info { background: #dbeafe; color: #1e40af; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-block; padding: 0.5rem 1rem; border: none; border-radius: 6px;
  font-size: 0.9rem; cursor: pointer; text-decoration: none; transition: background 0.15s;
}
.btn-primary { background: #4f46e5; color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: transparent; border: 1px solid #d1d5db; color: #374151;
}
.btn-outline:hover { background: #f3f4f6; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn.w-100 { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 0.75rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 0.25rem; }
.form-control {
  width: 100%; padding: 0.45rem 0.6rem; border: 1px solid #d1d5db; border-radius: 6px;
  font-size: 0.9rem; background: #fff;
}
.form-control:focus { outline: none; border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,0.2); }
input[type="color"].form-control {
  height: 2.4rem; padding: 0.2rem 0.3rem; cursor: pointer;
}
.form-error { color: #dc2626; font-size: 0.8rem; }
.form-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 200px; }
.inline-form { display: inline; }
.input-group { display: flex; gap: 0.5rem; }
.input-group .form-control { flex: 1; }

/* ── Tables ─────────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 0.6rem 0.75rem; text-align: left;
  border-bottom: 1px solid #e5e7eb; font-size: 0.9rem;
}
.table th { background: #f9fafb; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.table tr:hover { background: #f3f4f6; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1.25rem;
}
.card h2 { margin-top: 0; font-size: 1.1rem; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 4px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-muted { background: #e5e7eb; color: #6b7280; }
.badge-admin { background: #fee2e2; color: #991b1b; }
.badge-designer { background: #dbeafe; color: #1e40af; }
.badge-viewer { background: #e5e7eb; color: #6b7280; }

/* ── Subjects ───────────────────────────────────────────────────── */
.subjects-list { display: flex; flex-direction: column; gap: 0.75rem; }
.subject-card {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
  padding: 0.75rem 1rem;
}
.subject-info { display: flex; align-items: center; gap: 0.5rem; }
.color-swatch {
  width: 1rem; height: 1rem; border-radius: 3px; display: inline-block;
  border: 1px solid rgba(0,0,0,0.1);
}

/* ── Settings ───────────────────────────────────────────────────── */
.settings-section { margin-bottom: 2rem; }
.settings-section h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }

/* ── Pagination ─────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }

/* ── Auth ───────────────────────────────────────────────────────── */
.auth-container {
  max-width: 380px; margin: 4rem auto; padding: 2rem;
  background: #fff; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.auth-container h1 { text-align: center; margin-bottom: 1.5rem; font-size: 1.4rem; }
.auth-form .form-group { margin-bottom: 1rem; }

/* ── Utilities ──────────────────────────────────────────────────── */
.text-muted { color: #6b7280; font-size: 0.85rem; }

/* ── Offline banner ─────────────────────────────────────────────── */
.offline-banner {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: #fef3c7; color: #92400e; text-align: center; padding: 0.5rem;
  font-size: 0.85rem; z-index: 9999;
}
body.is-offline .offline-banner { display: block; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { flex-direction: column; align-items: flex-start; }
  .navbar-links { width: 100%; justify-content: flex-start; }
  .form-row { flex-direction: column; }
  .form-row .form-group { min-width: auto; }

  /* Dropdown: position inline in stacked navbar */
  .dropdown-menu {
    position: relative;
    top: auto;
    right: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  }

  /* FullCalendar toolbar: wrap and enlarge tap targets */
  .fc .fc-toolbar { flex-wrap: wrap; gap: 0.5rem; }
  .fc .fc-toolbar-chunk { display: flex; }
  .fc .fc-toolbar.fc-header-toolbar { margin-bottom: 0.75em; }
  .fc .fc-button {
    min-width: 44px;
    min-height: 44px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ── Calendar Event Types ───────────────────────────────────────── */

/* Shared: thick left border to indicate type */
.fc-event.event-lecture,
.fc-event.event-study_session,
.fc-event.event-exam {
  border-left-width: 4px !important;
  border-left-style: solid !important;
  position: relative;
  overflow: hidden;
}

/* Lecture – solid green border, subtle diagonal stripe */
.fc-event.event-lecture {
  border-left-color: #16a34a !important;
}
.fc-event.event-lecture::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 6px,
    rgba(22, 163, 74, 0.07) 6px,
    rgba(22, 163, 74, 0.07) 12px
  );
  pointer-events: none;
}

/* Session – dashed blue border */
.fc-event.event-study_session {
  border-left-color: #2563eb !important;
  border-left-style: dashed !important;
}
.fc-event.event-study_session::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 8px,
    rgba(37, 99, 235, 0.05) 8px,
    rgba(37, 99, 235, 0.05) 16px
  );
  pointer-events: none;
}

/* Exam – solid red border, crosshatch pattern, bolder text */
.fc-event.event-exam {
  border-left-color: #dc2626 !important;
  font-weight: 600;
}
.fc-event.event-exam::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 5px,
      rgba(220, 38, 38, 0.06) 5px,
      rgba(220, 38, 38, 0.06) 10px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 5px,
      rgba(220, 38, 38, 0.06) 5px,
      rgba(220, 38, 38, 0.06) 10px
    );
  pointer-events: none;
}

/* Type badge inside event */
.event-type-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: middle;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

/* Calendar legend */
.calendar-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: #374151;
  margin-left: auto;
}
.calendar-legend-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, 0.1);
}
.legend-swatch.swatch-lecture {
  background: #16a34a;
}
.legend-swatch.swatch-session {
  background: #2563eb;
}
.legend-swatch.swatch-exam {
  background: #dc2626;
}
