/* --- Color Variables - Brightened Violet Cyberpunk Theme --- */
:root {
  --bg-dark: #12121A;
  --surface-glass: rgba(45, 20, 60, 0.5);
  --surface-bright: rgba(255, 255, 255, 0.1);
  --neon-violet: #B026FF;
  --neon-magenta: #FF2E7E;
  --neon-cyan: #00FFFF;
  --deep-purple: #4B0082;
  --primary-color: var(--neon-violet);
  --secondary-color: var(--neon-magenta);
  --accent-color-glow: rgba(176, 38, 255, 0.6);
  --accent-color-border: var(--neon-violet);
  --text-main: #FFFFFF;
  --text-dim: rgba(255, 255, 255, 0.8);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Rajdhani', sans-serif; }

body {
  display: flex;
  flex-direction: row;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
}

.bg-grid {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(176, 38, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(176, 38, 255, 0.08) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: -1;
}

/* --- Professional Animated Toggle Button --- */
#sidebar-toggle-btn {
  position: fixed;
  top: 15px;
  left: 7.5px;
  z-index: 2100;
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  border: none;
  width: 45px;
  height: 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

#sidebar-toggle-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background-color: var(--primary-color);
  transition: all 0.3s ease;
  border-radius: 2px;
}

#sidebar-toggle-btn:hover {
  background: rgba(176, 38, 255, 0.3);
  box-shadow: 0 0 20px var(--accent-color-glow);
}

/* Toggle Animation */
#sidebar-toggle-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
#sidebar-toggle-btn.open span:nth-child(2) { opacity: 0; transform: translateX(-10px); }
#sidebar-toggle-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar.active ~ #sidebar-toggle-btn,
.sidebar:not(.collapsed) ~ #sidebar-toggle-btn {
  left: 17.5px !important;
  background: transparent;
  box-shadow: none;
}

/* --- Sidebar --- */
.sidebar {
  width: 280px;
  height: 100%;
  background: var(--surface-glass);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-right: 1px solid rgba(176, 38, 255, 0.3);
  display: flex;
  flex-direction: column;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  z-index: 2000;
  overflow: hidden; /* Hide overflow on the main container */
}

.sidebar.collapsed {
  width: 60px;
}

.sidebar-header {
  padding: 0 15px 0 80px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(176, 38, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 75px;
  flex-shrink: 0; /* Prevent header from shrinking */
}

.sidebar-header a {
  color: var(--primary-color);
  text-decoration: none;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 0 10px var(--accent-color-glow);
}

.sidebar-menu {
  list-style: none;
  padding: 20px 0;
  flex-grow: 1; /* Allow menu to take up all available space */
  overflow-y: auto; /* Make ONLY the menu scrollable */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.sidebar-footer {
  padding: 20px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dim);
  border-top: 1px solid rgba(176, 38, 255, 0.2);
  font-family: 'Orbitron', sans-serif;
  flex-shrink: 0; /* Prevent footer from shrinking */
  background: rgba(45, 20, 60, 0.6); /* Ensure consistent background */
  backdrop-filter: blur(10px);
}

/* --- Sidebar Text Visibility Control --- */
.sidebar-header a, 
.sidebar-menu li .menu-text { 
  opacity: 1;
  max-width: 500px;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.3s ease, max-width 0.3s ease;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text-dim);
  font-weight: 500;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.sidebar-menu li a:hover {
  background: rgba(176, 38, 255, 0.15);
  color: var(--text-main);
  border-left-color: var(--primary-color);
}

.sidebar-menu li .icon {
  margin-right: 15px;
  font-size: 1.3rem;
  width: 24px;
  text-align: center;
}

.sidebar-menu .has-submenu > a {
  position: relative;
}

.sidebar.collapsed .plus-icon {
  display: none;
}

.plus-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.has-submenu.open > a .plus-icon {
  transform: translateY(-50%) rotate(45deg);
}

.submenu {
  list-style: none;
  padding-left: 30px;
  display: none;
  background: rgba(0,0,0,0.2);
}

.has-submenu.open > .submenu {
  display: block;
}

/* --- Desktop Collapsed Styles --- */
@media(min-width: 1025px) {
  .sidebar.collapsed .sidebar-header a, 
  .sidebar.collapsed .sidebar-menu li .menu-text { 
    opacity: 0;
    max-width: 0;
    pointer-events: none;
  }

  .sidebar.collapsed .sidebar-menu li a {
    justify-content: center;
    padding: 14px 0;
    border-left: none;
  }

  .sidebar.collapsed .sidebar-header {
    padding: 0;
    justify-content: center;
  }

  .sidebar.collapsed .sidebar-menu li .icon {
    margin-right: 0;
  }

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


/* --- Main content area --- */
#main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s ease-in-out;
  position: relative;
}

/* --- Chat container --- */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
  transition: padding-top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Chat container on main page --- */
.chat-container.main-page {
  padding-top: 45vh;
}

#main-content.chat-container.started {
  padding-top: 40px;
}

/* --- Welcome container --- */
.main-page .welcome-container {
  position: absolute;
  top: 45vh;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  text-align: center;
  pointer-events: none;
  width: 100%;
}

.welcome-container h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: -2px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 15px rgba(176, 38, 255, 0.6);
}

.welcome-container h1 .second-part-violet {
  animation: h1VioletCycle 5s infinite linear;
}

@keyframes h1VioletCycle {
  0%   { color: #FF2E7E; } 25%  { color: #B026FF; } 50%  { color: #00FFFF; }
  75%  { color: #FFD700; } 100% { color: #FF2E7E; }
}

@keyframes loginButtonHoverCycle {
  0%   { background-color: #FF2E7E; border-color: #FF2E7E; } 25%  { background-color: #B026FF; border-color: #B026FF; }
  50%  { background-color: #00FFFF; border-color: #00FFFF; } 75%  { background-color: #FFD700; border-color: #FFD700; }
  100% { background-color: #FF2E7E; border-color: #FF2E7E; }
}

/* --- Chat Body --- */
.chat-body { 
  width: 100%; 
  max-width: 900px;
  max-height: calc(50vh - 120px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  overflow-y: auto;
  scroll-behavior: smooth;
  z-index: 5;
}

.chat-container.started .chat-body {
  max-height: calc(100vh - 200px);
}

/* --- Input Wrapper --- */
.input-wrapper { 
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 900px;
  gap: 10px;
  background: var(--surface-glass);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  padding: 10px 15px;
  border-radius: 15px;
  border: 1px solid rgba(176, 38, 255, 0.3);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  margin-top: 10px;
  z-index: 20;
}

.input-wrapper textarea { 
  flex: 1;
  padding: 10px;
  border: none;
  outline: none;
  resize: none;
  font-size: 1.1rem;
  background: transparent;
  color: var(--text-main);
}

.input-wrapper textarea::placeholder {
  color: var(--text-dim);
  opacity: 0.6;
}

.input-wrapper button { 
  padding: 8px 20px;
  border: none;
  border-radius: 10px;
  background: var(--primary-color);
  color: #ffffff;
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: flex-end;
  margin-bottom: 4px;
}

/* --- Messages --- */
.message { 
  padding: 12px 18px;
  width: 100%;
  max-width: 100%;
  word-wrap: break-word;
  line-height: 1.4;
  font-size: 1.1rem;
  border: none;
}

.bot { 
  text-align: left;
  font-family: 'VT323', monospace;
  color: var(--neon-cyan);
  font-size: 1.4rem;
  letter-spacing: 1px;
}

.user { 
  text-align: right;
  color: var(--text-main);
}




/* --- Modal Styles --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(15px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 4000;
}

.modal-overlay.active { display: flex; }

.modal-content {
  background: var(--surface-glass);
  border: 1px solid var(--primary-color);
  padding: 40px;
  border-radius: 15px;
  max-width: 700px;
  width: 90%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px var(--accent-color-glow);
}

.close-btn {
  position: absolute;
  top: 20px;
  right: 25px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 2rem;
  cursor: pointer;
}

.modal-header h2 {
  font-family: 'Orbitron', sans-serif;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.modal-body {
  overflow-y: auto;
  padding-right: 10px;
}

.modal-body p {
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 1.1rem;
}

.modal-body strong {
  color: var(--neon-magenta);
  font-weight: 700;
}

.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}

.skill-tag {
  background: rgba(176, 38, 255, 0.1);
  border: 1px solid var(--primary-color);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  color: var(--text-main);
}

.login-modal-content {
  max-width: 400px;
}

.login-options {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.login-option {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-radius: 10px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.login-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.login-option .icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.login-input {
  width: 100%;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border-radius: 10px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  outline: none;
}

.login-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 10px rgba(176, 38, 255, 0.2);
}

.login-message {
  margin-top: 15px;
  text-align: center;
  font-size: 1rem;
}

.auth-tabs {
  display: flex;
  justify-content: space-around;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.2rem;
  padding: 10px 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-bottom: 2px solid transparent;
}

.auth-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
  font-weight: bold;
}

.auth-tab:hover {
  color: var(--text-main);
}

.password-reqs {
  font-size: 0.8rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
  border-radius: 5px;
  border-left: 3px solid var(--neon-magenta);
  line-height: 1.4;
}

.password-reqs.valid {
  border-left-color: var(--neon-cyan);
}

.login-message.success { color: var(--neon-cyan); }
.login-message.error { color: var(--neon-magenta); }

.login-sidebar-btn {
  background: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 8px 25px;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 150px;
  margin-bottom: 15px;
}

.login-sidebar-btn:hover {
  color: #fff;
  box-shadow: 0 0 15px var(--accent-color-glow);
  animation: loginButtonHoverCycle 5s infinite linear;
}

/* --- Responsive Layout --- */
@media(max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -70vw;
    width: 70vw !important;
    height: 100%;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  .sidebar.active { 
    left: 0 !important; 
    visibility: visible !important; 
    z-index: 2500;
  }

  #sidebar-toggle-btn {
    z-index: 3100;
  }

  .sidebar-header a,
  .sidebar-menu li .menu-text {
    opacity: 1 !important;
    max-width: 500px !important;
  }

  .sidebar-menu li a {
    font-size: 1.2rem !important;
    padding: 18px 25px !important;
  }

  .sidebar-header {
    justify-content: center;
  }

    .sidebar-footer {
          flex-direction: column;
      }
    
      .welcome-container h1 { 
        font-size: 6.8vw; 
        white-space: nowrap;
      }
    
      @media(max-width: 1024px) and (orientation: portrait) {
        .main-page .welcome-container {
          top: 32vh;
        }
      }
    
      @media(orientation: portrait) and (max-width: 500px) {
    .login-modal-content {
      padding: 20px;
    }
  }

  @media(orientation: landscape) and (max-height: 500px) {
    .sidebar { width: 45vw !important; left: -45vw; }
    .sidebar-header { height: 60px; }
    .sidebar-header a { font-size: 0.8rem; }
    #sidebar-toggle-btn { top: 7.5px !important; }
    .sidebar.active ~ #sidebar-toggle-btn { left: 17.5px !important; }
    .sidebar-menu { padding: 10px 0; }
    .sidebar-menu li a { padding: 10px 20px !important; font-size: 1rem !important; }
    .sidebar-footer { padding: 10px; display: flex !important; justify-content: center; flex-wrap: wrap;}
    .login-sidebar-btn {
      padding: 8px 12px !important;
      font-size: 0.8rem !important;
      max-width: none;
    }
  }
}

/* --- Chat Snippets --- */
.chat-snippets {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  z-index: 20;
  flex-wrap: wrap;
}

.chat-snippet {
  background: rgba(176, 38, 255, 0.1);
  border: 1px solid var(--primary-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1rem;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(176, 38, 255, 0.2);
}

.chat-snippet:hover {
  background: rgba(176, 38, 255, 0.3);
  box-shadow: 0 0 15px var(--accent-color-glow);
  transform: translateY(-2px);
  color: #fff;
}

/* --- Social Links --- */
.social-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

.social-links a {
  color: var(--text-main);
  font-size: 2.5rem;
  transition: all 0.3s ease;
}

.social-links a:hover {
  color: var(--primary-color);
  transform: scale(1.1);
}

.social-links {
  pointer-events: auto;
}

@media(max-width: 768px) {
  .social-links {
    margin-top: 40px;
  }
  .social-links a {
    font-size: 3.5rem;
  }
  .main-page .welcome-container {
    top: 50vh;
  }
}

@media (max-width: 1024px) and (orientation: landscape) {
  .main-page .welcome-container {
    top: 55vh;
  }
}

