/* Prevent horizontal scrolling globally */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

/* Layout Wrapper - Full Height with Flex for Footer */
.layout-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

/* Main Content Area - Grows to push footer down */
.main-content {
  flex: 1;
  padding-top: 1rem;
  padding-bottom: 2rem;
  max-width: 100%;
  overflow-x: hidden;
}

/* Avatar Styles */
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.user-avatar:hover {
  transform: scale(1.05);
  border-color: #FFD600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.user-avatar.with-image {
  background: none;
  border: 2px solid #ddd;
}

.user-avatar.with-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.user-avatar.with-letter {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.user-avatar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.user-avatar:hover::before {
  opacity: 1;
}

/* Username styling next to avatar */
.username-text {
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-weight: 500;
}

.username-text:hover {
  background-color: rgba(255, 214, 0, 0.1);
  transform: translateY(-1px);
}

/* Fixed Simple Greeting Section - No Horizontal Overflow */
.simple-greeting-section {
  padding: 1.5rem 0;
  width: 100%;
  overflow-x: hidden;
}

.simple-greeting {
  color: #333;
  font-size: 1.5rem;
  font-weight: 400;
  margin: 0;
  transition: all 0.3s ease;
  padding-left: 1rem;
  padding-right: 1rem;
  max-width: calc(100vw - 2rem);
  word-wrap: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .simple-greeting {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    max-width: calc(100vw - 3rem);
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .simple-greeting {
    padding-left: 2rem;
    padding-right: 2rem;
    max-width: calc(100vw - 4rem);
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .simple-greeting {
    padding-left: 3rem;
    padding-right: 2rem;
    max-width: calc(100vw - 5rem);
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .simple-greeting {
    padding-left: 4rem;
    padding-right: 2rem;
    max-width: calc(100vw - 6rem);
  }
}

/* XXL devices (larger desktops, 1400px and up) */
@media (min-width: 1400px) {
  .simple-greeting {
    padding-left: 5rem;
    padding-right: 2rem;
    max-width: calc(100vw - 7rem);
  }
}

/* Dark mode text color */
.dark-mode .simple-greeting {
  color: #fff !important;
}

/* Container fluid fixes */
.container-fluid {
  max-width: 100%;
  overflow-x: hidden;
  padding-left: 12px;
  padding-right: 12px;
}

/* Navbar brand animation */
.navbar-brand {
  transition: all 0.3s ease;
}
.navbar-brand:hover {
  transform: translateY(-2px);
}
.navbar-brand img {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}
.navbar-brand:hover img {
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

/* Dark mode navbar and avatar styles */
.dark-mode .navbar {
  background: #181824 !important;
  box-shadow: 0 2px 15px rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.dark-mode .navbar .nav-link,
.dark-mode .navbar .navbar-text {
  color: #fff !important;
}
.dark-mode .navbar .nav-link.active {
  color: #fff !important;
  padding-bottom: 5px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}
.dark-mode .navbar .nav-link::after {
  background-color: #FFD600;
}
.dark-mode .navbar .nav-link.active::after {
  box-shadow: 0 1px 5px rgba(255, 214, 0, 0.5);
}
.dark-mode .navbar-brand img {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.dark-mode .navbar-brand:hover img {
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

/* Dark mode avatar styles */
.dark-mode .user-avatar.with-image {
  border-color: #444;
}
.dark-mode .user-avatar.with-letter {
  background: linear-gradient(135deg, #4a90e2 0%, #9013fe 100%);
}
.dark-mode .user-avatar:hover {
  border-color: #FFD600;
}
.dark-mode .username-text {
  color: #fff !important;
}
.dark-mode .username-text:hover {
  background-color: rgba(255, 214, 0, 0.15);
}

/* Light mode active link styling */
.navbar .nav-link {
  position: relative;
  transition: all 0.3s ease;
}
.navbar .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: #FFD600;
  transition: all 0.3s ease;
  transform: translateX(-50%);
  opacity: 0;
}
.navbar .nav-link:hover::after {
  width: 30%;
  opacity: 0.7;
}
.navbar .nav-link.active {
  color: #000 !important;
  font-weight: 500;
  padding-bottom: 5px;
}
.navbar .nav-link.active::after {
  width: 70%;
  opacity: 1;
  height: 2px;
  background-color: #FFD600;
  box-shadow: 0 1px 3px rgba(255, 214, 0, 0.3);
}

/* Improved navbar spacing with overflow prevention */
.navbar-nav {
  gap: 0.5rem;
}

.navbar {
  overflow-x: hidden;
}

.navbar .container-fluid {
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.navbar .container-fluid::-webkit-scrollbar {
  display: none;
}

/* Theme toggle button */
.btn-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

.btn-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Logout button improvements */
.btn-outline-danger {
  border-width: 2px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-outline-danger:hover {
  transform: translateY(-1px);
}

/* Dark mode specific adjustments */
.dark-mode .btn-link {
  color: #FFD600 !important;
}

.dark-mode .btn-link:hover {
  background-color: rgba(255, 214, 0, 0.1);
}

/* Responsive adjustments with overflow fixes */
@media (max-width: 767.98px) {
  .navbar-collapse {
    padding-top: 1rem;
  }
  
  .d-flex.gap-3 {
    gap: 0.5rem !important;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(0,0,0,0.1);
    margin-top: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  
  .dark-mode .d-flex.gap-3 {
    border-top-color: rgba(255,255,255,0.1);
  }

  .welcome-section {
    padding: 1.5rem 0;
  }

  .welcome-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .greeting-text {
    font-size: 1.5rem;
  }

  .greeting-time {
    font-size: 1.8rem;
  }

  .page-title {
    font-size: 2.2rem;
  }

  .current-time {
    align-self: flex-start;
  }

  /* Mobile layout adjustments */
  .main-content {
    padding-bottom: 1rem;
  }
  
  .layout-wrapper {
    min-height: 100dvh;
  }

  /* Mobile navbar adjustments */
  .navbar-nav {
    gap: 0.25rem;
  }

  .username-text {
    display: none !important;
  }
}

/* Additional mobile fixes */
@media (max-width: 575.98px) {
  .simple-greeting {
    font-size: 1.25rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    max-width: calc(100vw - 1.5rem);
  }

  .d-flex.gap-3 {
    gap: 0.25rem !important;
  }

  .btn-outline-danger {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
  }
}

/* Smooth theme transition */
* {
  transition: background-color 0.3s ease, color 0.3s ease;
  box-sizing: border-box;
}

/* Additional safety measures */
.row {
  margin-left: 0;
  margin-right: 0;
}

.col-12 {
  padding-left: 0;
  padding-right: 0;
}