* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f5f7fb;
  color: #1f2937;
}

.top-header {
  display: grid;
  grid-template-columns: 120px 1fr 260px;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: #ffffff;
  border-bottom: 1px solid #dbe1ea;
}

.school-logo {
  width: 84px;
  height: 84px;
  object-fit: contain;
  display: block;
  transform-origin: center center;
  animation: logo-axis-spin 8s linear infinite;
}

.header-center {
  text-align: center;
}

.header-center h1,
.header-center h2 {
  margin: 0;
}

.header-center h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.header-center h2 {
  margin-top: 0.2rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.header-right {
  text-align: right;
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.5;
}

#header-date-line {
  font-weight: 600;
}

.header-left {
  perspective: 900px;
}

@keyframes logo-axis-spin {
  from {
    transform: rotateY(0deg);
  }
  to {
    transform: rotateY(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .school-logo {
    animation: none;
  }
}

.home-main {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1rem;
  display: grid;
  gap: 1rem;
}

.home-main section {
  background: #ffffff;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  padding: 1rem;
}

.home-main h3 {
  margin-top: 0;
}

.news-board {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  width: 100%;
}

.news-header-box {
  display: flex;
  flex-direction: column;
  width: 100%;
  background: #fff;
  border: 1px solid #dbe1ea;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.news-header-box .news-item-important {
  margin-bottom: 1rem;
}

.news-announcements {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.news-announcements h4 {
  margin: 0;
  color: #1e3a8a;
  font-size: 1.1rem;
}

.news-item {
  border: 1px solid #d7deea;
  border-radius: 10px;
  padding: 0.95rem;
  background: #ffffff;
}

.news-item h4 {
  margin: 0.45rem 0;
  font-size: 1rem;
}

.news-item p {
  margin: 0;
  color: #4b5563;
  font-size: 0.93rem;
}

.news-item-important {
  border-color: #f0b429;
  background: #fff9eb;
}

.news-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #8a2d00;
  background: #ffe3b3;
}

.news-badge-info {
  color: #1e3a8a;
  background: #dbeafe;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid #d7deea;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.app-card:hover {
  transform: translateY(-2px);
  border-color: #b9c7df;
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.08);
}

.app-card:focus-visible {
  outline: 2px solid #1d4ed8;
  outline-offset: 2px;
}

.app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
}

.app-icon-leave {
  background: linear-gradient(135deg, #0f766e, #0ea5a4);
}

.app-icon-payment {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}

.app-icon-website {
  background: linear-gradient(135deg, #7c3aed, #9333ea);
}

.app-icon-placeholder {
  background: linear-gradient(135deg, #6b7280, #9ca3af);
}

.app-card-placeholder {
  cursor: default;
  border-style: dashed;
  opacity: 0.9;
}

.app-title {
  font-weight: 700;
  font-size: 1.02rem;
}

.app-subtitle {
  color: #4b5563;
  font-size: 0.93rem;
}

.page-footer {
  text-align: center;
  padding: 1rem;
  color: #6b7280;
}

/* Admin Styles */
.admin-item-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #d7deea;
  border-radius: 8px;
  background: #ffffff;
  margin-bottom: 0.5rem;
}

.admin-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.admin-item-info strong {
  font-size: 0.98rem;
  color: #1f2937;
}

.admin-item-info small {
  color: #6b7280;
  font-size: 0.85rem;
  display: none;
}

.admin-category-list {
  margin-bottom: 1.25rem;
}

.btn-delete {
  background-color: #ef4444;
  color: white;
  border: none;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background-color 0.15s ease;
}

.btn-delete:hover {
  background-color: #dc2626;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}

.admin-form input,
.admin-form select {
  padding: 0.6rem 0.8rem;
  border: 1px solid #dbe1ea;
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
  background: #ffffff;
}

.admin-form input:focus,
.admin-form select:focus {
  outline: 2px solid #1d4ed8;
  border-color: transparent;
}

.btn-submit {
  background-color: #2563eb;
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.92rem;
  transition: background-color 0.15s ease;
}

.btn-submit:hover {
  background-color: #1d4ed8;
}

.admin-header-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.back-link:hover {
  text-decoration: underline;
}

@media (max-width: 800px) {
  .top-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .header-left,
  .header-right {
    text-align: center;
  }
}
