:root {
  --sidebar-width: 220px;
  --sidebar-width-collapsed: 70px;
  --sidebar-bg-color: #2c3e50;
  --sidebar-hover-bg-color: #34495e;
  --sidebar-toggle-bg-color: #1abc9c;
  --primary-color: #007bff;
  --primary-color-hover: #0056b3;
  --body-bg-color: #f4f4f4;
  --text-color-light: #fff;
  --text-color-dark: #333;
  --text-color-muted: #666;
  --border-color: #ccc;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  display: flex;
  height: 100vh;
  background-color: var(--body-bg-color);
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-bg-color);
  color: var(--text-color-light);
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
  position: fixed;
  justify-content: space-between;
  height: 100%;
  z-index: 1000;
}

.sidebar-top {
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-banner {
  max-height: 80px; /* Control the image size */
  object-fit: contain; /* Ensure image scales nicely */
  padding: 10px;
  display: block;
  margin-bottom: 10px;
}

.sidebar.collapsed {
  width: var(--sidebar-width-collapsed);
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin-top: 20px;
}

.sidebar li {
  padding: 12px 20px; /* Slightly reduce padding to make the list more compact */
}

.sidebar-bottom ul {
  border-top: 1px solid var(--sidebar-hover-bg-color);
}

.sidebar .copyright {
  font-size: 0.75rem;
  color: var(--border-color);
  text-align: center;
  padding: 10px;
}

.sidebar a {
  text-decoration: none;
  color: var(--text-color-light);
  display: flex;
  align-items: center;
  font-size: 16px;
  transition: background 0.2s;
}

.sidebar a:hover {
  background-color: var(--sidebar-hover-bg-color);
  border-radius: 4px;
}

.sidebar i {
  margin-right: 10px;
  min-width: 20px;
  text-align: center;
  font-size: 18px;
}

.sidebar.collapsed .text {
  display: none;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding: 0;
  width: calc(100% - var(--sidebar-width));
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-width-collapsed);
  width: calc(100% - var(--sidebar-width-collapsed));
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999; /* Below sidebar, above main content */
}

.mobile-header {
  display: none; /* Hidden on desktop */
  background-color: var(--sidebar-bg-color);
  color: var(--text-color-light);
  padding: 0 15px;
  height: 50px;
  align-items: center;
}

.mobile-header .toggle-button {
  background: none;
  border: none;
  color: var(--text-color-light);
  font-size: 20px;
  cursor: pointer;
}

.mobile-header-title {
  margin-left: 15px;
  font-weight: 600;
}

iframe {
  width: 100%;
  height: 100vh;
  border: none;
}

@media (max-width: 768px) {
  .sidebar {
    left: calc(-1 * var(--sidebar-width));
  }
  .sidebar.active {
    left: 0;
  }

  iframe {
    height: calc(100vh - 50px); /* Adjust height for the mobile header */
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }
  .sidebar.collapsed ~ .main-content {
    margin-left: 0;
  }
  .sidebar-backdrop.active {
    display: block;
  }
}

/* ===== Login Modal Styles ===== */
#loginModal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #f2f2f2, #d9e6f2);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

#loginModal .modal-content {
  background-color: #fff;
  padding: 30px 25px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 350px;
  text-align: center;
}

.login-logo {
  width: 80px;
  height: auto;
  margin-bottom: 20px;
}

.modal-content h2 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--text-color-dark);
}

.modal-content .subheading {
  color: var(--text-color-muted);
  font-size: 14px;
  margin-bottom: 20px;
}

#loginModal input {
  width: 100%;
  padding: 12px;
  margin: 8px 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
}

#loginModal input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}

#loginModal button {
  margin-top: 10px;
  width: 100%;
  padding: 12px;
  background-color: var(--primary-color);
  border: none;
  color: var(--text-color-light);
  font-size: 15px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#loginModal button:hover {
  background-color: var(--primary-color-hover);
}

#loginModal .error {
  color: red;
  font-size: 13px;
  height: 20px;
}

#loginModal .copyright {
  font-size: 12px;
  color: #888;
  margin-top: 15px;
}

.hidden {
  display: none !important;
}

.password-container {
  position: relative;
  width: 100%;
}

.password-container i {
  position: absolute;
  right: 15px;
  top: 22px; /* Adjust based on input padding and margin */
  cursor: pointer;
  color: var(--text-color-muted);
}
