:root {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
  --radius: 12px;
  
  /* Colores Archivos */
  --color-folder: #fbbf24;
  --color-img: #ef4444;
  --color-video: #f97316;
  --color-pdf: #ef4444;
  --color-file: #94a3b8;
}

* { box-sizing: border-box; }

body {
  margin: 0; font-family: 'Inter', sans-serif;
  background-color: var(--bg-body); color: var(--text-main);
  min-height: 100vh; display: flex; flex-direction: column;
}

a { text-decoration: none; color: inherit; transition: .2s; }

/* --- Topbar --- */
.topbar {
  background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); height: 60px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text-main); font-size: 1.1rem; }
.logo-icon { color: var(--primary); font-size: 1.4rem; display: flex; }

/* --- LOGIN PERFECTO (FIXED) --- */
.login-page {
  position: fixed; /* Fuerza pantalla completa real */
  top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; /* Encima de todo */
}
.login-card {
  background: white; width: 100%; max-width: 380px;
  padding: 48px; border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
  text-align: center; border: 1px solid white;
}
.form-input {
  width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; margin-bottom: 16px; outline: none; font-size: 0.95rem;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.pass-wrapper { position: relative; margin-bottom: 20px; }
.pass-toggle { position: absolute; right: 12px; top: 12px; background: none; border: none; cursor: pointer; color: var(--text-muted); }

/* --- Toolbar --- */
.main-container { max-width: 1200px; margin: 0 auto; padding: 24px; width: 100%; flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 0.9rem; color: var(--text-muted); overflow-x: auto; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }

.tools-right { display: flex; gap: 8px; align-items: center; }
.search-wrap { position: relative; }
.search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-input { padding: 8px 12px 8px 32px; border: 1px solid var(--border); border-radius: 8px; outline: none; width: 200px; font-size: 0.9rem; background:white; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  background: white; border: 1px solid var(--border); color: var(--text-main);
  padding: 8px 14px; border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn:hover { background: #f8fafc; border-color: #cbd5e1; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; border-color: transparent; }
.btn-primary:hover { background: var(--primary-hover); box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2); }
.btn-icon { width: 34px; height: 34px; padding: 0; color: var(--text-muted); font-size: 1.1rem; }
.btn-icon.active { background: #eff6ff; color: var(--primary); border-color: #bfdbfe; }

/* --- Files Wrapper (Con Animación) --- */
.files-wrapper {
  transition: opacity 0.2s ease, transform 0.2s ease; /* ANIMACIÓN SUAVE */
  opacity: 1; transform: translateY(0);
}

/* --- Grid System --- */
.files-wrapper.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }

.files-wrapper.grid-view .file-item {
  background: white; border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; align-items: center; text-align: center;
  cursor: pointer; transition: .2s; position: relative; min-height: 160px;
}
.files-wrapper.grid-view .file-item:hover {
  border-color: var(--primary); transform: translateY(-3px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}
.files-wrapper.grid-view .file-icon { font-size: 3rem; margin-bottom: 12px; flex: 1; display: flex; align-items: center; }
.files-wrapper.grid-view .file-name { font-size: 0.85rem; font-weight: 500; width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; color: var(--text-main); }
.files-wrapper.grid-view .file-date { font-size: 0.75rem; color: #94a3b8; } /* FECHA PEQUEÑA */

.grid-actions {
  display: flex; gap: 6px; width: 100%; justify-content: center; 
  border-top: 1px solid #f1f5f9; padding-top: 8px; margin-top: 8px;
}
.mini-btn {
  width: 28px; height: 28px; border-radius: 6px; border: none; background: #f8fafc;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: .2s;
}
.mini-btn:hover { background: #e2e8f0; color: var(--text-main); }
.mini-btn.delete:hover { background: #fee2e2; color: var(--danger); }

/* --- List System --- */
.files-wrapper.list-view { display: flex; flex-direction: column; background: white; border: 1px solid var(--border); border-radius: 12px; }
.files-wrapper.list-view .file-item {
  display: grid; grid-template-columns: 40px 2fr 1fr 1fr 100px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.files-wrapper.list-view .file-item:last-child { border-bottom: none; }
.files-wrapper.list-view .file-item:hover { background: #f8fafc; }
.files-wrapper.list-view .grid-actions { border: none; padding: 0; margin: 0; justify-content: flex-end; }
.files-wrapper.list-view .file-date { color: var(--text-muted); font-size: 0.85rem; }

/* --- Colores Iconos --- */
.icon-folder { color: var(--color-folder); }
.icon-img { color: var(--color-img); }
.icon-video { color: var(--color-video); }
.icon-pdf { color: var(--color-pdf); }
.icon-file { color: var(--color-file); }

/* --- Quota --- */
.quota-card { background: white; border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; }
.quota-track { flex: 1; height: 6px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.quota-fill { height: 100%; background: var(--primary); }
.quota-text { font-size: 0.8rem; font-weight: 500; white-space: nowrap; }

/* --- Preview --- */
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.preview-box { background: #0f172a; border-radius: 16px; padding: 0; overflow: hidden; display: flex; justify-content: center; align-items: center; min-height: 400px; }
.preview-content { max-width: 100%; max-height: 80vh; }

@media (max-width: 768px) {
  .files-wrapper.list-view .file-item { grid-template-columns: 40px 1fr 80px; }
  .files-wrapper.list-view .file-date, .files-wrapper.list-view .file-size { display: none; }
  .grid-actions { opacity: 1; }
}
