/* ─── Beehive Journal – Base Styles ─────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,600;0,700;0,800;1,400&family=Playfair+Display:wght@700;800&display=swap');

:root {
  --cream:    #feebda;
  --yellow:   #f8c200;
  --orange:   #e67610;
  --teal:     #c3e2da;
  /* Нейтральные — тёплый графит без коричневого */
  --dark:     #1a1a1a;
  --mid:      #888888;
  --light-bg: #fff9f4;
  --white:    #ffffff;
  --shadow:   0 4px 20px rgba(230,118,16,.10);
  --radius:   14px;
  --font-body: 'Nunito', sans-serif;
  --font-head: 'Playfair Display', serif;
  /* Сайдбар — оранжево-персиковый */
  --sidebar-bg:      #fff3e8;
  --sidebar-text:    #1a1a1a;
  --sidebar-muted:   #e67610;
  --sidebar-active:  #e67610;
  --sidebar-hover:   rgba(230,118,16,.12);
  --sidebar-border:  rgba(230,118,16,.22);
  --topbar-bg:       #fff8f2;
  --topbar-border:   #ffd8b0;
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--light-bg);
  color: var(--dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ── */
h1, h2, h3 { font-family: var(--font-head); }
h1 { font-size: 2rem; color: var(--dark); }
h2 { font-size: 1.5rem; color: var(--mid); }
h3 { font-size: 1.2rem; }
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.page-wrapper { display: flex; min-height: 100vh; }
.main-content {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  padding: 2rem;
  margin-left: 260px;
  transition: margin-left .3s;
}

/* ── Sidebar ── */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 4px 0 24px rgba(122,79,29,.18);
  border-right: 2px solid var(--sidebar-border);
}

.sidebar-logo {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: .75rem;
}
.sidebar-logo .logo-img {
  width: 40px; height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}
.sidebar-logo .logo-text .school-name {
  font-family: var(--font-head);
  font-size: 1.05rem;
  color: var(--sidebar-active);
  line-height: 1.2;
  font-weight: 800;
}
.sidebar-logo .logo-text .school-sub {
  font-size: .7rem;
  color: var(--sidebar-muted);
  margin-top: .1rem;
}

.sidebar-user {
  padding: .75rem 1.25rem;
  background: rgba(230,118,16,.08);
  margin: .75rem .75rem 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1px solid var(--sidebar-border);
}
.sidebar-user .user-avatar {
  width: 36px; height: 36px;
  background: var(--orange);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .9rem;
  color: white;
  flex-shrink: 0;
}
.sidebar-user .user-info small {
  font-size: .7rem; color: var(--sidebar-muted);
  display: block;
}
.sidebar-user .user-info strong {
  font-size: .82rem; color: var(--sidebar-text);
  display: block;
}

.sidebar-nav { padding: 1rem .75rem; flex: 1; }

.nav-section-label {
  font-size: .63rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sidebar-muted);
  padding: .6rem .5rem .2rem;
  margin-top: .5rem;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
}
.sidebar-nav a:hover { background: var(--sidebar-hover); text-decoration: none; color: var(--orange); }
.sidebar-nav a.active {
  background: var(--orange);
  color: white;
  text-decoration: none;
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 1rem .75rem;
  border-top: 1px solid var(--sidebar-border);
}
.sidebar-footer a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border-radius: 8px;
  color: var(--sidebar-muted);
  font-size: .85rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.sidebar-footer a:hover {
  background: var(--sidebar-hover);
  color: var(--orange);
  text-decoration: none;
}

/* ── Topbar ── */
.topbar {
  background: var(--topbar-bg);
  border-bottom: 2px solid var(--topbar-border);
  padding: .75rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(122,79,29,.08);
}
.topbar h1 { font-size: 1.4rem; color: var(--dark); }
.topbar .topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar .role-badge {
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.role-superadmin { background: var(--orange); color: white; }
.role-admin { background: var(--yellow); color: var(--dark); }
.role-teacher { background: var(--teal); color: var(--dark); }
.role-parent { background: var(--cream); color: var(--mid); }

/* ── Cards ── */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(0,0,0,.04);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--yellow), var(--orange));
}
.card-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--cream);
}

/* ── Stat Cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--cream);
  transition: transform .2s, border-color .2s;
}
.stat-card:hover { transform: translateY(-3px); border-color: var(--yellow); }
.stat-card .stat-icon { font-size: 2rem; margin-bottom: .4rem; }
.stat-card .stat-number {
  font-family: var(--font-head);
  font-size: 2rem;
  color: var(--orange);
  font-weight: 800;
}
.stat-card .stat-label { font-size: .8rem; color: var(--mid); font-weight: 600; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow); }
table.bee-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: .88rem;
}
.bee-table thead tr {
  background: #e67610;
  color: white;
}
.bee-table th {
  padding: .75rem 1rem;
  text-align: left;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
.bee-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--cream);
  vertical-align: middle;
}
.bee-table tbody tr:hover { background: #fffbf5; }
.bee-table tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary { background: var(--orange); color: white; border-color: var(--orange); }
.btn-primary:hover { background: #cf640c; border-color: #cf640c; color: white; text-decoration: none; }
.btn-secondary { background: var(--yellow); color: var(--dark); border-color: var(--yellow); }
.btn-secondary:hover { background: #e0ae00; color: var(--dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--orange); border-color: var(--orange); }
.btn-outline:hover { background: var(--orange); color: white; text-decoration: none; }
.btn-danger { background: #e53935; color: white; border-color: #e53935; }
.btn-danger:hover { background: #c62828; text-decoration: none; color: white; }
.btn-sm { padding: .3rem .7rem; font-size: .78rem; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--mid); }
.btn-ghost:hover { background: var(--cream); color: var(--dark); text-decoration: none; }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .35rem; color: var(--mid); }
.form-control {
  width: 100%;
  padding: .6rem .9rem;
  border: 2px solid var(--cream);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: .9rem;
  color: var(--dark);
  background: white;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  outline: none;
  border-color: white;
  box-shadow: 0 0 0 3px rgba(248,194,0,.2);
}
.form-control.is-invalid { border-color: #e53935; }
.invalid-feedback { color: #e53935; font-size: .8rem; margin-top: .25rem; }
.form-hint { font-size: .78rem; color: var(--mid); opacity: .7; margin-top: .25rem; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── Alerts / Flashes ── */
.alert {
  padding: .75rem 1.1rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border-left: 4px solid #43a047; }
.alert-danger  { background: #ffebee; color: #c62828; border-left: 4px solid #e53935; }
.alert-warning { background: #fff8e1; color: #e65100; border-left: 4px solid var(--yellow); }
.alert-info    { background: #e3f2fd; color: #1565c0; border-left: 4px solid #1e88e5; }

/* ── Decorative honeycomb BG ── */
.hex-bg {
  position: fixed;
  bottom: -80px; right: -80px;
  width: 300px; height: 300px;
  opacity: .04;
  pointer-events: none;
  z-index: 0;
}

/* ── Badges ── */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.badge-yellow { background: var(--yellow); color: var(--dark); }
.badge-orange { background: var(--orange); color: white; }
.badge-teal   { background: var(--teal);   color: var(--dark); }
.badge-cream  { background: var(--cream);  color: var(--mid); }
.badge-red    { background: #ffcdd2; color: #c62828; }
.badge-green  { background: #c8e6c9; color: #2e7d32; }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--cream);
}
.page-header h1 { font-size: 1.6rem; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--mid);
  opacity: .7;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: .5rem; }
.empty-state p { font-size: .95rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--orange); border-radius: 4px; }

/* ── Responsive ── */
/* ── Mobile ──────────────────────────────────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed;
  top: .75rem; left: .75rem;
  z-index: 300;
  width: 42px; height: 42px;
  background: var(--orange);
  border: none; border-radius: 10px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 10px rgba(230,118,16,.4);
}
.hamburger span {
  display: block; width: 22px; height: 2px;
  background: white; border-radius: 2px;
  transition: all .25s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 99;
}

@media (max-width: 860px) {
  .hamburger { display: flex; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .28s ease;
    z-index: 200;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,.3);
  }
  .sidebar-overlay.open { display: block; }

  .main-content {
    margin-left: 0;
    padding: 1rem;
    padding-top: 60px; /* space for hamburger */
  }
  .topbar { padding-left: 4rem; /* space for hamburger */ }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .journal-scroll-container { border-radius: 8px; }
}

/* ─── Birthday Widget ────────────────────────────────────────────────────── */
.birthday-widget {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  width: 240px;
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(230,118,16,.22);
  border: 2px solid var(--yellow);
  z-index: 200;
  overflow: hidden;
  font-family: var(--font-body);
}

.bw-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .75rem;
  background: linear-gradient(135deg, var(--yellow), var(--orange));
  color: white;
  font-weight: 700;
  font-size: .83rem;
  cursor: pointer;
  user-select: none;
}
.bw-header:hover { filter: brightness(1.05); }

.bw-badge {
  background: white;
  color: var(--orange);
  border-radius: 20px;
  padding: .05rem .4rem;
  font-size: .7rem;
  font-weight: 800;
  margin-left: auto;
}
.bw-toggle { font-size: .7rem; margin-left: .25rem; }

.bw-body {
  max-height: 280px;
  overflow-y: auto;
  padding: .3rem .5rem;
}

.bw-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .3rem;
  border-radius: 8px;
  margin-bottom: 2px;
  transition: background .12s;
}
.bw-item:hover { background: var(--cream); }
.bw-item.bw-today  { background: #fff8e1; border: 1px solid var(--yellow); }
.bw-item.bw-soon   { background: #fff3e0; }

.bw-avatar {
  width: 30px; height: 30px;
  background: var(--yellow);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem;
  color: var(--dark);
  flex-shrink: 0;
}
.bw-today .bw-avatar { background: var(--orange); color: white; }

.bw-info { flex: 1; min-width: 0; }
.bw-name {
  font-weight: 700; font-size: .78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--dark);
}
.bw-cls { font-size: .68rem; color: var(--mid); }

.bw-date { text-align: right; flex-shrink: 0; }
.bw-today-label { font-size: .7rem; font-weight: 800; color: var(--orange); }
.bw-soon-label  { font-size: .7rem; font-weight: 700; color: #e65100; }
.bw-days-num    { font-size: .75rem; font-weight: 800; color: var(--mid); }
