/* ============================================================
   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;
    min-width: 0;
    overflow-x: hidden;
    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);
  -webkit-backdrop-filter: blur(20px);
  position: relative;
  display: flex;
  flex-direction: column;
  transform: translateZ(0); /* Hardware accelerate backdrop-filter blending layer */
  backface-visibility: hidden;
}

.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: background-color 0.2s ease, color 0.2s ease;
  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: 8px 12px 12px 8px; /* Buffer space for shadows and transforms */
  margin: -8px -12px -12px -8px; /* Compensate padding to maintain perfect visual alignment */
}

.scrollable-options {
  max-height: 242px;
}

.modal-options::-webkit-scrollbar {
  width: 6px;
}

.modal-options::-webkit-scrollbar-track {
  background: transparent;
}

.modal-options::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.modal-options::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.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;
  /* GPU Hardware Acceleration */
  transform: translateY(0) translateZ(0);
  will-change: transform, box-shadow, background-color, border-color;
  backface-visibility: hidden;
  /* Specific optimized transitions (avoiding 'transition: all') */
  transition: transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              background-color 0.2s ease,
              border-color 0.2s ease,
              box-shadow 0.2s ease;
  position: relative;
}

.glassy-option:hover {
  transform: translateY(-4px) translateZ(0);
  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); }
}

/* Confirm Modal Specifics */
.confirm-modal {
  max-width: 400px;
  text-align: center;
  align-items: center;
}

.confirm-modal .modal-header {
  width: 100%;
  margin-bottom: 16px;
}

.confirm-modal-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.confirm-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.confirm-icon-wrapper .material-symbols-rounded {
  font-size: 32px;
}

.confirm-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

.confirm-modal-actions {
  display: flex;
  gap: 12px;
  width: 100%;
}

.confirm-modal-actions .btn {
  flex: 1;
  padding: 12px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.confirm-modal-actions .btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.confirm-modal-actions .btn-secondary:hover {
  background: var(--bg-tertiary);
}

.confirm-modal-actions .btn-danger {
  background: var(--danger);
  color: #fff;
}

.confirm-modal-actions .btn-danger:hover {
  background: var(--danger-border);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
