/* ========================================
   SIDEBAR LAYOUT - Claude Code Style
   ======================================== */

body {
  margin: 0;
  display: flex;
  overflow: hidden;
  height: 100vh;
}

/* Sidebar Backdrop (mobile only) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

/* Sidebar */
.sidebar {
  width: 280px;
  height: 100vh;
  background: #18181b;
  border-right: 1px solid #27272a;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.3s ease, margin-left 0.3s ease;
  position: relative;
  z-index: 1000;
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid #27272a;
  min-height: 64px;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: #e4e4e7;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  position: relative;
}

.sidebar-toggle:hover {
  background: #27272a;
  color: #f4f4f5;
}

/* Show/hide chevrons based on sidebar state */
.sidebar-toggle .chevron-right {
  display: none;
}

.sidebar.collapsed .sidebar-toggle .chevron-left {
  display: none;
}

.sidebar.collapsed .sidebar-toggle .chevron-right {
  display: block;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.sidebar-logo {
  flex-shrink: 0;
  height: 70px;
  width: auto;
  display: block;
}

/* Colorize black logo to vibrant button terracotta (#d4735e) on dark background */
.sidebar-logo-colorized {
  filter: brightness(0) saturate(100%) invert(57%) sepia(35%) saturate(872%) hue-rotate(327deg) brightness(97%) contrast(90%);
}

.sidebar-brand-text {
  font-size: 1.125rem;
  font-weight: 600;
  color: #d4735e !important;
  white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand-text {
  display: none;
}

/* ==== COLLAPSED SIDEBAR IMPROVEMENTS ==== */

/* Header centering when collapsed */
.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 1.25rem 0.5rem;
}

.sidebar.collapsed .sidebar-toggle {
  margin: 0 auto;
  width: 44px;
  height: 44px;
}

/* Hide logo when collapsed */
.sidebar.collapsed .sidebar-brand {
  display: none;
}

/* Collapsed Top Section spacing */
.sidebar.collapsed .sidebar-top {
  padding: 0.75rem 0;
  gap: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Sidebar Top Section */
.sidebar-top {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Sidebar Search */
.sidebar-search {
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar-search-icon {
  position: absolute;
  left: 0.875rem;
  color: #71717a;
  pointer-events: none;
}

.sidebar-search-input {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.75rem;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 0.5rem;
  color: #e4e4e7;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s;
  line-height: 1.5;
}

.sidebar-search-input:focus {
  border-color: #d4735e;
  background: #27272a;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.1);
}

.sidebar-search-input::placeholder {
  color: #a1a1aa;
}

.sidebar.collapsed .sidebar-search {
  display: none;
}

/* Add Job Button */
.sidebar-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem 1.125rem;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-height: 44px;
}

.sidebar-add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 115, 94, 0.4);
}

.sidebar-add-btn svg {
  flex-shrink: 0;
}

.sidebar.collapsed .sidebar-add-btn span {
  display: none;
}

.sidebar.collapsed .sidebar-add-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  margin: 0 auto;
}

.sidebar.collapsed .sidebar-add-btn:hover {
  transform: translateY(-1px) scale(1.05);
}

/* Primary Action Highlight */
.sidebar-primary-action {
  position: relative;
  overflow: hidden;
}

.sidebar-primary-action::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  border-radius: 0.5rem;
  z-index: -1;
  opacity: 0.15;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.25; }
}

/* URL Input Area (Primary Action) */
.sidebar-url-input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  background: #27272a;
  border: 1px solid #3f3f46;
  border-radius: 10px;
  width: 100%;
  transition: all 0.2s ease;
}

.sidebar-url-input:focus-within {
  border-color: #d4735e;
  box-shadow: 0 0 0 3px rgba(212, 115, 94, 0.15);
}

.sidebar-url-input__wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding-left: 10px;
}

.sidebar-url-input__icon {
  color: #71717a;
  flex-shrink: 0;
}

.sidebar-url-input:focus-within .sidebar-url-input__icon {
  color: #d4735e;
}

.sidebar-url-input__field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fafafa;
  font-size: 14px;
  padding: 8px 0;
  min-width: 0;
}

.sidebar-url-input__field::placeholder {
  color: #71717a;
}

.sidebar-url-input__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  border: none;
  border-radius: 8px;
  color: white;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.sidebar-url-input__btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(212, 115, 94, 0.4);
}

.sidebar-url-input__btn:active {
  transform: scale(0.98);
}

/* Collapsed state - show compact version */
.sidebar.collapsed .sidebar-url-input {
  padding: 0;
  background: transparent;
  border: none;
  justify-content: center;
}

.sidebar.collapsed .sidebar-url-input__wrapper {
  display: none;
}

.sidebar.collapsed .sidebar-url-input__btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}

/* Sidebar Middle (Navigation) */
.sidebar-middle {
  flex: 1;
  min-height: 20px;
  padding: 0.5rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-middle::-webkit-scrollbar {
  width: 4px;
}

.sidebar-middle::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 2px;
}

.sidebar.collapsed .sidebar-middle {
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

/* Sidebar Navigation */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem 1.125rem;
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  width: 100%;
  position: relative;
  min-height: 44px;
}

.sidebar-nav-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(212, 115, 94, 0.4);
  background: linear-gradient(135deg, #e58570 0%, #c96551 100%);
}

.sidebar-nav-item.active {
  background: linear-gradient(135deg, #d4735e 0%, #b8513d 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(212, 115, 94, 0.3);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: white;
  border-radius: 0 2px 2px 0;
}

.sidebar-nav-item svg {
  flex-shrink: 0;
  transition: all 0.2s;
}

.sidebar-nav-item:hover svg {
  transform: scale(1.1);
}

.sidebar.collapsed .sidebar-nav-item {
  width: 44px;
  height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: 0.5rem;
  margin: 0 auto 0.25rem auto;
}

.sidebar.collapsed .sidebar-nav-item span {
  display: none;
}

.sidebar.collapsed .sidebar-nav-item.active::before {
  left: -8px;
  width: 3px;
  height: 24px;
}

/* Light mode support - black text on terracotta */
@media (prefers-color-scheme: light) {
  .sidebar-nav-item {
    color: #18181b;
  }

  .sidebar-nav-item:hover {
    color: #18181b;
  }

  .sidebar-nav-item.active {
    color: #18181b;
  }

  .sidebar-nav-item.active::before {
    background: #18181b;
  }
}

/* ========================================
   SIDEBAR SUBMENU (Kanban Status Navigation)
   ======================================== */

.sidebar-nav-group {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sidebar-nav-parent {
  position: relative;
}

.sidebar-nav-arrow {
  margin-left: auto;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.sidebar-nav-parent.expanded .sidebar-nav-arrow {
  transform: rotate(180deg);
}

.sidebar-submenu {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 8px 0 8px 12px;
  margin-top: 4px;
}

.sidebar-submenu.open {
  display: flex;
}

.sidebar-submenu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(63, 63, 70, 0.6); /* Better contrast - darker gray */
  border: none;
  border-radius: 8px;
  color: #fafafa; /* Brighter text */
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
  margin-bottom: 4px;
}

.sidebar-submenu-item:hover {
  background: rgba(212, 115, 94, 0.35);
  color: #ffffff;
}

.sidebar-submenu-item.active {
  background: rgba(212, 115, 94, 0.4);
  color: #ffffff;
  font-weight: 600;
}

/* Status dots */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--interested {
  background: #E8C48A;
}

.status-dot--applied {
  background: #9DB8CD;
}

.status-dot--interviewing {
  background: #D09B8D;
}

.status-dot--offer {
  background: #A8C89A;
}

.status-dot--rejected {
  background: #D9A09A;
}

/* Submenu count badge */
.submenu-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: #71717a;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 24px;
  text-align: center;
}

/* Collapsed sidebar - hide submenu */
.sidebar.collapsed .sidebar-submenu {
  display: none !important;
}

.sidebar.collapsed .sidebar-nav-arrow {
  display: none;
}

/* Section Header */
.sidebar-section-header {
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  padding: 0 0.875rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a1a1aa;
}

.sidebar.collapsed .sidebar-section-header {
  display: none;
}

/* Profile Navigation Spacing */
.sidebar-profile-nav {
  margin-bottom: 1rem;
}

/* Sidebar Bottom */
.sidebar-bottom {
  padding: 1.25rem 1rem 1.5rem 1rem;
  border-top: 1px solid #27272a;
}

.sidebar.collapsed .sidebar-bottom {
  padding: 1.25rem 0 1.5rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Sidebar Auth Buttons */
.sidebar-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: #27272a;
  color: #e4e4e7;
  border: 1px solid #3f3f46;
  border-radius: 0.5rem;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-login-btn:hover {
  background: #3f3f46;
}

.sidebar.collapsed .sidebar-login-btn span {
  display: none;
}

/* Sidebar User Menu */
.sidebar-user-menu {
  position: relative;
}

/* When collapsed, change to static so dropdown can escape */
.sidebar.collapsed .sidebar-user-menu {
  position: static;
}

.sidebar-user-trigger {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 0.75rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.625rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  min-height: 56px;
}

.sidebar-user-trigger:hover {
  background: #27272a;
  border-color: #3f3f46;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #27272a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.sidebar-user-avatar svg {
  color: #d4735e;
}

.sidebar-user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* Hide icon when image is shown */
.sidebar-user-avatar.has-image .sidebar-user-avatar-icon {
  display: none;
}

.sidebar-user-info {
  flex: 1;
  text-align: left;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #d4735e !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-tier {
  font-size: 0.75rem;
  color: #D4A59A;
  text-transform: capitalize;
}

.sidebar-user-arrow {
  color: #71717a;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.sidebar-user-trigger.active .sidebar-user-arrow {
  transform: rotate(180deg);
}

.sidebar.collapsed .sidebar-user-info,
.sidebar.collapsed .sidebar-user-arrow {
  display: none;
}

.sidebar.collapsed .sidebar-user-trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  display: flex;
}

.sidebar.collapsed .sidebar-user-trigger:hover {
  transform: scale(1.05);
}

.sidebar.collapsed .sidebar-user-avatar {
  margin: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Sidebar User Dropdown */
.sidebar-user-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 0.75rem;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  z-index: 1001;
  padding: 1rem 0.75rem;
}

/* When collapsed, dropdown opens upward and to the right */
.sidebar.collapsed .sidebar-user-dropdown {
  position: fixed;
  bottom: 2rem;
  left: 75px;
  right: auto;
  top: auto;
  min-width: 280px;
  width: 280px;
  z-index: 9999;
  background: #D4A59A;
  border-color: #B8877D;
}

.sidebar.collapsed .sidebar-user-dropdown .sidebar-user-dropdown-item {
  color: white;
}

.sidebar.collapsed .sidebar-user-dropdown .sidebar-user-dropdown-item:hover {
  background: #B8877D;
}

.sidebar.collapsed .sidebar-user-dropdown .sidebar-user-dropdown-item svg {
  color: rgba(255, 255, 255, 0.8);
}

.sidebar-user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: 1.5px solid rgba(212, 115, 94, 0.3);
  border-radius: 0.5rem;
  color: #d4735e;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: left;
  margin-bottom: 0.5rem;
}

.sidebar-user-dropdown-item:hover {
  background: rgba(212, 115, 94, 0.08);
  border-color: #d4735e;
}

.sidebar-user-dropdown-item svg {
  color: #d4735e;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.sidebar-user-dropdown-divider {
  height: 1px;
  background: rgba(212, 115, 94, 0.2);
  margin: 0.5rem 0;
}

.sidebar-user-dropdown-logout {
  margin-bottom: 0;
}

/* Main Wrapper */
.main-wrapper {
  flex: 1;
  overflow-y: auto;
  height: 100vh;
  background: var(--color-bg);
}

.main-wrapper .container {
  max-width: none;
  padding: 2.5rem 3rem;
}

/* Dark Mode Adjustments */
body.dark-mode .sidebar {
  background: #09090b;
  border-right-color: #18181b;
}

body.dark-mode .sidebar-header {
  border-bottom-color: #18181b;
}

body.dark-mode .sidebar-bottom {
  border-top-color: #18181b;
}

body.dark-mode .sidebar-search-input {
  background: #18181b;
  border-color: #27272a;
}

body.dark-mode .sidebar-search-input:focus {
  border-color: #d4735e;
  background: #09090b;
}

body.dark-mode .sidebar-user-trigger:hover {
  background: #18181b;
  border-color: #27272a;
}

body.dark-mode .sidebar-user-dropdown {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    margin-left: -280px;
    z-index: 2000;
  }

  .sidebar.open {
    margin-left: 0;
  }

  .sidebar.collapsed {
    margin-left: -60px;
  }

  .main-wrapper {
    margin-left: 0 !important;
  }
}
