/* ============================================
   NexusShell - Global Styles
   ============================================ */

@import url('./variables.css');

/* Google Font is loaded via <link> in HTML for performance */

/* ---- CSS Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-cyan);
}

button {
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  outline: none;
  background: none;
}

input, textarea, select {
  font-family: var(--font-family);
  outline: none;
  border: none;
}

ul, ol {
  list-style: none;
}

pre, code {
  font-family: 'Consolas', 'Courier New', Courier, monospace;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

/* ---- Selection ---- */
::selection {
  background: rgba(102, 126, 234, 0.4);
  color: #fff;
}

::-moz-selection {
  background: rgba(102, 126, 234, 0.4);
  color: #fff;
}

/* ---- Container ---- */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
  min-height: 100vh;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

/* ============================================
   Toast Notification System (Terminal Log Style)
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0;
  pointer-events: none;
  background: rgba(32, 13, 29, 0.9);
  border-top: 1px solid var(--border-color);
  max-height: 30vh;
  overflow-y: auto;
  padding: var(--space-2);
}

.toast-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: none;
  pointer-events: auto;
  font-size: var(--font-size-sm);
  color: var(--text-primary);
  line-height: 1.2;
}

.toast-item.toast-exit {
  display: none;
}

.toast-item .toast-icon {
  flex-shrink: 0;
  color: var(--accent-primary);
}

.toast-item .toast-icon svg {
  display: none; /* Hide SVG, we will use text in JS */
}

.toast-item .toast-message {
  flex: 1;
  word-break: break-all;
}

.toast-item .toast-close {
  display: none; /* No close button in log */
}

/* Toast types */
.toast-item.toast-info { color: var(--accent-cyan); }
.toast-item.toast-success { color: var(--accent-green); }
.toast-item.toast-error { color: var(--accent-red); }
.toast-item.toast-warning { color: var(--accent-orange); }

/* ============================================
   Footer links + About panel
   ============================================ */
.footer { margin-top: auto; }

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
}

.footer-link {
  color: var(--text-muted);
  background: none;
  border: none;
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  padding: 0;
  cursor: pointer;
}

.footer-link:hover { color: var(--accent-primary); }

#github-link:hover { color: #B7F0B1; }

.footer-sep { color: var(--text-muted); }

.counter-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.counter-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px dashed var(--text-muted);
  padding-bottom: var(--space-2);
}

.counter-label { color: var(--text-secondary); }

.counter-value {
  color: var(--accent-primary);
  font-weight: bold;
  font-size: var(--font-size-lg);
}

.about-panel {
  position: relative;
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: var(--space-6);
  margin: var(--space-4) 0;
  color: var(--text-secondary);
  line-height: 1.7;
  text-align: left;
}

.about-panel .about-title {
  color: var(--accent-primary);
  margin-bottom: var(--space-4);
}

.about-panel p { margin-bottom: var(--space-4); }
.about-panel p:last-child { margin-bottom: 0; }
.about-panel code { color: var(--accent-primary); }

.about-close {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  color: var(--accent-red);
  background: none;
  border: none;
  font-family: var(--font-family);
  cursor: pointer;
}

.about-close:hover { color: var(--accent-primary); }

/* ============================================
   TX-16 · Terminal Boot transition (GitHub link)
   ============================================ */
.fx-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #0a0a0a;
}

.fx-term {
  position: absolute;
  inset: 0;
  background: #0a0a0a;
  color: rgb(95, 216, 119);
  font: 500 14px/1.7 var(--font-family);
  padding: 28px 24px;
  overflow: hidden;
  white-space: pre-wrap;
}

.fx-term .cur {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: rgb(95, 216, 119);
  vertical-align: -2px;
  animation: tblink 1s steps(1) infinite;
}

@keyframes tblink {
  50% { opacity: 0; }
}

/* ============================================
   Modal Overlay
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  max-width: 500px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9) translateY(20px);
  transition: transform var(--transition-spring);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

/* ============================================
   Loading Spinner
   ============================================ */
/* Spinner animations removed for CLI text-based loading */

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-glass) 25%,
    var(--bg-glass-hover) 50%,
    var(--bg-glass) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 16px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-title {
  height: 24px;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton-card {
  height: 180px;
  border-radius: var(--radius-md);
}

.skeleton-thumbnail {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   Utility classes
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.slide-up {
  animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.slide-down {
  animation: slideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .app-container {
    padding: 0 var(--space-4);
  }

  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
    max-width: none;
  }
}

@media (max-width: 480px) {
  .app-container {
    padding: 0 var(--space-3);
  }

  html {
    font-size: 14px;
  }
}
