/* Base Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background-color: #f9f9f9;
  color: #333;
}

#flash-container {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
}

.flash-message {
  display: block !important;  /* Override body-hidden */
  opacity: 1;
  background-color: #ff4444; /* Default: Error */
  color: white;
  padding: 12px 24px;
  border-radius: 6px;
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
  transition: opacity 0.5s ease-in-out;
  z-index: 2000;
  max-width: 90%;
  text-align: center;
}


/* Message Types */
.flash-message.success { background-color: #4caf50; } /* Green */
.flash-message.info { background-color: #2196f3; } /* Blue */
.flash-message.warning { background-color: #ff9800; } /* Orange */

/* Show Animation */
.flash-message.show {
  display: block;
  opacity: 1;
}

/* Fade Out Animation */
.flash-message.hide {
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
}

/* Header & Footer */
.main-header {
  background-color: #fff;
  border-bottom: 1px solid #ccc;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.main-footer {
  background-color: #fff;
  border-top: 1px solid #ccc;
  padding: 20px;
  text-align: center;
  color: #777;
  box-shadow: 0 -1px 4px rgba(0,0,0,0.1);
  margin-top: 20px;
}

/* .page-container holds sidebar & main-content side by side */
.page-container {
  display: flex;
  gap: 20px;
  margin: 20px; /* or 0 20px if you want horizontal margin only */
  max-width: 1200px;
  /* center it with margin: 0 auto; if you like:
     margin: 20px auto;
  */
}

/* Sidebar */
.sidebar {
  width: 220px;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 5px 10px rgba(0,0,0,0.05);
  overflow: hidden;
  transition: width 0.3s ease, left 0.3s ease;
}

#sidebarToggle {
  width: 10%;
}

.sidebar-header {
  background-color: #00a884;
  color: #fff;
  font-size: 1.3rem;
  font-weight: bold;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.nav-links {
  list-style: none;
  text-align: left;
}

.nav-links li {
  border-bottom: 1px solid #ddd;
}

.nav-links li a {
  display: block;
  padding: 15px 20px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s;
}

.nav-links li a:hover {
  background-color: #9ae2d5;
}

.nav-links li a.active {
  background-color: #9ae2d5;
  font-weight: bold;
}

/* Hamburger button */
.hamburger {
  position: absolute;
  left: 10px;
  font-size: 20px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
}

/* Collapse for desktop */
.sidebar.collapsed {
  width: 50px;
}

/* Hide text when collapsed */
.sidebar.collapsed .nav-title {
  display: none;
}

.sidebar.collapsed .nav-links {
  display: none;
}


/* Main Content */
.main-content {
  flex: 1;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  box-shadow: 0 5px 10px rgba(0,0,0,0.05);
  padding: 20px;
}


.hidden {
  display: none !important;
}

/* Profile Container - Used as a placeholder in HTML pages */
#user-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: auto;
    height: auto;
    padding-right: 20px;
}

/* Profile Icon Container - Wraps the profile icon & dropdown */
#user-icon-container {
    position: relative;
    display: flex;
    align-items: center;
}

/* user Icon */
#user-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease-in-out;
}

#user-icon:hover {
    transform: scale(1.1);
}

/* user Dropdown */
#user-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    padding: 10px;
    min-width: 160px;
    z-index: 1000;
}

#user-dropdown a,
#user-dropdown button {
    display: block;
    padding: 10px;
    text-align: left;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
}

#user-dropdown a:hover,
#user-dropdown button:hover {
    background: #f5f5f5;
}
.message-label {
  background-color: #fdd;
  color: #900;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 1rem;
  font-weight: bold;
  text-align: center;
  transition: opacity 0.5s ease;
  opacity: 1;
}

.message-label.hidden {
  opacity: 0;
}

.message-label.error {
  background-color: #ffe0e0;
  color: #cc0000;
  border: 1px solid #cc0000;
}

.message-label.success {
  background-color: #e0ffe0;
  color: #006600;
  border: 1px solid #006600;
}

.phone-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.country-code {
  padding: 8px 12px;
  background-color: #e0e0e0;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/** For loading sidebar content based on permission **/

/* Hide all non-Home links completely (no reserved space) */
.nav-links a:not([data-page="Home"]) {
  display: none;
}

/* Show allowed links when permission is granted */
.nav-links a.allowed {
  display: block;
}

/* Smooth fade-in for the entire links container */
.nav-links {
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

/* When ready, show the whole list */
.nav-links.ready {
  opacity: 1;
}

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid #fff;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 5px;
  vertical-align: middle;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


@media (max-width: 768px) {

  .page-container {
    flex-direction: column;
    gap: 10px;
  }

  .sidebar {
    width: 100%;
    position: relative;
  }

  /* Header layout */
  .sidebar-header {
    justify-content: center;
  }

  .hamburger {
    position: absolute;
    left: 12px;
    font-size: 22px;
  }

  /* Animate nav vertically */
  .nav-links {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  /* Collapsed state */
  .sidebar.collapsed .nav-links {
    max-height: 0;
  }

  .user-container {
    padding-right: 10px;
  }

}

