/* ═══════════════════════════════════════════════════════════
   OKYU HRM – Layout (Sidebar, Header, Main, Login)
   ═══════════════════════════════════════════════════════════ */

/* --- Login Screen --- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-screen.hidden {
  display: none;
}

.login-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  max-width: 92vw;
  box-shadow: var(--shadow);
}

.login-logo {
  font-family: 'Space Mono', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-light);
  text-align: center;
  margin-bottom: 8px;
  letter-spacing: 4px;
}

.login-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.login-box label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.login-box input,
.login-box select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 20px;
  transition: var(--transition);
  outline: none;
}

.login-box input:focus,
.login-box select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.login-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.login-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-bottom: 12px;
  display: none;
}

.login-theme {
  position: absolute;
  top: 24px;
  right: 24px;
}

.role-hint {
  margin-top: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.role-hint strong {
  color: var(--text-secondary);
}

.role-hint div {
  margin-top: 4px;
}

/* --- App Shell --- */
.app {
  display: flex;
  min-height: 100vh;
}

.app.hidden {
  display: none;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease, background 0.3s;
  backdrop-filter: blur(12px);
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  font-family: 'Space Mono', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-light);
  letter-spacing: 3px;
}

.sidebar-brand-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 12px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.nav-section:hover {
  color: var(--text-secondary);
}
.nav-section .nav-chevron {
  font-size: 14px;
  transition: transform 0.25s ease;
  opacity: 0.5;
}
.nav-section.collapsed .nav-chevron {
  transform: rotate(-90deg);
}
.nav-group {
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  opacity: 1;
}
.nav-group.collapsed {
  max-height: 0;
  opacity: 0;
}


.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  color: #6b6b8a;
  cursor: pointer;
  transition: all .18s ease;
  font-size: .875rem;
  font-weight: 500;
  position: relative;
  letter-spacing: -.01em;
}
.nav-item:hover {
  background: rgba(99,102,241,.06);
  color: #3d3d5c;
}
.nav-item.active {
  background: rgba(99,102,241,.1);
  color: #3b4fd2;
  font-weight: 700;
}
/* Icon box */
.nav-item .ms {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(0,0,0,.04);
  color: #7878a0;
  transition: all .18s ease;
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
[data-theme='dark'] .nav-item .ms {
  background: rgba(255,255,255,.06);
  color: #a0a0c0;
}
.nav-item:hover .ms {
  background: rgba(99,102,241,.1);
  color: #3b4fd2;
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}
.nav-item.active .ms {
  background: rgba(59,79,210,.15);
  color: #3b4fd2;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}
[data-theme='dark'] .nav-item.active .ms {
  background: rgba(99,102,241,.2);
  color: #818cf8;
}

.nav-badge {
  position: absolute;
  right: 12px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  transition: var(--transition);
}

.logout-btn:hover {
  color: var(--danger);
}

/* --- Header --- */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--header-h);
  background: rgba(18, 18, 26, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.3s;
}

[data-theme="light"] .header {
  background: rgba(255, 255, 255, 0.85);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.location-select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* --- Content --- */
.content {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

.page {
  display: none;
  animation: fadeIn 0.25s ease;
}

.page.active {
  display: block;
}
