/* Modern Terminal Portfolio - Enhanced Styles */
@import url("https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  --primary-color: #00ff41;
  --secondary-color: #0f0;
  --accent-color: #00d9ff;
  --background-dark: #0a0e27;
  --background-darker: #050814;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --glow-color: rgba(0, 255, 65, 0.5);
  --terminal-bg: rgba(10, 14, 39, 0.95);
  --size: 1.2;
  --animation-speed: 0.3s;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Fira Code", "Courier New", monospace;
  background: linear-gradient(135deg, #0a0e27 0%, #050814 50%, #0a0e27 100%);
  background-attachment: fixed;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
}

/* Animated background particles */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(
      circle at 20% 50%,
      rgba(0, 255, 65, 0.05) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(0, 217, 255, 0.05) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 40% 20%,
      rgba(0, 255, 65, 0.03) 0%,
      transparent 50%
    );
  animation: particleFloat 20s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes particleFloat {
  0%,
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  50% {
    transform: translateY(-20px) scale(1.1);
    opacity: 0.8;
  }
}

/* Grid overlay effect */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: linear-gradient(rgba(0, 255, 65, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 65, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
  animation: gridPulse 4s ease-in-out infinite;
}

@keyframes gridPulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

/* Page container for centering */
.page-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Terminal wrapper (the actual terminal) */
.terminal-wrapper {
  width: 100%;
  height: 85vh;
  min-height: 500px;
}

/* Terminal container styling */
.terminal {
  background: var(--terminal-bg) !important;
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.3), 0 0 40px rgba(0, 255, 65, 0.2),
    0 10px 50px rgba(0, 0, 0, 0.5), inset 0 0 100px rgba(0, 255, 65, 0.02);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 1;
  margin: 0 auto;
  width: 100%;
  max-width: 1400px;
  font-size: 16px;
  line-height: 1.6;
  animation: terminalFadeIn 1s ease-out;
}

@keyframes terminalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Terminal header bar */
.terminal::before {
  content: "";
  display: block;
  height: 30px;
  background: linear-gradient(
    135deg,
    rgba(0, 255, 65, 0.2) 0%,
    rgba(0, 217, 255, 0.2) 100%
  );
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid var(--primary-color);
  position: relative;
  margin: 0 0 10px 0;
}

/* Terminal buttons */
.terminal::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 15px;
  width: 12px;
  height: 12px;
  background: #ff5f56;
  border-radius: 50%;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f, 0 0 5px rgba(255, 95, 86, 0.5),
    20px 0 5px rgba(255, 189, 46, 0.5), 40px 0 5px rgba(39, 201, 63, 0.5);
  z-index: 10;
}

/* Enhanced text styling */
.terminal,
.cmd {
  color: var(--text-primary) !important;
  font-size: 15px !important;
  letter-spacing: 0.5px;
}

/* Ensure terminal scrolls properly */
.terminal {
  display: flex;
  flex-direction: column;
  min-height: 400px;
  max-height: calc(100vh - 60px);
  overflow: hidden;
}

.terminal-scroller {
  flex: 1;
  overflow-y: auto !important;
  overflow-x: hidden;
  padding-bottom: 20px;
}

/* Keep command input visible */
.cmd {
  position: sticky !important;
  bottom: 0 !important;
  background: transparent !important;
  padding: 15px 10px !important;
  margin: 0 !important;
  border-top: 1px solid rgba(0, 255, 65, 0.1);
  z-index: 100 !important;
}

/* Prevent terminal from scrolling off-screen on mobile keyboard */
@media (max-width: 768px) {
  body {
    position: fixed;
    width: 100%;
  }

  .terminal {
    position: relative;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height on mobile */
  }

  .terminal-scroller {
    max-height: calc(100vh - 120px);
    max-height: calc(100dvh - 120px);
  }

  /* Ensure mobile input is accessible */
  .cmd,
  .cmd textarea,
  .cmd input,
  .cmd-editable {
    opacity: 1 !important;
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
    touch-action: manipulation !important;
  }

  .cmd textarea,
  .cmd input {
    font-size: 16px !important; /* Prevent zoom on iOS */
  }
}

/* Ensure consistent background throughout - Override jQuery Terminal library defaults */
.terminal-output,
.terminal-scroller,
.cmd,
.cmd-editable,
.cmd textarea,
.cmd input,
.terminal-output > div,
.terminal-output > div > div,
.terminal .terminal-output,
.terminal .cmd,
.cmd div,
.cmd span[data-text]:not(.cmd-inverted):not(.token):not(.emoji),
.terminal-output > :not(.raw) div,
.terminal-output
  > :not(.raw)
  span[data-text]:not(.token):not(.inverted):not(.terminal-inverted):not(
    .cmd-inverted
  ):not(.terminal-error):not(.emoji) {
  background: transparent !important;
  background-color: transparent !important;
}

/* Override jQuery Terminal CSS variable backgrounds */
.terminal,
.cmd,
.cmd div,
.cmd span,
.terminal-output > :not(.raw) a,
.terminal-output > :not(.raw) div,
.terminal-output > :not(.raw) span {
  --background: transparent !important;
}

/* Force override for welcome message container */
.terminal .terminal-output > div:first-child,
.terminal .terminal-output > div:first-child > div {
  background: transparent !important;
  background-color: transparent !important;
}

/* Override any remaining jQuery Terminal default backgrounds */
.terminal .terminal-output div,
.terminal .terminal-output div div {
  background: transparent !important;
}

.cmd .cmd-editable,
.cmd textarea.cmd-clipboard {
  background: transparent !important;
  background-color: transparent !important;
}

.cmd .cmd-prompt,
.terminal .cmd-prompt {
  color: var(--primary-color) !important;
  font-weight: 600 !important;
  text-shadow: 0 0 10px var(--glow-color);
  animation: promptPulse 2s ease-in-out infinite;
}

@keyframes promptPulse {
  0%,
  100% {
    text-shadow: 0 0 10px var(--glow-color);
  }
  50% {
    text-shadow: 0 0 20px var(--glow-color), 0 0 30px var(--glow-color);
  }
}

/* Cursor animation enhancement */
.cmd .cmd-cursor.cmd-blink {
  background-color: var(--primary-color) !important;
  color: var(--background-darker) !important;
  animation: cursorBlink 1s ease-in-out infinite;
  box-shadow: 0 0 10px var(--glow-color);
}

@keyframes cursorBlink {
  0%,
  49% {
    opacity: 1;
    box-shadow: 0 0 10px var(--glow-color);
  }
  50%,
  100% {
    opacity: 0.3;
    box-shadow: 0 0 5px var(--glow-color);
  }
}

/* Link styling */
.terminal a[href],
.cmd a[href] {
  color: var(--accent-color) !important;
  text-decoration: none;
  position: relative;
  transition: all var(--animation-speed) ease;
  text-shadow: 0 0 5px rgba(0, 217, 255, 0.5);
}

.terminal a[href]:hover,
.cmd a[href]:hover {
  color: var(--primary-color) !important;
  text-shadow: 0 0 15px var(--glow-color);
  transform: translateX(2px);
}

.terminal a[href]::before {
  content: "▸ ";
  color: var(--accent-color);
  opacity: 0;
  transition: opacity var(--animation-speed) ease;
}

.terminal a[href]:hover::before {
  opacity: 1;
}

/* Output text styling */
.terminal .terminal-output div div {
  animation: lineSlideIn 0.3s ease-out;
  transition: all var(--animation-speed) ease;
}

@keyframes lineSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.terminal .terminal-output div div:hover {
  transform: translateX(5px);
  text-shadow: 0 0 5px var(--glow-color);
}

/* Section headers */
.terminal .terminal-output div div[style*="font-weight: bold"],
.terminal .terminal-output div div b,
.terminal .terminal-output div div strong {
  color: var(--primary-color) !important;
  text-shadow: 0 0 10px var(--glow-color);
  font-size: 1.1em;
  letter-spacing: 1px;
}

/* Command input enhancement */
.cmd .cmd-prompt span {
  display: inline-block;
  animation: slideInLeft 0.5s ease-out;
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scrollbar styling */
.terminal-scroller::-webkit-scrollbar {
  width: 10px;
  background: rgba(10, 14, 39, 0.5);
}

.terminal-scroller::-webkit-scrollbar-track {
  background: rgba(10, 14, 39, 0.3);
  border-radius: 5px;
}

.terminal-scroller::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 5px;
  box-shadow: 0 0 10px var(--glow-color);
}

.terminal-scroller::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
  box-shadow: 0 0 15px rgba(0, 217, 255, 0.5);
}

/* Autocomplete suggestions styling */
.cmd .cursor-wrapper ul {
  background: rgba(10, 14, 39, 0.95) !important;
  border: 1px solid rgba(0, 255, 65, 0.3);
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 255, 65, 0.2);
  padding: 5px 0;
  margin-top: 5px;
  backdrop-filter: blur(10px);
}

.cmd .cursor-wrapper li {
  background: transparent !important;
  color: #7a7a7a !important;
  border: none !important;
  padding: 8px 15px !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transition: all 0.2s ease !important;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.cmd .cursor-wrapper li:hover {
  background: rgba(0, 255, 65, 0.15) !important;
  color: var(--primary-color) !important;
  transform: translateX(5px) !important;
  padding-left: 20px !important;
  text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.cmd .cursor-wrapper li:first-child {
  border-radius: 6px 6px 0 0;
}

.cmd .cursor-wrapper li:last-child {
  border-radius: 0 0 6px 6px;
}

/* Responsive design */
/* Large tablets and small desktops */
@media (max-width: 1024px) {
  .terminal {
    max-width: 95%;
    font-size: 15px;
  }
}

/* Tablets */
@media (max-width: 768px) {
  .page-container {
    padding: 10px;
  }

  .terminal {
    width: 100%;
    max-width: 100%;
    font-size: 14px;
    border-radius: 8px;
    min-height: 300px;
    max-height: calc(100vh - 40px);
  }

  .terminal::before {
    height: 25px;
  }

  .terminal::after {
    top: 8px;
    left: 12px;
    width: 10px;
    height: 10px;
    box-shadow: 18px 0 0 #ffbd2e, 36px 0 0 #27c93f,
      0 0 3px rgba(255, 95, 86, 0.5), 18px 0 3px rgba(255, 189, 46, 0.5),
      36px 0 3px rgba(39, 201, 63, 0.5);
  }

  .terminal,
  .cmd {
    font-size: 14px !important;
  }

  body::after {
    background-size: 30px 30px;
  }
}

/* Mobile phones */
@media (max-width: 480px) {
  .page-container {
    padding: 5px;
  }

  .terminal {
    width: 100%;
    max-width: 100%;
    font-size: 13px;
    border-radius: 6px;
    border-width: 1px;
    min-height: 250px;
    max-height: calc(100vh - 20px);
  }

  .terminal::before {
    height: 20px;
  }

  .terminal::after {
    top: 6px;
    left: 10px;
    width: 8px;
    height: 8px;
    box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #27c93f,
      0 0 2px rgba(255, 95, 86, 0.5), 16px 0 2px rgba(255, 189, 46, 0.5),
      32px 0 2px rgba(39, 201, 63, 0.5);
  }

  .terminal,
  .cmd {
    font-size: 13px !important;
    letter-spacing: 0.3px;
  }

  .cmd .cmd-prompt,
  .terminal .cmd-prompt {
    font-size: 13px !important;
  }

  .cmd {
    padding: 10px 8px !important;
  }

  body::after {
    background-size: 20px 20px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .page-container {
    padding: 3px;
  }

  .terminal {
    font-size: 12px;
    border-radius: 4px;
  }

  .terminal,
  .cmd {
    font-size: 12px !important;
  }

  .cmd {
    padding: 8px 6px !important;
  }
}

/* Loading animation */
@keyframes terminalLoading {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.terminal-output > div {
  animation: terminalLoading 0.4s ease-out;
}

/* Enhanced selection */
::selection {
  background: var(--primary-color);
  color: var(--background-darker);
  text-shadow: none;
}

::-moz-selection {
  background: var(--primary-color);
  color: var(--background-darker);
  text-shadow: none;
}

/* Special formatting for data */
.terminal .terminal-output div div[style*="color"] {
  transition: all var(--animation-speed) ease;
}

/* Gradient text effect for headings */
.terminal h1,
.terminal h2,
.terminal h3 {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--accent-color) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    filter: hue-rotate(0deg);
  }
  50% {
    filter: hue-rotate(10deg);
  }
}

/* Command suggestions hover effect */
.cmd .cursor-wrapper li {
  background: rgba(10, 14, 39, 0.9) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--primary-color);
  padding: 5px 10px;
  margin: 2px 0;
  border-radius: 4px;
  transition: all var(--animation-speed) ease;
}

.cmd .cursor-wrapper li:hover {
  background: var(--primary-color) !important;
  color: var(--background-darker) !important;
  transform: translateX(5px);
  box-shadow: 0 0 15px var(--glow-color);
}

/* Typing indicator */
@keyframes typing {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* Focus effects */
.terminal:focus-within {
  box-shadow: 0 0 30px rgba(0, 255, 65, 0.4), 0 0 50px rgba(0, 255, 65, 0.3),
    0 10px 60px rgba(0, 0, 0, 0.6), inset 0 0 120px rgba(0, 255, 65, 0.03);
  border-color: var(--accent-color);
  transition: all 0.5s ease;
}

/* Performance optimization */
.terminal * {
  will-change: transform, opacity;
}

/* Print styles */
@media print {
  body::before,
  body::after,
  .terminal::before,
  .terminal::after {
    display: none;
  }

  .terminal {
    border: 1px solid #000;
    box-shadow: none;
  }

  .language-selector {
    display: none;
  }
}

/* Language Selector Styles */
.language-selector {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 10px;
}

.lang-btn {
  background: rgba(10, 14, 39, 0.9);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  padding: 8px 16px;
  font-family: "Fira Code", monospace;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lang-btn:hover {
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
  transform: translateY(-2px);
}

.lang-btn:active {
  transform: translateY(0);
}

/* Mobile responsive */
@media (max-width: 768px) {
  .language-selector {
    top: 10px;
    right: 10px;
    gap: 5px;
  }

  .lang-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  .language-selector {
    top: 8px;
    right: 8px;
    gap: 4px;
  }

  .lang-btn {
    padding: 5px 10px;
    font-size: 11px;
    border-width: 1px;
  }
}
