:root {
  --primary-color: #121212;
  --secondary-color: #2a2a2a;
  --accent-color: #1e88e5;
  --accent-color-2: #00b8d4;
  --error-color: #ef5350;
  --warning: #4fc3f7;
  --success: #4caf50;

  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-tertiary: #2d2d2d;

  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-tertiary: #757575;

  --shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  --transition: all 0.3s ease;
  --border-color: #333333;
  --highlight: #0d47a1;
}

* {
  box-sizing: border-box;
  font-family: "Arial", sans-serif;
  margin: 0;
  padding: 0;
}

body,
html {
  height: 100%;
  width: 100%;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

header {
  align-items: center;
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: flex;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  border-bottom: 1px solid var(--border-color);
}

label.btn.btn-info {
  background: var(--accent-color);
  border: none;
  border-radius: 0.25rem;
  color: #000000;
  cursor: pointer;
  padding: 0.75rem 1.5rem;
  transition: var(--transition);
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow);
}

label.btn.btn-info:hover {
  background: #0277bd;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(30, 136, 229, 0.3);
}

.container {
  display: flex;
  flex-direction: column;
  height: calc(100% - 4rem);
  overflow: hidden;
}

.sidebar {
  background: linear-gradient(
    to right,
    var(--bg-secondary),
    var(--bg-tertiary)
  );
  flex: 1 1 40%;
  overflow-y: auto;
  padding: 1.5rem;
  min-height: 150px;
  position: relative;
  resize: vertical;
}

.sidebar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.resize-handle {
  width: 100%;
  height: 10px;
  background: var(--bg-secondary);
  cursor: ns-resize;
  position: relative;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.resize-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--accent-color);
}

.content-area {
  background: var(--bg-tertiary);
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  min-height: 150px;
}

.content-area pre {
  background-color: var(--bg-secondary);
  border-radius: 0.5rem;
  padding: 1rem;
  font-family: "Consolas", "Monaco", monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  white-space: pre-wrap;
  max-height: 100%;
  color: var(--text-secondary);
}

.level-wrapper {
  margin: 0.25rem 0;
  transition: var(--transition);
  position: relative;
}

.directory,
.file {
  border-radius: 0.25rem;
  cursor: pointer;
  margin: 0.25rem 0;
  padding: 0.5rem 0.7rem;
  transition: var(--transition);
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  width: max-content;
  min-width: 200px;
  max-width: 90%;
  position: relative;
}

.directory {
  background-color: rgba(30, 136, 229, 0.1);
  font-weight: 600;
  border-left: 3px solid var(--accent-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  z-index: 2;
  background: linear-gradient(
    to right,
    var(--accent-color),
    rgba(30, 136, 229, 0.6)
  );
  color: var(--bg-primary);
  border-radius: 4px 10px 10px 4px;
  border-left: 5px solid var(--highlight);
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(0, 0, 0, 0.3);
}

.directory::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 20px;
  background: linear-gradient(to right, transparent, rgba(30, 136, 229, 0.2));
}

.directory.open {
  background-color: rgba(30, 136, 229, 0.25);
}

.file {
  background-color: var(--bg-secondary);
  border-left: 3px solid var(--accent-color-2);
  margin-bottom: 0.4rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-btn {
  display: inline-block;
  width: 18px;
  height: 18px;
  line-height: 16px;
  text-align: center;
  border-radius: 50%;
  background-color: var(--bg-secondary);
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  font-size: 16px;
  font-weight: bold;
  margin-right: 8px;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  transition: var(--transition);
}

.directory:hover .toggle-btn {
  background-color: var(--accent-color);
  color: var(--bg-primary);
}

.item-icon {
  margin-right: 8px;
}

.item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-content {
  margin-left: 15px;
  border-left: 1px dashed var(--accent-color);
  transition: max-height 0.3s ease-out;
  padding-left: 10px;
  position: relative;
}

.folder-content::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    var(--accent-color),
    var(--accent-color) 4px,
    transparent 4px,
    transparent 8px
  );
}

.hidden {
  display: none;
}

.directory .item-icon::before,
.file .item-icon::before {
  font-family: "Material Icons";
  font-size: 1.25rem;
  vertical-align: middle;
  display: inline-block;
}

.directory .item-icon::before {
  content: "book";
  color: var(--warning);
  font-size: 1.3rem;
}

.directory.open .item-icon::before {
  content: "auto_stories";
  animation: bookOpen 0.3s ease-out;
}

.file .item-icon::before {
  content: "insert_drive_file";
  color: var(--secondary-color);
}

.file[data-type="pdf"] .item-icon::before {
  content: "picture_as_pdf";
  color: #f44336;
}

.file[data-type="txt"] .item-icon::before {
  content: "description";
  color: #90caf9;
}

.file[data-type="jpg"] .item-icon::before,
.file[data-type="png"] .item-icon::before,
.file[data-type="gif"] .item-icon::before {
  content: "image";
  color: #64b5f6;
}

.file[data-type="mp3"] .item-icon::before,
.file[data-type="wav"] .item-icon::before {
  content: "audiotrack";
  color: #42a5f5;
}

.file[data-type="mp4"] .item-icon::before,
.file[data-type="avi"] .item-icon::before {
  content: "movie";
  color: #2196f3;
}

.file[data-type="js"] .item-icon::before {
  content: "javascript";
  color: #ffeb3b;
}

.file[data-type="html"] .item-icon::before {
  content: "html";
  color: #ff7043;
}

.file[data-type="css"] .item-icon::before {
  content: "css";
  color: #29b6f6;
}

.file[data-type="md"] .item-icon::before,
.file[data-type="markdown"] .item-icon::before {
  content: "article";
  color: #26c6da;
}

.file[data-type="json"] .item-icon::before {
  content: "data_object";
  color: #80deea;
}

.file[data-type="xml"] .item-icon::before {
  content: "code";
  color: #4dd0e1;
}

.file[data-type="docx"] .item-icon::before,
.file[data-type="doc"] .item-icon::before {
  content: "description";
  color: #0288d1;
}

.file[data-type="xls"] .item-icon::before,
.file[data-type="xlsx"] .item-icon::before {
  content: "table_chart";
  color: #26a69a;
}

.file[data-type="ppt"] .item-icon::before,
.file[data-type="pptx"] .item-icon::before {
  content: "slideshow";
  color: #81d4fa;
}

.file[data-type="zip"] .item-icon::before,
.file[data-type="rar"] .item-icon::before {
  content: "folder_zip";
  color: #b3e5fc;
}

.file[data-type="exe"] .item-icon::before {
  content: "smart_button";
  color: #bbdefb;
}

.file:not([data-type]) .item-icon::before,
.file[data-type=""] .item-icon::before {
  color: #78909c;
}

.file:hover {
  background-color: rgba(30, 136, 229, 0.1);
  transform: translateX(2px);
}

.sidebar::before {
  content: "My files";
  display: block;
  font-weight: bold;
  margin-bottom: 1.2rem;
  color: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 0.8rem;
  font-size: 1.3rem;
  text-align: center;
  font-family: "Georgia", serif;
  letter-spacing: 0.5px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.content-area::before {
  content: "Contenido del archivo";
  display: block;
  font-weight: bold;
  margin-bottom: 1rem;
  color: var(--accent-color-2);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  font-size: 1.1rem;
}

.file.selected {
  background-color: rgba(30, 136, 229, 0.15);
  border-left: 3px solid var(--accent-color);
  box-shadow: 2px 2px 10px rgba(30, 136, 229, 0.2);
  position: relative;
  transform: translateX(3px);
}

.file.selected::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 0;
  height: 100%;
  width: 6px;
  background-color: var(--accent-color);
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(30, 136, 229, 0.5);
}

.file-info {
  margin-bottom: 1rem;
  padding: 0.5rem;
  background-color: var(--light-bg);
  border-radius: 0.25rem;
  font-size: 0.9rem;
}

.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  font-style: italic;
  color: var(--text-tertiary);
}

.loading::before {
  content: "";
  width: 20px;
  height: 20px;
  margin-right: 10px;
  border: 3px solid var(--bg-tertiary);
  border-top: 3px solid var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.error {
  padding: 1rem;
  background-color: rgba(207, 102, 121, 0.1);
  border-left: 4px solid var(--error-color);
  color: var(--error-color);
  border-radius: 0.25rem;
}

@media (max-height: 768px) {
  .sidebar {
    flex: 0 0 30%;
  }
}

body.error-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  text-align: center;
  background-color: var(--bg-primary);
}

.error-page h1 {
  font-size: 5rem;
  color: var(--accent-color);
  margin-bottom: 1rem;
  text-shadow: 0 0 10px rgba(30, 136, 229, 0.3);
}

.error-page h2 {
  font-size: 2rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.error-page p {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.error-page a {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.75rem 1.5rem;
  background-color: var(--accent-color);
  color: var(--bg-primary);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
  transition: var(--transition);
}

.error-page a:hover {
  background-color: #a070d6;
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(187, 134, 252, 0.5);
}

@keyframes bookOpen {
  0% {
    transform: rotateY(70deg);
    opacity: 0.5;
  }
  100% {
    transform: rotateY(0deg);
    opacity: 1;
  }
}

.level-wrapper::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 0;
  width: 1px;
  background-color: rgba(255, 255, 255, 0.05);
  z-index: 1;
}

.sidebar > .level-wrapper > .directory {
  background: linear-gradient(
    to right,
    var(--accent-color),
    rgba(187, 134, 252, 0.6)
  );
  color: var(--bg-primary);
  border-radius: 4px 10px 10px 4px;
  border-left: 5px solid var(--highlight);
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
  width: max-content;
  max-width: 300px;
}
