/*
 * Common Components CSS
 * Styles for common components used across the School Management plugin
 */

/* Ensure background image is applied to all pages */
html,
body {
  /* Using a CSS variable that will be set in the PHP file to ensure correct path */
  background-repeat: no-repeat !important;
  background-size: cover !important;
  background-position: center !important;
  background-attachment: fixed !important;
  height: 100%;
}

/* Header styles */
.sm-header {
  background-image: linear-gradient(
    90deg,
    rgba(231, 46, 143, 1),
    rgba(255, 60, 0, 1) 0%,
    rgba(255, 144, 19, 1) 10%,
    rgba(255, 155, 17, 1) 84%,
    rgba(255, 255, 0, 1)
  );
  color: white;
  height: 56px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sm-header-left {
  display: flex;
  align-items: center;
}

.sm-header-title {
  margin-left: 10px;
  display: flex;
  align-items: center;
}

.sm-header-title a {
  color: white;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.menu-button {
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.menu-button img {
  width: 28px;
  height: 28px;
}

.sm-header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-circle {
  width: 32px;
  height: 32px;
  background-color: #ff8c00;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.sm-header-user a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.sm-header-user a img {
  width: 24px;
  height: 24px;
}

/* Sidebar styles */
.sidebar {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  background-color: white;
  overflow-x: hidden;
  transition: 0.3s;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.sidebar.open {
  width: 240px;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 90 !important;
  display: none;
}

.sidebar-overlay.visible {
  display: block;
}

.sidebar-header {
  height: 56px;
  background-image: linear-gradient(
    90deg,
    rgba(231, 46, 143, 1),
    rgba(255, 60, 0, 1) 0%,
    rgba(255, 144, 19, 1) 10%,
    rgba(255, 155, 17, 1) 84%,
    rgba(255, 255, 0, 1)
  );
  color: white;
  display: flex;
  align-items: center;
  padding: 0 15px;
}

.sidebar-header a {
  text-decoration: none;
  color: white;
}

.sidebar-content {
  padding: 0;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li {
  border-bottom: 1px solid #f1f1f1;
}

.sidebar-menu a {
  padding: 15px;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background-color: #f5f5f5;
}

.sidebar-menu a img {
  width: 24px;
  height: 24px;
  margin-right: 15px;
}

.sidebar-submenu {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.sidebar-submenu.open {
  max-height: 500px;
}

.sidebar-submenu li {
  border-bottom: none;
}

.sidebar-submenu a {
  padding: 12px 15px 12px 54px;
}

.has-submenu {
  position: relative;
}

.has-submenu::after {
  content: "";
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  background-image: none;
  transition: transform 0.3s;
}

.has-submenu svg {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  transition: transform 0.3s;
}

.has-submenu.open::after {
  transform: translateY(-50%) rotate(180deg);
}

@media (max-width: 768px) {
  .sidebar.open {
    width: 240px;
  }
}
