/* ================================================================
   SmartHRM Pro — layout.css
   Sidebar, Topbar, Main content area, Footer — full layout system
   ================================================================ */

/* ========================
   APP WRAPPER
   ======================== */
.hrm-app {
  display: flex;
  min-height: 100vh;
  background: var(--color-bg);
  position: relative;
}

/* ========================
   SIDEBAR
   ======================== */
.hrm-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1050;
  transition: var(--transition);
  overflow: hidden;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

/* --- Sidebar Brand / Header --- */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.brand-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  background: var(--color-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.40);
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
}

/* Sidebar collapse toggle (inside sidebar header) */
.sidebar-collapse-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-xs);
  font-size: 16px;
  line-height: 1;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* --- Sidebar Navigation --- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar        { width: 3px; }
.sidebar-nav::-webkit-scrollbar-track  { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb  { background: rgba(255,255,255,0.15); border-radius: 3px; }

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--sidebar-section);
  padding: 18px 20px 6px;
  list-style: none;
  white-space: nowrap;
  overflow: hidden;
  transition: var(--transition);
}

.nav-item {
  margin: 2px 8px;
}

.nav-item .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.nav-item .nav-link:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.nav-item .nav-link.active {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.nav-item .nav-link.active .nav-icon {
  color: #fff;
}

.nav-icon {
  width: 22px;
  min-width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.55);
  transition: var(--transition-fast);
}

.nav-item .nav-link:hover .nav-icon,
.nav-item .nav-link.active .nav-icon {
  color: #fff;
}

.nav-text {
  transition: var(--transition);
  font-size: 13.5px;
}

/* Nav divider */
.nav-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 10px 16px;
  list-style: none;
}

/* --- Sidebar Footer (user info) --- */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  overflow: hidden;
  transition: var(--transition-fast);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.09);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  transition: var(--transition);
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
}

/* ========================
   SIDEBAR OVERLAY (mobile)
   ======================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 1040;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}

.sidebar-overlay.active {
  display: block;
}

/* ========================
   SIDEBAR COLLAPSED STATE
   ======================== */
.hrm-app.sidebar-collapsed .hrm-sidebar {
  width: var(--sidebar-collapsed);
}

.hrm-app.sidebar-collapsed .brand-name,
.hrm-app.sidebar-collapsed .nav-text,
.hrm-app.sidebar-collapsed .nav-section-title,
.hrm-app.sidebar-collapsed .nav-divider,
.hrm-app.sidebar-collapsed .sidebar-user-info {
  opacity: 0;
  pointer-events: none;
  width: 0;
  overflow: hidden;
}

.hrm-app.sidebar-collapsed .hrm-main {
  margin-left: var(--sidebar-collapsed);
}

.hrm-app.sidebar-collapsed .nav-item .nav-link {
  justify-content: center;
  padding: 10px 0;
}

.hrm-app.sidebar-collapsed .nav-item {
  margin: 2px 6px;
}

.hrm-app.sidebar-collapsed .nav-icon {
  font-size: 18px;
}

.hrm-app.sidebar-collapsed .sidebar-user {
  padding: 10px;
  justify-content: center;
}

.hrm-app.sidebar-collapsed .sidebar-header {
  justify-content: center;
}

.hrm-app.sidebar-collapsed .brand {
  gap: 0;
}

/* Tooltip on hover when collapsed */
.hrm-app.sidebar-collapsed .nav-item .nav-link {
  position: relative;
}

.hrm-app.sidebar-collapsed .nav-item .nav-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(var(--sidebar-collapsed) - 4px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-text);
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  box-shadow: var(--shadow-md);
}

.hrm-app.sidebar-collapsed .nav-item .nav-link:hover::after {
  opacity: 1;
}

/* ========================
   MAIN CONTENT AREA
   ======================== */
.hrm-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--transition);
}

/* ========================
   TOP NAVIGATION BAR
   ======================== */
.hrm-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.topbar-menu-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 18px;
  transition: var(--transition-fast);
  flex-shrink: 0;
}

.topbar-menu-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-breadcrumb .breadcrumb-sep {
  color: var(--color-text-light);
}

.topbar-breadcrumb .breadcrumb-current {
  color: var(--color-text);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--color-border);
}

.topbar-user-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
}

.topbar-user-role {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.2;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 16px;
}

.btn-topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
  font-family: 'Inter', sans-serif;
}

.btn-topbar-logout:hover {
  border-color: var(--color-danger);
  color: var(--color-danger);
  background: var(--color-danger-light);
}

/* ========================
   PAGE CONTENT AREA
   ======================== */
.hrm-content {
  flex: 1;
  padding: 28px 32px;
  background: var(--color-bg);
  animation: fadeIn 0.3s ease;
}

/* ========================
   APP FOOTER
   ======================== */
.hrm-footer {
  padding: 16px 32px;
  background: var(--color-white);
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  flex-shrink: 0;
}

/* ========================
   LOGIN PAGE LAYOUT
   ======================== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 50%, #F9FAFB 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: fadeInUp 0.4s ease;
}

.login-card-header {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  padding: 32px 32px 28px;
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  margin: 0 auto 16px;
}

.login-card-header h2 {
  color: #fff;
  font-size: 22px;
  margin-bottom: 4px;
}

.login-card-header p {
  color: rgba(255,255,255,0.75);
  font-size: 13px;
  margin: 0;
}

.login-card-body {
  padding: 32px;
}

.login-card-body .form-label {
  font-size: 13px !important;
  font-weight: 600 !important;
}

.login-card-body .form-control {
  padding: 11px 14px !important;
}

.login-hint {
  background: var(--color-primary-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--color-primary);
  margin-bottom: 20px;
}

.login-footer-link {
  display: block;
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.login-footer-link a {
  color: var(--color-primary);
  font-weight: 600;
}
