/* Shared Layout CSS - Include this in all pages */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f7f7fb;
  overflow-x: hidden;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-header h5 {
  margin: 0;
  font-weight: 600;
  font-size: 18px;
}

.user-profile {
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
}

.user-info {
  flex: 1;
}

.user-info > div:first-child {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}

.user-info .user-username {
  font-size: 12px;
  opacity: 0.85;
  margin-bottom: 2px;
}

.user-info .user-email {
  font-size: 12px;
  opacity: 0.8;
}

.user-info .user-tenant {
  font-size: 11px;
  opacity: 0.7;
  font-weight: 500;
}

.sidebar-menu {
  padding: 10px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.menu-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left-color: #fff;
}

.menu-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
  border-left-color: #fff;
  font-weight: 500;
}

.menu-item i {
  width: 20px;
  margin-right: 12px;
  font-size: 18px;
}

.menu-item .menu-arrow {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.2s;
}

.menu-item .menu-arrow.rotated {
  transform: rotate(180deg);
}

.menu-item-parent {
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.submenu {
  background: rgba(0,0,0,0.1);
  padding: 8px 0;
  margin-left: 20px;
}

.submenu-item {
  display: flex;
  align-items: center;
  padding: 10px 20px 10px 40px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 14px;
  border-left: 3px solid transparent;
}

.submenu-item:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left-color: #fff;
}

.submenu-item.active {
  background: rgba(255,255,255,0.15);
  color: white;
  border-left-color: #fff;
  font-weight: 500;
}

.submenu-item i {
  width: 18px;
  margin-right: 10px;
  font-size: 16px;
}

/* Main Content Area */
.main-content {
  margin-left: 250px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Header */
.top-header {
  background: #fff;
  padding: 12px 24px;
  border-bottom: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.menu-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: #495057;
  cursor: pointer;
}

.app-title {
  font-size: 20px;
  font-weight: 600;
  color: #1e3c72;
}

.search-bar {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 40px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 14px;
}

.search-bar i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6c757d;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
}

.header-icon {
  position: relative;
  cursor: pointer;
  color: #6c757d;
  font-size: 20px;
  transition: color 0.2s;
}

.header-icon:hover {
  color: #1e3c72;
}

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  position: relative;
}

.header-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1e3c72;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.header-user-info {
  display: flex;
  flex-direction: column;
}

.header-user-email {
  font-size: 13px;
  color: #6c757d;
}

.header-user #userMenuArrow {
  transition: transform 0.3s ease;
}

.header-user #userMenuArrow.rotated {
  transform: rotate(180deg);
}

/* User Dropdown Menu */
.user-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  z-index: 9999;
  overflow: hidden;
}

.dropdown-header {
  padding: 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #dee2e6;
}

.dropdown-user-name {
  font-weight: 600;
  font-size: 15px;
  color: #212529;
  margin-bottom: 4px;
}

.dropdown-user-email {
  font-size: 13px;
  color: #6c757d;
  margin-bottom: 8px;
}

.dropdown-tenant-name {
  font-size: 12px;
  color: #495057;
  font-weight: 500;
}

.dropdown-divider {
  height: 1px;
  background: #dee2e6;
  margin: 4px 0;
}

.user-dropdown-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: #212529;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s;
  cursor: pointer;
}

.user-dropdown-menu .dropdown-item:hover {
  background-color: #f8f9fa;
}

.user-dropdown-menu .dropdown-item i {
  font-size: 16px;
  color: #6c757d;
}

.user-dropdown-menu .dropdown-item:last-child {
  color: #dc3545;
}

.user-dropdown-menu .dropdown-item:last-child:hover {
  background-color: #fee;
}

.user-dropdown-menu .dropdown-item:last-child i {
  color: #dc3545;
}

/* Content Area */
.content-area {
  flex: 1;
  padding: 24px;
  background: #f7f7fb;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: #212529;
  margin: 0;
}

/* Footer */
.app-footer {
  background: #fff;
  border-top: 1px solid #dee2e6;
  padding: 16px 24px;
  margin-left: 250px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-user {
  color: #6c757d;
  font-size: 14px;
}

.footer-copyright {
  color: #6c757d;
  font-size: 14px;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .app-footer {
    margin-left: 0;
  }
}

