:root {
  --primary: #0b3d91;
  --secondary: #2563eb;
  --blue-deep: #0f172a;
  --teal: #08a0c9;
  --accent: #f59e0b;
  --light: #f8fafc;
  --white: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: linear-gradient(180deg, #f7fbff 0%, #eef5ff 100%);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font: inherit;
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(10, 33, 76, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #fbbf24);
  display: grid;
  place-items: center;
  color: var(--primary);
  font-weight: 800;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: rgba(255,255,255,0.9);
  padding: 10px 12px;
  border-radius: 10px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.nav-link:hover,
.nav-item.active > .nav-link {
  background: rgba(255,255,255,0.08);
  color: var(--white);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 16px);
  left: 0;
  min-width: 230px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.2s ease;
}

.nav-item:hover .dropdown-menu,
.nav-item:focus-within .dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 10px 12px;
  color: var(--white);
  border-radius: 10px;
  font-size: 0.92rem;
}

.dropdown-menu a:hover {
  background: rgba(255,255,255,0.06);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
}

.search-wrap input {
  background: transparent;
  border: none;
  color: var(--white);
  padding: 10px 14px;
  width: 180px;
  outline: none;
}

.search-wrap input::placeholder {
  color: rgba(255,255,255,0.7);
}

.search-wrap button,
.btn,
.primary-btn,
.secondary-btn,
.card-btn {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

.primary-btn,
.btn-primary {
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: var(--white);
  box-shadow: 0 12px 24px rgba(37,99,235,0.28);
}

.primary-btn:hover,
.btn-primary:hover {
  transform: translateY(-1px);
}

.secondary-btn,
.btn-secondary {
  background: rgba(15, 23, 42, 0.06);
  color: var(--primary);
}

.mobile-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  background: transparent;
  color: var(--white);
}

.hero {
  background: linear-gradient(120deg, rgba(11, 61, 145, 0.94), rgba(8, 160, 201, 0.55)), url('../images/fon.jpg') center/cover no-repeat;
  color: var(--white);
  padding: 120px 0 90px;
  position: relative;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 30px;
  align-items: center;
}

.kicker {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: rgba(255,255,255,0.78);
}

.hero h1 {
  margin: 18px 0 14px;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.1;
}

.hero p {
  font-size: 1.05rem;
  color: rgba(255,255,255,0.9);
  max-width: 620px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
}

.hero-card {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card h3 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

.hero-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.hero-card li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.9);
}

.section {
  padding: 80px 0;
}

.section-header {
  margin-bottom: 28px;
}

.section-header h2 {
  margin: 0 0 10px;
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  color: var(--primary);
}

.section-header p {
  margin: 0;
  color: var(--muted);
}

.stats-grid,
.grid-4,
.card-grid {
  display: grid;
/* more compact and responsive layout for teacher cards */
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 14px;
}

.stat-card,
.feature-card,
.info-card,
.teacher-card,
.student-card,
.program-card,
.contact-card,
.admin-panel,
.table-card,
.page-card,
.timeline-card {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.06);
}

.stat-card {
  padding: 26px 20px;
  text-align: center;
}

.stat-card .value {
  font-size: clamp(2rem, 3vw, 2.8rem);
  font-weight: 800;
  color: var(--primary);
}

.stat-card .label {
  font-size: 1rem;
  color: var(--muted);
  margin-top: 8px;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
}

.image-frame {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.image-frame img {
  width: 100%;
  height: 440px;
  object-fit: cover;
}

.content-block h2 {
  color: var(--primary);
  margin-top: 0;
  font-size: clamp(2rem, 3vw, 2.8rem);
}

.content-block p {
  color: var(--muted);
}

.timeline {
  position: relative;
  display: grid;
  gap: 22px;
  margin-top: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(37,99,235,0.2);
  transform: translateX(-50%);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: center;
}

.timeline-item:nth-child(even) .timeline-content {
  grid-column: 2;
}

.timeline-item:nth-child(odd) .timeline-content {
  grid-column: 1;
}

.timeline-item .timeline-year {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--white);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.timeline-content {
  margin-top: 38px;
  padding: 22px 20px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.95);
  border: 1px solid var(--border);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.timeline-content h3 {
  color: var(--primary);
  margin-top: 0;
}

.filter-bar,
.form-grid,
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.filed-form,
.form-card,
.panel-box,
.result-box {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.05);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

input, select, textarea {
  width: 100%;
  border: 1px solid rgba(148,163,184,0.5);
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  color: var(--text);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.switch input {
  width: 18px;
  height: 18px;
}

.teacher-card,
.student-card,
.program-card {
  padding: 10px;
}
  
.teacher-card img,
.student-card img {
  width: 25%;
  /* smaller images for a compact teachers area */
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 10px;
}

/* Compact buttons inside teacher cards: reduce width and padding */
.teacher-card .card-actions,
.teacher-card .card-btn,
.teacher-card button {
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 8px;
  max-width: 140px;
  width: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.teacher-card h3,
.student-card h3,
.program-card h3,
.contact-card h3 {
  margin: 0 0 8px;
  color: var(--primary);
}

.meta-text {
  color: var(--muted);
  font-size: 0.95rem;
}

.page-banner {
  position: relative;
  min-height: 300px;
  display: grid;
  place-items: center;
  background: linear-gradient(120deg, rgba(11, 61, 145, 0.8), rgba(17, 24, 39, 0.64)), url('../images/fon.jpg') center/cover no-repeat;
  color: var(--white);
  padding: 80px 0;
}

.page-banner h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.5rem);
}

.breadcrumbs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: rgba(255,255,255,0.8);
  margin-top: 10px;
}

.department-header {
  background: linear-gradient(120deg, rgba(11, 61, 145, 0.8), rgba(17, 24, 39, 0.74));
  border-radius: 24px;
  overflow: hidden;
  color: var(--white);
  position: relative;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.department-header .inner {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(12px);
  padding: 28px 24px;
}

.department-header h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.contact-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
}

.map-frame {
  border: 0;
  border-radius: var(--radius);
  width: 100%;
  min-height: 420px;
  box-shadow: var(--shadow);
}

.contact-items {
  display: grid;
  gap: 16px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.contact-item strong {
  display: block;
  margin-bottom: 4px;
}

.footer {
  background: var(--blue-deep);
  color: rgba(255,255,255,0.82);
  padding: 60px 0 20px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
}

.footer h3 {
  color: var(--white);
  margin-top: 0;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.footer-bottom {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--primary);
  color: var(--white);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  padding: 40px 0 80px;
}

.admin-sidebar {
  background: rgba(11, 61, 145, 0.96);
  color: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  min-height: 400px;
}

.admin-sidebar h3 {
  margin-top: 0;
}

.admin-sidebar a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.9);
  margin-bottom: 8px;
}

.admin-sidebar a:hover,
.admin-sidebar a.active {
  background: rgba(255,255,255,0.08);
}

.admin-main {
  display: grid;
  gap: 20px;
}

.status-card {
  background: linear-gradient(135deg, rgba(37,99,235,0.12), rgba(8,160,201,0.08));
  border: 1px solid rgba(37,99,235,0.18);
  border-radius: var(--radius);
  padding: 20px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th, td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: rgba(15, 23, 42, 0.04);
  color: var(--primary);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(37,99,235,0.12);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.8rem;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-btn {
  border: none;
  background: rgba(11, 61, 145, 0.08);
  color: var(--primary);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.icon-btn.danger {
  background: rgba(220,38,38,0.08);
  color: #b91c1c;
}

.panel-form {
  display: grid;
  gap: 18px;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .hero-inner,
  .two-column,
  .contact-layout,
  .admin-shell,
  .card-list,
  .grid-4,
  .stats-grid,
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .hero-inner,
  .contact-layout,
  .admin-shell,
  .card-list,
  .two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.99);
    padding: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-direction: column;
    align-items: stretch;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-item {
    width: 100%;
  }

  .dropdown-menu {
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    display: none;
    margin-top: 8px;
    min-width: 100%;
  }

  .nav-item:hover .dropdown-menu,
  .nav-item:focus-within .dropdown-menu {
    display: block;
  }

  .mobile-toggle {
    display: block;
  }

  .search-wrap {
    max-width: 170px;
  }

  .stats-grid,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .timeline::before {
    left: 18px;
    transform: none;
  }

  .timeline-item,
  .timeline-item:nth-child(odd) .timeline-content,
  .timeline-item:nth-child(even) .timeline-content {
    display: block;
    grid-template-columns: none;
    margin-left: 30px;
  }

  .timeline-item .timeline-year {
    left: 18px;
    transform: none;
    top: 20px;
  }

  .timeline-content {
    margin-top: 40px;
  }
}

/* Modal styles for admin create test */
.modal.hidden { display: none; }
.modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 999; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.45); }
.modal-content { position: relative; background: #fff; padding: 20px; border-radius: 12px; max-width: 980px; width: 100%; box-shadow: 0 20px 60px rgba(2,6,23,0.4); }
.modal-content h3 { margin-top: 0; color: var(--primary); }
.question-block textarea { width: 100%; min-height: 88px; padding: 10px; border-radius: 8px; border: 1px solid var(--border); }
.question-block .form-row { margin-bottom: 10px; }
.btn.small { padding: 6px 8px; font-size: 0.9rem; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.upload-path { margin-left: 12px; color: var(--muted); font-size: 0.9rem; }

.news-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.45fr);
  gap: 24px;
  align-items: start;
}

.news-panel,
.news-sidebar-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.news-panel {
  padding: 22px;
}

.news-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.news-header h2 {
  margin: 12px 0 0;
  color: var(--primary);
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.telegram-news-list {
  display: grid;
  gap: 18px;
}

.news-card {
  background: linear-gradient(180deg, rgba(248,250,252,0.96), rgba(255,255,255,0.98));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.news-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.news-card-header a {
  color: var(--secondary);
  font-size: 0.82rem;
  font-weight: 700;
}

.news-card-image {
  width: 100%;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 12px;
  max-height: 420px;
}

.news-card-text {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.news-empty {
  background: rgba(255,255,255,0.9);
  border: 1px dashed rgba(37,99,235,0.25);
  border-radius: 18px;
  padding: 20px;
  color: var(--muted);
}

.news-sidebar {
  position: sticky;
  top: 100px;
}

.news-sidebar-card {
  padding: 22px;
}

.news-sidebar-card h3 {
  margin-top: 0;
  color: var(--primary);
  font-size: 1.3rem;
}

.news-sidebar-card p {
  color: var(--muted);
  margin: 0 0 18px;
}

.news-sidebar-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 980px) {
  .news-shell {
    grid-template-columns: 1fr;
  }

  .news-sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .news-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
