/* ============================================================
   Shared Layout — Sidebar + Main Content
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease, background 0.25s ease;
  overflow: hidden;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px 12px;
  overflow-y: auto;
}

/* Logo */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 20px;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
  color: var(--accent-primary);
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

/* Role badges */
.role-admin {
  background: var(--accent-gradient);
  color: #fff;
}

.role-hr {
  background: linear-gradient(135deg, #f59e0b, #ef7c00);
  color: #fff;
}

.role-candidate {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #fff;
}

.role-pm {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  color: #fff;
}

.role-interviewer {
  background: linear-gradient(135deg, #06b6d4, #0891b2);
  color: #fff;
}

/* Navigation items */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  padding: 0 0 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent-primary);
}

.nav-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.nav-label {
  white-space: nowrap;
}

/* Sidebar sections */
.sidebar-section {
  padding: 0 12px 16px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

/* Theme Switcher */
.theme-switcher {
  display: flex;
  gap: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: all 0.15s ease;
  cursor: pointer;
  border: none;
  background: transparent;
}

.theme-btn .material-symbols-rounded {
  font-size: 18px;
}

.theme-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.theme-btn.active {
  background: var(--bg-card);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

/* User footer */
.sidebar-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
}

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

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius-md);
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.logout-btn .material-symbols-rounded {
  font-size: 18px;
}

.logout-btn:hover {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* ---- MAIN CONTENT ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.3s ease;
}

/* ---- MOBILE HEADER ---- */
.mobile-header {
  display: none;
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn,
.icon-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.mobile-menu-btn:hover,
.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mobile-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.mobile-logo .material-symbols-rounded {
  color: var(--accent-primary);
  font-size: 24px;
}

.mobile-actions {
  display: flex;
  gap: 4px;
}

.sidebar-overlay {
  display: none;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 200;
    box-shadow: var(--shadow-xl);
  }

  .app-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-layout.sidebar-open .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 150;
  }

  .main-content {
    margin-left: 0;
  }
}

/* Glassy Modal Styles */

.glassy-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease-out forwards;
}

.glassy-modal {
  background: var(--bg-card); /* Theme aware */
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 90%;
  max-width: 550px;
  max-height: 80vh;
  padding: 32px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  position: relative;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
}
.close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding-right: 8px; /* Space for scrollbar */
  padding-bottom: 8px;
}

.glassy-option {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.glassy-option:hover {
  transform: translateY(-4px);
  background: var(--bg-hover);
  border-color: var(--accent-primary);
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.option-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-primary) 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.block-icon {
  font-size: 28px;
  color: white;
}

.option-text {
  flex: 1;
}

.option-text h3 {
  margin: 0 0 4px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.option-text p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.arrow-icon {
  color: var(--text-muted);
  transition: transform 0.2s;
}

.glassy-option:hover .arrow-icon {
  color: var(--accent-primary);
  transform: translateX(4px);
}

.animate-fade-in {
  animation: modalScaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes modalScaleUp {
  0% { opacity: 0; transform: scale(0.95) translateY(10px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
