/* ========== RESET ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1e1e1e;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ========== HEADER ========== */
header {
  background-color: #2b2b2b;
  color: #fff;
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-right: auto;
  color: #61dafb;
}

.search-container {
  display: flex;
  gap: 0.5rem;
  flex: 1;
  min-width: 250px;
  max-width: 500px;
}

.search-container input,
.search-container select {
  padding: 0.5rem;
  border: 1px solid #444;
  border-radius: 4px;
  font-size: 1rem;
  background: #333;
  color: #e0e0e0;
}

.search-container input:focus,
.search-container select:focus {
  outline: none;
  border-color: #61dafb;
}

/* ========== BOTONES ========== */
.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 0.6rem 1.2rem;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  transition: background 0.2s, border-color 0.2s, transform 0.1s;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #0d6efd;
  color: white;
}
.btn-primary:hover {
  background: #0b5ed7;
}

.btn-secondary {
  background: #3a3a3a;
  color: #e0e0e0;
  border: 1px solid #555;
}
.btn-secondary:hover {
  background: #4a4a4a;
  border-color: #666;
}

.btn-danger {
  background: #c0392b;
  color: white;
}
.btn-danger:hover {
  background: #a93226;
}

/* ========== CONTENIDO PRINCIPAL ========== */
main {
  flex: 1;
  padding: 2rem;
}

.groups-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
  padding: 0.5rem;
  min-height: 200px;
  align-items: flex-start;
}

/* ========== TARJETAS DE GRUPO ========== */
.group-card {
  background: #2d2d2d;
  border-radius: 8px;
  padding: 1.5rem;
  width: 250px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.4);
  cursor: pointer;
  border: 1px solid #3f3f3f;
  transition: border-color 0.2s, transform 0.2s;
}

.group-card:hover {
  border-color: #61dafb;
  transform: translateY(-2px);
}

.group-card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: #61dafb;
}

.group-card p {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 1rem;
}

.group-card .code {
  font-family: monospace;
  background: #3a3a3a;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.85rem;
  color: #ddd;
}

/* ========== MODALES ========== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #2d2d2d;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  position: relative;
  border: 1px solid #444;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h2 {
  color: #e0e0e0;
}

.modal-content input {
  padding: 0.6rem;
  border: 1px solid #555;
  border-radius: 4px;
  font-size: 1rem;
  background: #333;
  color: #e0e0e0;
}

.modal-content input:focus {
  outline: none;
  border-color: #61dafb;
}

.close {
  position: absolute;
  top: 0.5rem;
  right: 1rem;
  font-size: 1.5rem;
  cursor: pointer;
  color: #aaa;
}
.close:hover {
  color: #fff;
}

/* ========== NAVEGACIÓN DE GRUPO ========== */
.group-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  background: #2d2d2d;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  border: 1px solid #3f3f3f;
}

.group-nav button {
  background: #3a3a3a;
  color: #e0e0e0;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.group-nav button:hover {
  background: #4a4a4a;
}

.breadcrumb {
  flex: 1;
  font-size: 1rem;
  color: #aaa;
}

/* ========== ARCHIVOS Y CARPETAS ========== */
.file-item {
  background: #2d2d2d;
  border-radius: 8px;
  padding: 1rem;
  width: 200px;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  cursor: pointer;
  border: 1px solid #3f3f3f;
  transition: border-color 0.2s;
  flex-shrink: 0;
}

.file-item:hover {
  border-color: #61dafb;
}

.file-icon {
  font-size: 2rem;
}

.file-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name {
  font-weight: 600;
  word-break: break-all;
  color: #e0e0e0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  font-size: 0.8rem;
  color: #888;
}

.btn-rename {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.7;
  color: #f1c40f;
}
.btn-rename:hover {
  opacity: 1;
}

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  opacity: 0.6;
  color: #ff6b6b;
}
.btn-delete:hover {
  opacity: 1;
}

/* ========== DRAG & DROP ========== */
.file-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}

.file-item.drop-target,
.groups-grid.drop-target {
  border-color: #0d6efd;
  background: #3a3a3a;
}

.groups-grid.drop-zone-external {
  outline: 2px dashed #0d6efd;
  outline-offset: 5px;
}

/* ========== FOOTER ========== */
.site-footer {
  background-color: #2b2b2b;
  color: #aaa;
  text-align: center;
  padding: 1rem;
  border-top: 1px solid #3f3f3f;
  font-size: 0.9rem;
  margin-top: auto;
}
.site-footer strong {
  color: #61dafb;
}

/* ========== LOGIN ========== */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1e1e1e;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}
.login-screen.hidden {
  display: none;
}

.login-box {
  background: #2d2d2d;
  padding: 2rem;
  border-radius: 8px;
  width: 90%;
  max-width: 350px;
  text-align: center;
  border: 1px solid #444;
}
.login-box h1 {
  color: #61dafb;
  margin-bottom: 1rem;
}
.login-box p {
  margin-bottom: 1rem;
  color: #aaa;
}
.login-box input {
  width: 100%;
  padding: 0.6rem;
  margin-bottom: 1rem;
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 1rem;
}
.login-box input:focus {
  outline: none;
  border-color: #61dafb;
}

/* ========== INFO DE USUARIO ========== */
.user-info {
  color: #aaa;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.user-info span {
  background: #3a3a3a;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

/* ========== PAPELERA ========== */
.trash-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.trash-item {
  background: #333;
  padding: 0.5rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.trash-item .trash-info {
  flex: 1;
  word-break: break-all;
  font-size: 0.9rem;
  color: #ddd;
}

.trash-item .trash-actions {
  display: flex;
  gap: 0.5rem;
}

.trash-item button {
  background: #0d6efd;
  color: white;
  border: none;
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}
.trash-item button:hover {
  background: #0b5ed7;
}
.trash-item button.btn-delete-forever {
  background: #c0392b;
}
.trash-item button.btn-delete-forever:hover {
  background: #a93226;
}

/* ========== BARRA DE PROGRESO ========== */
.progress-container {
  width: 100%;
  background: #333;
  border-radius: 4px;
  overflow: hidden;
  height: 20px;
  margin: 0.5rem 0;
  display: none;
}

.progress-bar {
  height: 100%;
  background: #0d6efd;
  width: 0%;
  transition: width 0.2s;
}

/* ========== VISOR DE ARCHIVOS ========== */
.preview-content {
  max-width: 90%;
  max-height: 80vh;
  overflow: auto;
}

#previewContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

#previewContainer img,
#previewContainer video,
#previewContainer audio {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 4px;
  display: block;
  margin: 0 auto;
}

/* ========== UTILIDADES ========== */
.hidden {
  display: none !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: stretch;
  }
  header h1 {
    text-align: center;
    margin-right: 0;
  }
  .search-container {
    max-width: 100%;
  }
  .groups-grid {
    justify-content: center;
  }
  .group-card {
    width: 100%;
    max-width: 300px;
  }
  .file-item {
    width: 100%;
    max-width: 250px;
  }
  .group-nav {
    flex-direction: column;
    align-items: stretch;
  }
  .group-nav button {
    width: 100%;
  }
  .breadcrumb {
    text-align: center;
  }
}