@import url('https://fonts.googleapis.com/css2?family=VT323&family=Share+Tech+Mono&display=swap');

* {
  box-sizing: border-box;
}

:root {
  --terminal-green: #00ff41;
  --terminal-green-dark: #00cc33;
  --terminal-amber: #ffb000;
  --terminal-amber-dark: #cc8c00;
  --terminal-bg: #0a0a0a;
  --terminal-bg-alt: #0d0d0d;
  --terminal-border: #00ff41;
  --terminal-text: #00ff41;
  --terminal-text-muted: #00cc33;
  --terminal-error: #ff0040;
  --terminal-warning: #ffb000;
  --glow: rgba(0, 255, 65, 0.5);
  --glow-strong: rgba(0, 255, 65, 0.8);
}

body {
  margin: 0;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  background: var(--terminal-bg);
  color: var(--terminal-text);
  line-height: 1.4;
  position: relative;
  overflow-x: hidden;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* CRT Effect */
.crt-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    transparent 50%,
    rgba(0, 255, 65, 0.03) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 9999;
  animation: scanline 8s linear infinite;
}

.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15),
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  z-index: 9998;
}

@keyframes scanline {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(4px);
  }
}

@keyframes flicker {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.98;
  }
}

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

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
  animation: flicker 0.15s infinite;
  width: 100%;
  box-sizing: border-box;
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--terminal-border);
  border-style: double;
  box-shadow: 0 2px 10px var(--glow);
  flex-wrap: wrap;
}

.header__loading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  max-width: 100%;
  padding: 8px 12px;
  background: rgba(0, 255, 65, 0.05);
  border: 1px solid var(--terminal-border);
  flex-shrink: 1; /* Allow shrinking on mobile */
}

.header__loading.hidden {
  display: none;
}

.loading-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.loading-label {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  color: var(--terminal-green);
  text-shadow: 0 0 3px var(--terminal-green);
  min-width: 120px;
  max-width: 100%;
  flex-shrink: 1; /* Allow shrinking on mobile */
  letter-spacing: 0.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--terminal-bg-alt);
  border: 1px solid var(--terminal-border);
  position: relative;
  overflow: hidden;
  min-width: 100px;
  max-width: 100%;
  flex-shrink: 1; /* Allow shrinking on mobile */
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--terminal-green), var(--terminal-green-dark));
  box-shadow: 0 0 8px var(--terminal-green);
  opacity: 0;
  transition: width 1.5s ease-in-out, opacity 0.3s ease-in-out;
}

.header__date {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  color: var(--terminal-text-muted);
  text-shadow: 0 0 3px var(--terminal-green-dark);
  letter-spacing: 1px;
  white-space: nowrap;
  padding: 4px 12px;
  border: 1px solid var(--terminal-border);
  background: rgba(0, 255, 65, 0.05);
}

.header__status {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 200px;
}

.status-message {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  color: var(--terminal-error);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 16px;
  border: 2px solid var(--terminal-error);
  border-style: double;
  background: rgba(255, 0, 64, 0.1);
  text-shadow: 0 0 5px var(--terminal-error);
  box-shadow: 0 0 10px rgba(255, 0, 64, 0.3);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.5s, transform 0.5s;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-message--visible {
  opacity: 1;
  transform: translateY(0);
}

.status-message.hidden {
  display: none;
}

.header__brand {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__brand > div:last-child {
  margin-top: 4px; /* Additional spacing from title row */
  margin-left: 44px; /* Spacing from left to align with text (icon width 32px + gap 12px) */
}

.icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px var(--terminal-green));
}

.icon--logo {
  width: 32px;
  height: 32px;
  color: var(--terminal-green);
  filter: drop-shadow(0 0 5px var(--terminal-green));
}

.icon--large {
  width: 48px;
  height: 48px;
  color: var(--terminal-green);
  margin-bottom: 16px;
}

.retro-title {
  font-family: 'VT323', monospace;
  font-size: 36px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--terminal-green);
  text-shadow: 
    0 0 5px var(--terminal-green),
    0 0 10px var(--terminal-green),
    0 0 15px var(--terminal-green);
  animation: glow 2s ease-in-out infinite;
  margin: 0;
}

.retro-subtitle {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--terminal-text-muted);
  text-shadow: 0 0 3px var(--terminal-green-dark);
}

.user-name {
  font-family: 'Share Tech Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--terminal-text-muted);
  text-shadow: 0 0 3px var(--terminal-green-dark);
  margin-top: 4px;
}

.retro-h2 {
  font-family: 'VT323', monospace;
  font-size: 28px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--terminal-green);
  text-shadow: 0 0 5px var(--terminal-green);
}

.retro-ascii {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: var(--terminal-green);
  text-shadow: 0 0 5px var(--terminal-green);
  margin-bottom: 20px;
  line-height: 1.2;
}

.retro-ascii pre {
  margin: 0;
  font-family: inherit;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  color: var(--terminal-text);
}

h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 600;
}

h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.muted {
  color: var(--terminal-text-muted);
  margin: 4px 0 0;
  font-size: 14px;
  text-shadow: 0 0 3px var(--terminal-green-dark);
}

.card {
  background: var(--terminal-bg-alt);
  border-radius: 0;
  padding: 24px;
  box-shadow: 
    0 0 10px var(--glow),
    inset 0 0 20px rgba(0, 255, 65, 0.1);
  border: 2px solid var(--terminal-border);
  border-style: double;
  position: relative;
  transition: box-shadow 0.3s;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0; /* Allow shrinking below content size */
  overflow: hidden; /* Force cut off overflow */
}

.card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, var(--terminal-green), transparent, var(--terminal-green));
  z-index: -1;
  opacity: 0.3;
  animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.4;
  }
}

.card:hover {
  box-shadow: 
    0 0 20px var(--glow-strong),
    inset 0 0 30px rgba(0, 255, 65, 0.15);
}

.card--centered {
  max-width: 420px;
  margin: 0 auto;
}

.card__header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--terminal-border);
  border-style: double;
}

.login__header {
  text-align: center;
  margin-bottom: 32px;
}

.login__association {
  text-align: center;
  margin-bottom: 12px;
  font-size: 12px;
  color: var(--terminal-green);
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 1px;
  text-shadow: 0 0 5px var(--terminal-green);
  text-transform: uppercase;
}

.login__developed {
  text-align: center;
  margin-bottom: 24px;
  font-size: 11px;
  color: var(--terminal-text-muted);
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 1px;
}

.password-hint {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  color: var(--terminal-text-muted);
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form {
  display: grid;
  gap: 20px;
}

.form-label {
  display: grid;
  gap: 8px;
}

.form-label span {
  font-weight: 600;
  font-size: 14px;
  color: var(--terminal-text);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'Share Tech Mono', monospace;
}

input,
textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: 0;
  border: 2px solid var(--terminal-border);
  font-size: 14px;
  font-family: 'Share Tech Mono', monospace;
  transition: all 0.2s;
  background: var(--terminal-bg);
  color: var(--terminal-green);
  text-shadow: 0 0 3px var(--terminal-green);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  box-sizing: border-box;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--terminal-green);
  box-shadow: 
    inset 0 0 10px rgba(0, 0, 0, 0.5),
    0 0 10px var(--glow);
  text-shadow: 0 0 5px var(--terminal-green);
}

input::placeholder,
textarea::placeholder {
  color: var(--terminal-text-muted);
  opacity: 0.6;
}

textarea {
  min-height: 400px;
  resize: none; /* Remove resize handle, only scrollbar */
  font-family: 'Courier New', 'Share Tech Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid var(--terminal-border);
  border-radius: 0;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Share Tech Mono', monospace;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.3), transparent);
  transition: left 0.5s;
}

.btn:hover::before {
  left: 100%;
}

.btn--primary {
  background: var(--terminal-bg);
  color: var(--terminal-green);
  border-color: var(--terminal-border);
  text-shadow: 0 0 5px var(--terminal-green);
  box-shadow: 0 0 10px var(--glow);
}

.btn--primary:hover {
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 20px var(--glow-strong);
  text-shadow: 0 0 10px var(--terminal-green);
  transform: translateY(-1px);
}

.btn--primary:active {
  transform: translateY(0);
  box-shadow: 0 0 5px var(--glow);
}

.btn--secondary {
  background: var(--terminal-bg-alt);
  color: var(--terminal-green);
  border-color: var(--terminal-border);
  text-shadow: 0 0 3px var(--terminal-green);
}

.btn--secondary:hover {
  background: rgba(0, 255, 65, 0.1);
  border-color: var(--terminal-green);
  text-shadow: 0 0 5px var(--terminal-green);
  box-shadow: 0 0 10px var(--glow);
}

.hidden {
  display: none !important;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--terminal-bg-alt);
  border-radius: 0;
  border: 2px solid var(--terminal-border);
  border-style: double;
  box-shadow: 0 0 10px var(--glow);
}

.toolbar__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.breadcrumbs {
  font-weight: 600;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-family: 'Share Tech Mono', monospace;
}

.breadcrumbs button {
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--terminal-green);
  padding: 4px 8px;
  border-radius: 0;
  transition: all 0.2s;
  text-shadow: 0 0 3px var(--terminal-green);
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
}

.breadcrumbs button:hover {
  background: rgba(0, 255, 65, 0.1);
  text-shadow: 0 0 10px var(--terminal-green);
  box-shadow: 0 0 5px var(--glow);
}

.breadcrumbs span {
  color: var(--terminal-text-muted);
  user-select: none;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0; /* Allow grid to shrink below content size */
  overflow: hidden; /* Force cut off overflow */
}

.table-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 600px;
  margin-top: 12px;
  border: 1px solid var(--terminal-border);
  position: relative;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0; /* Allow shrinking below content size */
}

.table-container thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-container::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.table-container::-webkit-scrollbar-track {
  background: var(--terminal-bg);
  border: 1px solid var(--terminal-border);
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--terminal-green);
  border: 2px solid var(--terminal-bg);
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--terminal-green-dark);
  box-shadow: 0 0 5px var(--glow);
}

.table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--terminal-border);
  table-layout: fixed; /* Fixed layout for consistent column widths - prevents overflow */
  box-sizing: border-box;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--terminal-green);
  border-bottom: 2px solid var(--terminal-border);
  background: var(--terminal-bg);
  font-family: 'Share Tech Mono', monospace;
  text-shadow: 0 0 3px var(--terminal-green);
  position: sticky;
  top: 0;
  z-index: 10;
}

.table th:nth-child(1) {
  width: 60%; /* NAME column - larger for filenames */
  min-width: 150px; /* Ensure at least 10-12 characters visible */
}

.table th:nth-child(2) {
  width: 12%; /* SIZE column - reduced */
  padding-right: 8px; /* Reduced right padding to bring closer to MODIFIED */
}

.table th:nth-child(3) {
  width: 28%; /* MODIFIED column - reduced */
  padding-left: 8px; /* Reduced left padding to bring closer to SIZE */
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--terminal-border);
  font-size: 14px;
  font-family: 'Share Tech Mono', monospace;
  overflow: hidden; /* Always clip at cell boundary to prevent overlap */
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0; /* Force cells to respect column width with table-layout: fixed */
}

/* NAME column - always clip to prevent overflow into other columns */
.table td:nth-child(1) {
  overflow: visible; /* Allow filename to show fully until SIZE column */
  position: relative; /* For proper stacking */
}

.table td:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 8px; /* Reduced right padding to bring closer to MODIFIED */
}

.table td:nth-child(3) {
  overflow: hidden; /* Clip to prevent overflow */
  text-overflow: ellipsis; /* Truncate with ellipsis if too long */
  white-space: nowrap; /* Keep on one line */
  padding-left: 8px; /* Reduced left padding to bring closer to SIZE */
}

.table tbody tr {
  transition: background 0.15s;
}

.table tbody tr:hover {
  background: rgba(0, 255, 65, 0.05);
  box-shadow: inset 0 0 10px rgba(0, 255, 65, 0.1);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table button {
  background: none;
  border: none;
  color: var(--terminal-green);
  font-weight: 600;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 0;
  transition: all 0.2s;
  font-size: 14px;
  font-family: 'Share Tech Mono', monospace;
  text-shadow: 0 0 3px var(--terminal-green);
  overflow: visible; /* Show full filename by default */
  text-overflow: clip; /* Don't truncate by default */
  white-space: nowrap;
  min-width: 0; /* Allow button to shrink */
  flex: 1 1 auto; /* Take available space but allow shrinking */
  text-align: left;
  max-width: 100%; /* Don't exceed cell width */
}

/* Truncate filename only when hovering (buttons appear) */
.table tbody tr:hover .file-name-container {
  overflow: hidden; /* Clip container when buttons appear */
}

.table tbody tr:hover .file-name-container > button {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 60px); /* Reserve space for button group (2 buttons @ 24px + gaps @ 12px) */
  flex-shrink: 1; /* Allow filename to shrink when buttons appear */
}

.file-action-buttons {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

.table button:hover {
  background: rgba(0, 255, 65, 0.1);
  text-shadow: 0 0 10px var(--terminal-green);
  box-shadow: 0 0 5px var(--glow);
}

.file-name-container {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* Allow flex item to shrink */
  overflow: visible; /* Show full filename until hover */
  width: 100%; /* Ensure it takes full width of cell */
  position: relative; /* Ensure proper stacking */
  max-width: 100%; /* Never exceed cell width */
}

/* Ensure filename button doesn't overlap with buttons */
.file-name-container > button {
  position: relative;
  z-index: 1; /* Behind buttons when they appear */
  padding-right: 0; /* No padding on right by default */
}

/* Add padding on hover to make room for buttons */
.table tbody tr:hover .file-name-container > button {
  padding-right: 60px; /* Make room for buttons on hover */
}


.file-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--terminal-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-icon .icon {
  width: 100%;
  height: 100%;
  stroke: var(--terminal-text-muted);
}

.folder-icon {
  color: var(--terminal-amber);
  filter: drop-shadow(0 0 3px var(--terminal-amber));
}

.file-action-buttons {
  display: flex;
  gap: 4px; /* Reduced gap between buttons */
  align-items: center;
  flex-shrink: 0;
  opacity: 0; /* Hidden by default */
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  position: absolute; /* Position absolutely to not affect filename width */
  right: 0; /* Align to right of container */
  top: 50%; /* Center vertically */
  transform: translateY(-50%); /* Center vertically */
  background: var(--terminal-bg); /* Background to cover filename when visible */
  padding-left: 4px; /* Small padding to separate from filename */
  z-index: 10; /* Above filename */
}

.btn-download,
.btn-delete {
  background: var(--terminal-bg);
  color: var(--terminal-green);
  border: 1px solid var(--terminal-border);
  border-radius: 0;
  padding: 4px 6px;
  font-size: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  text-shadow: 0 0 3px var(--terminal-green);
  font-family: 'Share Tech Mono', monospace;
  flex-shrink: 0;
}

.table tbody tr:hover .file-action-buttons {
  opacity: 1;
  visibility: visible;
}

.table tbody tr:hover .btn-download,
.table tbody tr:hover .btn-delete {
  opacity: 1;
  visibility: visible;
}

.btn-download:hover {
  background: rgba(0, 255, 65, 0.15);
  box-shadow: 0 0 8px var(--glow);
  text-shadow: 0 0 8px var(--terminal-green);
  transform: scale(1.1);
}

.btn-delete {
  color: var(--terminal-error);
  border-color: var(--terminal-error);
  text-shadow: 0 0 3px var(--terminal-error);
}

.btn-delete:hover {
  background: rgba(255, 0, 64, 0.15);
  box-shadow: 0 0 8px rgba(255, 0, 64, 0.3);
  text-shadow: 0 0 8px var(--terminal-error);
  transform: scale(1.1);
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0; /* Allow shrinking below content size */
  overflow: hidden; /* Force cut off overflow */
}

.editor__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--terminal-border);
  border-style: double;
}

.error {
  color: var(--terminal-error);
  margin-top: 12px;
  padding: 12px;
  background: rgba(255, 0, 64, 0.1);
  border-radius: 0;
  border: 2px solid var(--terminal-error);
  font-size: 14px;
  font-family: 'Share Tech Mono', monospace;
  text-shadow: 0 0 5px var(--terminal-error);
  box-shadow: 0 0 10px rgba(255, 0, 64, 0.3);
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s;
}

.modal-overlay.hidden {
  display: none;
}

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

.modal {
  background: var(--terminal-bg-alt);
  border-radius: 0;
  box-shadow: 
    0 0 30px var(--glow-strong),
    inset 0 0 30px rgba(0, 255, 65, 0.1);
  width: 100%;
  max-width: 480px;
  animation: slideUp 0.3s;
  border: 3px solid var(--terminal-border);
  border-style: double;
  position: relative;
}

.modal::before {
  content: '';
  position: absolute;
  top: -3px;
  left: -3px;
  right: -3px;
  bottom: -3px;
  background: linear-gradient(45deg, var(--terminal-green), transparent, var(--terminal-green));
  z-index: -1;
  opacity: 0.3;
  animation: borderGlow 2s ease-in-out infinite;
}

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

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
  border-bottom: 2px solid var(--terminal-border);
  border-style: double;
  margin-bottom: 24px;
  padding-bottom: 20px;
}

.modal__header h3 {
  font-family: 'VT323', monospace;
  font-size: 24px;
  color: var(--terminal-green);
  text-shadow: 0 0 5px var(--terminal-green);
}

.modal__close {
  background: none;
  border: 2px solid var(--terminal-border);
  cursor: pointer;
  padding: 8px;
  border-radius: 0;
  color: var(--terminal-green);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.modal__close:hover {
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 10px var(--glow);
}

.modal__body {
  padding: 0 24px;
}

.modal__input {
  margin-top: 8px;
  font-family: 'Share Tech Mono', monospace;
}

.modal__hint {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--terminal-text-muted);
  font-family: 'Share Tech Mono', monospace;
}

.modal__message {
  font-family: 'Share Tech Mono', monospace;
  font-size: 14px;
  line-height: 1.6;
  color: var(--terminal-text);
  white-space: pre-line;
  margin: 0;
  padding: 16px;
  background: rgba(0, 255, 65, 0.05);
  border: 1px solid var(--terminal-border);
  border-radius: 0;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 24px;
  border-top: 2px solid var(--terminal-border);
  border-style: double;
  margin-top: 24px;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--terminal-bg-alt);
  border-top-color: var(--terminal-green);
  border-radius: 0;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 20px var(--glow);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }
  
  .layout > section:first-child {
    order: 1; /* Directory listing first */
  }
  
  .layout > section.editor {
    order: 2; /* Editor second */

  }

  .app {
    padding: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .app__header {
    padding: 16px;
    padding-bottom: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .layout {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden; /* Force cut off overflow */
  }
  
  .layout > section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  .table-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
  }
  
  .table {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Remove min-width constraint */
  }
  
  .editor {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar__actions {
    width: 100%;
  }

  .toolbar__actions .btn {
    flex: 1;
  }

  .header__status {
    order: 3;
    width: 100%;
    margin-top: 16px;
  }

  .status-message {
    font-size: 10px;
    padding: 6px 12px;
  }
}

@media (max-width: 768px) {
  .app {
    padding: 12px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .app__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .layout {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden; /* Force cut off overflow */
  }
  
  .layout > section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  .table-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
  }
  
  .table {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Remove min-width constraint */
  }
  
  .editor {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
  }
  
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .header__brand {
    width: 100%;
  }

  .header__loading {
    width: 100%;
    min-width: 0; /* Remove min-width constraint on mobile */
    max-width: 100%;
  }

  .loading-item {
    flex-wrap: wrap; /* Allow wrapping on very small screens */
  }

  .loading-label {
    min-width: 0; /* Remove min-width constraint on mobile */
    font-size: 9px; /* Slightly smaller on mobile */
  }

  .progress-bar {
    min-width: 60px; /* Reduced min-width for mobile */
    flex: 1 1 auto; /* Allow flexible sizing */
  }

  .header__date {
    width: 100%;
    font-size: 10px;
  }

  .header__status {
    width: 100%;
    margin-top: 0;
  }

  .retro-title {
    font-size: 28px;
  }

  .retro-subtitle {
    font-size: 11px;
  }

  .user-name {
    font-size: 10px;
  }

  .card {
    padding: 16px;
  }

  .toolbar {
    padding: 12px 16px;
  }

  .breadcrumbs {
    font-size: 12px;
  }

  .table th,
  .table td {
    padding: 8px 6px;
    font-size: 12px;
  }

  .table th {
    font-size: 11px;
  }
  
  .table th:nth-child(1) {
    width: 55%; /* Keep more space for NAME column on mobile */
    min-width: 120px; /* Ensure at least 10-12 characters visible */
  }
  
  .table th:nth-child(2) {
    width: 13%; /* SIZE column - reduced */
  }
  
  .table th:nth-child(3) {
    width: 32%; /* MODIFIED column for mobile */
  }
  
  .table td:nth-child(1) {
    min-width: 120px; /* Ensure filename shows at least 10-12 characters */
  }
  
  .table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px; /* Smaller font for date on mobile */
  }

  .file-name-container {
    gap: 8px;
  }

  .btn-download,
  .btn-delete {
    min-width: 22px;
    height: 22px;
    padding: 3px 5px;
    font-size: 9px;
    opacity: 1; /* Always visible on mobile */
    visibility: visible;
  }

  .editor__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  textarea {
    min-height: 300px;
    font-size: 12px;
  }

  .modal {
    margin: 10px;
    max-width: calc(100% - 20px);
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding: 16px;
  }

  .modal__header h3 {
    font-size: 20px;
  }

  .btn {
    padding: 8px 16px;
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 8px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .app__header {
    margin-bottom: 16px;
    padding: 12px;
    padding-bottom: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
  
  .layout {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden; /* Force cut off overflow */
  }
  
  .layout > section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  .table-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
  }
  
  .table {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Remove min-width constraint */
  }
  
  .editor {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
    overflow: hidden; /* Force cut off overflow */
  }
  
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0; /* Allow shrinking below content size */
  }
  
  textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .header__loading {
    padding: 6px 8px;
    gap: 4px;
    width: 100%;
    min-width: 0;
  }

  .loading-label {
    font-size: 8px;
    min-width: 0;
  }

  .progress-bar {
    min-width: 50px;
    height: 6px;
  }

  .retro-title {
    font-size: 24px;
    letter-spacing: 2px;
  }

  .retro-subtitle {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .user-name {
    font-size: 9px;
  }

  .card {
    padding: 12px;
  }

  .toolbar {
    padding: 10px 12px;
    gap: 12px;
  }

  .toolbar__actions {
    flex-direction: column;
  }

  .toolbar__actions .btn {
    width: 100%;
    justify-content: center;
  }

  .breadcrumbs {
    font-size: 11px;
    gap: 4px;
  }

  .breadcrumbs button {
    padding: 2px 4px;
  }

  .table-container {
    max-height: 400px;
  }

  .table th,
  .table td {
    padding: 6px 4px;
    font-size: 11px;
  }

  .table th {
    font-size: 10px;
    padding: 8px 4px;
  }
  
  .table th:nth-child(1) {
    width: 52%; /* Keep more space for NAME column on small mobile */
    min-width: 110px; /* Ensure at least 10-12 characters visible */
  }
  
  .table th:nth-child(2) {
    width: 14%; /* SIZE column - reduced */
  }
  
  .table th:nth-child(3) {
    width: 34%; /* MODIFIED column for small mobile */
  }
  
  .table td:nth-child(1) {
    min-width: 110px; /* Ensure filename shows at least 10-12 characters */
  }
  
  .table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 9px; /* Even smaller font for date on small mobile */
    padding: 6px 2px; /* Reduce padding */
  }

  .file-name-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .file-name-container > div {
    width: 100%;
  }

  .file-name-container button {
    max-width: calc(100% - 80px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-download,
  .btn-delete {
    min-width: 20px;
    height: 20px;
    padding: 2px 4px;
    font-size: 9px;
    opacity: 1; /* Always visible on small mobile */
    visibility: visible;
  }

  .editor__header h3 {
    font-size: 14px;
  }

  .editor__header p {
    font-size: 11px;
  }

  textarea {
    min-height: 250px;
    font-size: 11px;
    padding: 10px;
  }

  .status-message {
    font-size: 9px;
    padding: 4px 8px;
    max-width: 100%;
  }

  .modal {
    margin: 5px;
    max-width: calc(100% - 10px);
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding: 12px;
  }

  .modal__header h3 {
    font-size: 18px;
  }

  .modal__input {
    font-size: 13px;
    padding: 10px;
  }

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

  .modal__footer {
    flex-direction: column;
  }

  .modal__footer .btn {
    width: 100%;
  }

  .login__header {
    margin-bottom: 24px;
  }

  .retro-ascii {
    font-size: 10px;
  }

  .retro-h2 {
    font-size: 22px;
  }

  .form {
    gap: 16px;
  }

  input {
    font-size: 13px;
    padding: 10px;
  }

  .login__association {
    font-size: 11px;
    margin-bottom: 10px;
  }

  .login__developed {
    font-size: 10px;
    margin-bottom: 20px;
  }
}

@media (max-width: 360px) {
  .retro-title {
    font-size: 20px;
  }

  .table th,
  .table td {
    font-size: 10px;
    padding: 4px 2px;
  }
  
  .table th:nth-child(1) {
    width: 50%; /* Keep more space for NAME column on very small mobile */
    min-width: 100px; /* Ensure at least 10-12 characters visible */
  }
  
  .table th:nth-child(2) {
    width: 15%; /* SIZE column - reduced */
  }
  
  .table th:nth-child(3) {
    width: 35%; /* MODIFIED column for very small mobile */
  }
  
  .table td:nth-child(1) {
    min-width: 100px; /* Ensure filename shows at least 10-12 characters */
  }
  
  .table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 8px; /* Even smaller font for date on very small mobile */
    padding: 4px 1px; /* Reduce padding further */
  }

  .status-message {
    font-size: 8px;
    padding: 3px 6px;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    padding: 12px 20px;
  }

  .table button {
    min-height: 44px;
    padding: 8px 12px;
  }

  .btn-download,
  .btn-delete {
    min-width: 32px;
    min-height: 32px;
    opacity: 1; /* Always visible on touch devices */
    visibility: visible;
  }

  input,
  textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* Terminal cursor blink effect */
@keyframes blink {
  0%, 50% {
    opacity: 1;
  }
  51%, 100% {
    opacity: 0;
  }
}

input:focus::after,
textarea:focus::after {
  content: '_';
  animation: blink 1s infinite;
}
