/* ============================================
   FileShare – style.css
   ============================================ */

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

:root {
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-light: #e0e7ff;
  --accent: #06b6d4;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(79,70,229,0.12);
  --radius: 14px;
  --radius-sm: 8px;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* -------- NAVBAR -------- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.logo-icon { font-size: 1.5rem; }

.nav-links { list-style: none; display: flex; gap: 24px; }
.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--primary); }

.user-info { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 0.9rem;
}

/* -------- MODAL / LOGIN -------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}
.modal-overlay.hidden { display: none; }
.modal-overlay.active { display: flex; }

.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.modal-box h2 {
  font-size: 2rem; font-weight: 800;
  color: var(--primary); margin-bottom: 8px;
}
.modal-sub { color: var(--text-muted); margin-bottom: 28px; }
.modal-box input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.modal-box input:focus { border-color: var(--primary); }

/* -------- BUTTONS -------- */
.btn-primary, .btn-secondary, .btn-outline, .btn-danger {
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-primary {
  background: var(--primary); color: white;
  box-shadow: 0 4px 12px rgba(79,70,229,0.3);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary {
  background: var(--primary-light); color: var(--primary);
}
.btn-secondary:hover { background: #c7d2fe; }
.btn-outline {
  background: transparent; border: 2px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }

/* -------- STATS BAR -------- */
.stats-bar {
  display: flex; gap: 20px;
  padding: 24px 32px 0;
  max-width: 1200px; margin: 0 auto;
}
.stat-card {
  flex: 1;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-num {
  font-size: 1.9rem; font-weight: 800;
  color: var(--primary);
}
.stat-label { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }

/* -------- SECTION CARDS -------- */
.section-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  margin: 24px auto;
  max-width: 1200px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 1.2rem; font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary-light);
}

/* -------- DROP ZONE -------- */
.drop-zone {
  border: 2.5px dashed var(--primary);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  background: var(--primary-light);
  cursor: pointer;
  transition: all 0.2s;
  color: var(--primary);
}
.drop-zone.dragover {
  background: #c7d2fe;
  border-color: var(--primary-dark);
  transform: scale(1.01);
}
.drop-icon { font-size: 3rem; margin-bottom: 12px; }
.drop-zone p { font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.drop-zone span { color: var(--text-muted); font-size: 0.9rem; display: block; margin-bottom: 12px; }

/* -------- UPLOAD PREVIEW -------- */
.upload-preview {
  margin-top: 20px;
  padding: 20px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.upload-preview h3 { font-size: 1rem; margin-bottom: 12px; color: var(--text-muted); }
#preview-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
#preview-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.9rem;
}
.upload-actions { margin-top: 16px; display: flex; gap: 12px; }

/* -------- PROGRESS BAR -------- */
.progress-container { margin-top: 20px; }
.progress-bar-bg {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  width: 0%;
  transition: width 0.4s ease;
}
#progress-text { font-size: 0.88rem; color: var(--text-muted); margin-top: 8px; }

/* -------- SEARCH / FILTER BAR -------- */
.search-filter-bar {
  display: flex; gap: 12px;
  padding: 0 32px;
  max-width: 1200px; margin: 0 auto;
}
.search-filter-bar input, .search-filter-bar select {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  background: white;
  transition: border-color 0.2s;
}
.search-filter-bar input { flex: 1; }
.search-filter-bar input:focus,
.search-filter-bar select:focus { border-color: var(--primary); }

/* -------- FILES GRID -------- */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* -------- FILE CARD -------- */
.file-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
}
.file-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.file-thumb {
  width: 100%; aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.8rem;
  background: var(--primary-light);
  overflow: hidden;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.file-name {
  font-weight: 600; font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-meta { font-size: 0.78rem; color: var(--text-muted); }
.file-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--success); color: white;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}

/* -------- FILE DETAIL MODAL -------- */
.file-detail-box {
  max-width: 560px;
  text-align: left;
  position: relative;
}
.close-btn {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none;
  font-size: 1.6rem; cursor: pointer; color: var(--text-muted);
}
#file-preview-area {
  width: 100%; min-height: 160px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 5rem;
  margin-bottom: 20px;
  overflow: hidden;
}
#file-preview-area img, #file-preview-area video {
  max-width: 100%; max-height: 260px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
#file-detail-info { margin-bottom: 20px; }
#file-detail-info h3 { font-size: 1.1rem; margin-bottom: 10px; }
#file-detail-info table { width: 100%; border-collapse: collapse; }
#file-detail-info td {
  padding: 6px 0; font-size: 0.88rem;
  border-bottom: 1px solid var(--border);
}
#file-detail-info td:first-child { color: var(--text-muted); width: 100px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.share-link-box {
  margin-top: 16px;
  display: flex; gap: 8px;
}
.share-link-box input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  outline: none;
}

/* -------- TOAST -------- */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: #1e293b; color: white;
  padding: 12px 22px; border-radius: var(--radius-sm);
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  z-index: 9999;
  animation: fadeInUp 0.3s ease;
}
.toast.hidden { display: none; }
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.info    { background: var(--primary); }
@keyframes fadeInUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* -------- UTILITY -------- */
.hidden { display: none !important; }

/* -------- RESPONSIVE -------- */
@media (max-width: 768px) {
  .navbar { padding: 0 16px; }
  .nav-links { display: none; }
  .stats-bar { flex-wrap: wrap; padding: 16px; gap: 12px; }
  .stat-card { min-width: calc(50% - 6px); }
  .section-card { margin: 16px; padding: 20px; }
  .search-filter-bar { flex-wrap: wrap; padding: 0 16px; }
  .search-filter-bar input { min-width: 100%; }
}
