/* Terminal Box Layout - Main styling for terminal portfolio */
:root {
  --border-color: #333;
  --header-bg: #111;
  --box-bg: #0a0a0a;
  --text-color: #c0c0c0;
  --highlight-color: #ff8c00;
  --secondary-highlight: #0f4a9c;
  --terminal-font: 'JetBrains Mono', 'Fira Mono', 'Consolas', monospace;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--box-bg);
  color: var(--text-color);
  font-family: var(--terminal-font);
  font-size: 14px;
  display: flex;
  height: 100vh;
  flex-direction: column;
  overflow: hidden;
}

/* Main layout structure */
.terminal-layout {
  display: flex;
  width: 100%;
  height: calc(100vh - 28px);
  flex-wrap: wrap;
  overflow: hidden;
  position: relative;
  z-index: 0;
}

.sidebar {
  width: 320px;
  min-width: 250px;
  max-width: 100%; 
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  overflow: hidden;
  background-color: var(--box-bg);
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  border-right: 1px solid var(--border-color);
}

.sidebar-middle-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 10px 0;
}

.main-content {
  flex: 999 1 500px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  margin-left: -1px;
  z-index: 1;
}

/* Box styling with continuous borders */
.box {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 0;
  overflow: visible;
  box-sizing: border-box;
  isolation: isolate;
  padding-top: 0;
}

.box-header, .box-footer {
  height: 20px;
  display: flex;
  align-items: center;
  position: relative;
  background-color: transparent;
  z-index: 2;
  box-sizing: border-box;
}

.box-header {
  padding: 0;
  justify-content: flex-start;
  position: absolute;
  top: 0;
  left: 0;
  width: auto;
  height: 24px;
  line-height: 1;
  overflow: visible;
  z-index: 5; 
  transform: translateY(-50%);
}

.box-title {
  background-color: var(--box-bg);
  font-weight: bold;
  padding: 0 12px;
  margin-left: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 12px;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  height: 24px;
  line-height: 24px;
  overflow: visible;
  white-space: nowrap;
  border-right: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-bottom-right-radius: 3px;
  transition: all 0.2s ease;
  color: var(--highlight-color);
  box-sizing: border-box;
}

.box-content {
  padding: 8px 10px;
  margin-top: 12px;
  overflow-y: auto;
  flex: 1;
  z-index: 1;
  position: relative;
  min-height: 20px;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.main-content .box-content {
  margin-top: 20px;
  padding: 0 15px;
}

.sidebar-middle-content .box-content {
  max-height: none;
  overflow-y: auto;
}

.box-footer {
  padding: 0;
  justify-content: flex-end;
  position: absolute;
  bottom: 0;
  right: 0;
  width: auto;
  height: 24px;
  display: flex;
  align-items: center;
  overflow: visible;
  z-index: 3;
  transform: translateY(50%);
}

.box-footer span {
  background-color: var(--box-bg);
  padding: 0 8px;
  font-size: 11px;
  opacity: 0.7;
  margin-right: 0;
  border-top-left-radius: 3px;
  border-left: 1px solid var(--border-color);
  border-top: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

/* Hover effects for boxes */
.box:hover .box-footer span {
  opacity: 1;
  color: var(--highlight-color);
  border-color: var(--highlight-color);
}

.box:hover .box-title {
  color: var(--highlight-color);
  border-color: var(--highlight-color);
}

.box:hover .box-title::before {
  background-color: var(--highlight-color);
  opacity: 0.4;
}

/* Specific boxes */
.intro-box, .experience-box, .projects-box, .skills-box, .navigation-box {
  flex: 0 0 auto;
  margin-bottom: 15px;
  padding-top: 0;
  padding-bottom: 8px;
  position: relative;
  border-radius: 0;
  z-index: 1;
}

.intro-box {
  min-height: 50px !important;
  margin-top: 10px !important;
  margin-bottom: 15px !important;
  padding: 0 12px 8px 12px !important;
  border-color: var(--border-color);
}

.sidebar-middle-content .projects-box, 
.sidebar-middle-content .experience-box {
  flex: 1 1 auto;
  min-height: 50px;
}

.sidebar-middle-content .skills-box {
  flex: 3 1 auto;
  min-height: 40px;
  max-height: none;
  margin-bottom: 15px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  flex-basis: 0;
}

.navigation-box {
  min-height: 50px !important;
  margin-bottom: 10px !important;
  padding: 0 12px 8px 12px !important;
  border-color: var(--border-color);
}

.main-box {
  flex: 1;
  border: 1px solid var(--border-color);
  padding-top: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  margin: 8px;
}

.main-content-area {
  line-height: 1.6;
  padding: 15px 15px 5px 15px;
  overflow-y: auto;
  max-height: calc(100vh - 80px);
}

/* Content styling */
.highlight {
  color: var(--highlight-color);
}

.secondary-highlight {
  color: var(--secondary-highlight);
}

/* Experience entries styling */
.experience-entry {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  margin-left: 6px;
  line-height: 1.5;
  padding: 3px 5px;
  border-radius: 3px;
  transition: background-color 0.15s ease;
  position: relative;
  width: calc(100% - 15px);
  box-sizing: border-box;
  overflow: visible;
}

.experience-entry > div:first-child {
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

.experience-entry .highlight {
  padding-left: 15px;
  position: relative;
  color: var(--highlight-color);
  font-size: 0.95em;
  opacity: 0.9;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 100%;
}

.sidebar-middle-content .experience-box .scroll-content {
  max-height: calc(30vh);
  padding-bottom: 10px;
}

/* List styling */
ul.item-list {
  list-style-type: none;
  padding: 0;
  margin: 0 10px;
  display: block;
}

.skills-box ul.item-list {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 6px;
}

ul.item-list li {
  display: flex;
  align-items: center;
  padding: 2px 0;
  line-height: 1.5;
  margin: 2px 0;
  white-space: normal;
  position: relative;
}

.project-marker {
  color: var(--secondary-highlight);
  margin-right: 8px;
  font-size: 12px;
  display: inline-block;
  width: 12px;
  text-align: center;
  font-weight: normal;
}

.skill-marker {
  color: var(--secondary-highlight);
  margin-right: 8px;
  font-size: 10px;
  display: inline-block;
  width: 12px;
  text-align: center;
}

.skills-box ul.item-list li {
  flex: 0 0 calc(50% - 3px);
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
  min-width: 0;
  padding: 2px 0;
  font-size: 13px;
}

ul.item-list li::before {
  content: none;
}

/* Projects list styling */
.projects-box ul.item-list {
  display: block;
}

.projects-box ul.item-list li {
  display: flex;
  margin-bottom: 5px;
  white-space: normal;
  line-height: 1.5;
  position: relative;
  padding: 2px 5px;
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.projects-box ul.item-list li::before {
  content: none;
}

/* Active item styling */
.box-content li.active, 
.box-content .experience-entry.active {
  color: var(--highlight-color);
  background-color: rgba(255, 140, 0, 0.1);
  position: relative;
  transform: translateX(0px);
  transition: all 0.2s ease;
}

.box-content .experience-entry.active > div:first-child {
  color: var(--highlight-color);
}

.box-content li.active::after,
.box-content .experience-entry.active::after {
  content: '';
  position: absolute;
  left: -10px;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--highlight-color);
}

.box-content li:hover, 
.box-content .experience-entry:hover {
  background-color: rgba(15, 74, 156, 0.1);
  cursor: pointer;
}

/* Scrollable content styling */
.skills-box .scroll-content {
  max-height: calc(35vh);
  padding-right: 5px;
  padding-bottom: 20px;
}

.scroll-content {
  overflow-y: auto;
  max-height: calc(25vh);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  padding-bottom: 25px;
  position: relative;
  z-index: 2;
  margin-bottom: 10px;
}

/* Responsive design */
@media (max-width: 1024px) {
  .sidebar {
    width: 300px;
  }
  
  .skills-box ul.item-list li {
    flex: 0 0 calc(50% - 6px);
    font-size: 13px;
  }
  
  .experience-entry > div:first-child {
    font-size: 13px;
  }
  
  .experience-entry .highlight {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  .terminal-layout {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    min-width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    max-height: 45vh;
  }
  
  .main-content {
    height: 55vh;
  }
  
  .experience-entry {
    margin-bottom: 4px;
    padding: 2px 4px;
  }
  
  .experience-entry > div:first-child {
    font-size: 12px;
  }
  
  .experience-entry .highlight {
    font-size: 11px;
    padding-left: 12px;
  }
  
  .experience-entry .highlight::before {
    left: 1px;
  }
  
  .projects-box ul.item-list li {
    margin-bottom: 3px;
    font-size: 13px;
  }
  
  .skills-box ul.item-list {
    gap: 3px 6px;
  }
  
  .skills-box ul.item-list li {
    flex: 0 0 calc(50% - 4px);
    font-size: 12px;
    margin-bottom: 2px;
  }
}

@media (max-width: 480px) {
  .experience-entry, 
  .projects-box ul.item-list li, 
  .skills-box ul.item-list li {
    margin-bottom: 2px;
    padding: 1px 3px;
  }
  
  .skills-box ul.item-list {
    gap: 1px 10px;
  }
  
  .experience-entry > div:first-child {
    font-size: 11px;
  }
  
  .experience-entry .highlight {
    font-size: 10px;
    padding-left: 10px;
  }
}

/* ASCII art styling */
.ascii-art {
  font-family: monospace;
  white-space: pre;
  font-size: 10px;
  line-height: 1.2;
  margin: 10px 0;
  overflow: hidden;
  max-width: 100%;
  text-align: center;
  display: block;
}

/* Box layout fixes */
.sidebar-middle-content > .box + .box {
  margin-top: 6px;
  margin-bottom: 6px;
}

.box:last-child .box-content {
  margin-bottom: 12px;
}

.sidebar-middle-content .box {
  margin-left: 0;
  margin-right: 0;
  width: 100%;
}

/* Skills two-column layout */
@media (min-width: 350px) {
  .skills-box ul.item-list {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 3px 8px;
  }
  
  .skills-box ul.item-list li {
    flex: 0 0 calc(50% - 5px);
    min-width: 0;
  }
}

/* Box refinements */
.sidebar-middle-content .box {
  margin: 5px 0;
  position: relative;
  z-index: 1;
}

.skills-box .scroll-content {
  margin-bottom: 5px;
  padding-bottom: 20px;
}

.box:hover {
  border-color: var(--highlight-color);
  transition: border-color 0.3s ease;
}

/* Corner links styling */
.corner-links {
  position: fixed;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 10px;
  z-index: 100;
}

.corner-links a {
  color: var(--text-color);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background-color: var(--box-bg);
  font-size: 12px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.corner-links a:hover {
  opacity: 1;
  color: var(--highlight-color);
  border-color: var(--highlight-color);
}

/* Main content styling */
.main-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  border-bottom: 1px solid var(--border-color);
  z-index: 1;
}

.main-content {
  padding: 5px;
}

.main-content .box {
  margin: 5px;
}

.main-content-area {
  margin-top: 10px;
  padding: 15px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

/* Navigation bar at the bottom */
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: var(--box-bg);
  border-top: 1px solid var(--border-color);
  padding: 8px 0;
  text-align: center;
  z-index: 100;
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.nav-links a {
  color: var(--text-color);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  background-color: var(--box-bg);
  font-size: 13px;
  opacity: 0.8;
  transition: all 0.2s ease;
}

.nav-links a:hover {
  opacity: 1;
  color: var(--highlight-color);
  border-color: var(--highlight-color);
}

/* Responsive nav display */
@media (min-width: 768px) {
  .nav-bar {
    display: none;
  }
}

@media (max-width: 767px) {
  .corner-links {
    display: none;
  }
}

/* Box styling refinements */
.main-box .box-header {
  left: 0;
}

/* Box styling refinements */

.box-title {
  color: var(--text-color);
  transition: color 0.2s ease;
  font-weight: 600;
}

.box-header {
  height: 30px;
}

.main-content-area pre, 
.main-content-area p {
  margin-top: 0;
  margin-bottom: 15px;
}

.skills-box .box-content {
  padding-bottom: 30px;
}

/* Navigation box styling */
.navigation-box .box-content {
  padding: 10px 12px;
  margin-top: 12px;
  margin-bottom: 5px;
}

/* Active box styling */
.box.active {
  border-color: var(--highlight-color);
  box-shadow: 0 0 0 1px var(--highlight-color), 0 0 8px 0 rgba(255, 140, 0, 0.3);
  position: relative;
  z-index: 5;
}

.box.active .box-title {
  color: var(--highlight-color);
  border-color: var(--highlight-color);
  font-weight: 700;
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 1px var(--highlight-color), 0 0 8px 0 rgba(255, 140, 0, 0.3); }
  50% { box-shadow: 0 0 0 1px var(--highlight-color), 0 0 12px 2px rgba(255, 140, 0, 0.5); }
  100% { box-shadow: 0 0 0 1px var(--highlight-color), 0 0 8px 0 rgba(255, 140, 0, 0.3); }
}

.box.active.keyboard-nav {
  animation: pulse-border 1.5s infinite;
}

/* Keyboard hint styling */
.keyboard-hints {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.key {
  display: inline-block;
  padding: 1px 6px;
  background-color: var(--header-bg);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  font-family: var(--terminal-font);
  font-weight: bold;
  color: var(--highlight-color);
  margin-right: 4px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.2);
  min-width: 10px;
  text-align: center;
}

/* Keyboard tooltip styling */
#keyboard-tooltip {
  position: fixed;
  padding: 8px 12px;
  background-color: var(--header-bg);
  border: 1px solid var(--highlight-color);
  border-radius: 4px;
  font-family: var(--terminal-font);
  font-size: 14px;
  color: var(--text-color);
  z-index: 1000;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  pointer-events: none;
}

#keyboard-tooltip.active {
  opacity: 1;
  transform: translateY(0);
  animation: tooltip-pulse 2s infinite;
}

@keyframes tooltip-pulse {
  0% { border-color: var(--highlight-color); }
  50% { border-color: var(--secondary-highlight); }
  100% { border-color: var(--highlight-color); }
}
