/* ───── Reset & Base ───── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.6;
  min-height: 100vh;
}

/* ───── Login ───── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px;
  width: 100%; max-width: 400px; margin: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.login-header { text-align: center; margin-bottom: 28px; }
.login-header .logo { font-size: 48px; margin-bottom: 8px; }
.login-header h1 { font-size: 24px; font-weight: 700; color: #1a1a2e; }
.login-header p { color: #6b7280; font-size: 14px; margin-top: 4px; }

/* ───── Form ───── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-group input {
  width: 100%; padding: 12px 14px; border: 2px solid #e5e7eb; border-radius: 10px;
  font-size: 15px; transition: border-color 0.2s; outline: none;
}
.form-group input:focus { border-color: #667eea; }

/* ───── Buttons ───── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 20px;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all 0.2s; }
.btn-primary { background: #667eea; color: #fff; }
.btn-primary:hover { background: #5a67d8; transform: translateY(-1px); }
.btn-full { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-outline { background: transparent; border: 2px solid #e5e7eb; color: #4b5563; }
.btn-outline:hover { border-color: #667eea; color: #667eea; }
.btn-view { background: #e0f2fe; color: #0369a1; }
.btn-download { background: #dcfce7; color: #15803d; }
.btn-delete { background: #fee2e2; color: #dc2626; border: none; }
.btn-delete:hover { background: #fecaca; }
.btn-share { background: #fef3c7; color: #b45309; }
.btn-share:hover { background: #fde68a; }
.btn-unshare { background: #f3e8ff; color: #7c3aed; }
.btn-unshare:hover { background: #e9d5ff; }

/* ───── Navbar ───── */
.navbar {
  background: #fff; padding: 14px 24px; display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05); position: sticky; top: 0; z-index: 100;
}
.nav-brand { font-size: 18px; font-weight: 700; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-user { font-size: 14px; color: #4b5563; }
.badge { background: #667eea; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 12px; font-weight: 600; }

/* ───── Layout ───── */
.container { max-width: 960px; margin: 24px auto; padding: 0 16px; }

/* ───── Cards ───── */
.card { background: #fff; border-radius: 16px; padding: 28px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.card h2 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: #1a1a2e; }

/* ───── Search ───── */
.search-card { background: linear-gradient(135deg, #f0fdf4 0%, #fff 100%); }
.search-wrapper { position: relative; display: flex; align-items: center; }
.search-input {
  width: 100%; padding: 12px 16px 12px 44px; border: 2px solid #e5e7eb; border-radius: 12px;
  font-size: 15px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus { border-color: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.1); }
.search-icon { position: absolute; left: 14px; font-size: 18px; pointer-events: none; }

/* ───── Upload ───── */
.upload-card { background: linear-gradient(135deg, #f5f7ff 0%, #fff 100%); }
.upload-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-input-wrapper { flex: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-label {
  display: inline-block; padding: 10px 18px; background: #e5e7eb; border-radius: 10px;
  cursor: pointer; font-size: 14px; font-weight: 600; color: #374151; transition: background 0.2s;
}
.file-label:hover { background: #d1d5db; }
.file-label input[type="file"] { display: none; }
.file-name { font-size: 13px; color: #6b7280; }
.file-name.has-file { color: #1a1a2e; font-weight: 500; }
.hint { font-size: 12px; color: #9ca3af; margin-top: 10px; }

/* ───── Alerts ───── */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.alert-error { background: #fee2e2; color: #dc2626; }
.alert-success { background: #dcfce7; color: #15803d; }

/* ───── Table ───── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 12px 10px; font-size: 12px; text-transform: uppercase; color: #6b7280; border-bottom: 2px solid #e5e7eb; }
tbody tr { border-bottom: 1px solid #f3f4f6; }
tbody tr:hover { background: #f9fafb; }
tbody td { padding: 12px 10px; font-size: 14px; }
.file-cell { display: flex; align-items: center; gap: 8px; }
.file-icon { font-size: 20px; }
.file-name-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.actions { display: flex; gap: 6px; }

/* ───── Empty State ───── */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state p { color: #6b7280; font-size: 15px; }

/* ───── View Toggle ───── */
.files-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.files-header h2 { margin-bottom: 0; }
.view-toggle { display: flex; gap: 4px; background: #f3f4f6; padding: 3px; border-radius: 10px; }
.btn-toggle { background: transparent; border: none; padding: 6px 12px; border-radius: 8px; font-size: 16px; cursor: pointer; transition: all 0.2s; }
.btn-toggle.active { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.btn-toggle:hover:not(.active) { background: #e5e7eb; }

/* ───── Gallery Grid ───── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  padding: 8px 0;
}
.gallery-item {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.08);
}
.gallery-thumb {
  display: block;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: #e5e7eb;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.gallery-item:hover .gallery-thumb img {
  transform: scale(1.05);
}
.gallery-file-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.gallery-info {
  padding: 10px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gallery-name {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gallery-size {
  font-size: 11px;
  color: #6b7280;
}
.gallery-actions {
  padding: 4px 12px 10px;
  display: flex;
  gap: 6px;
}

/* ───── File Count ───── */
.file-count { font-size: 14px; color: #6b7280; font-weight: 400; }

/* ───── Share Modal ───── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.modal-box {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 100%; max-width: 480px; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: slideUp 0.25s ease;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-header h3 { font-size: 18px; font-weight: 700; margin: 0; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: #6b7280; padding: 0 4px; }
.modal-close:hover { color: #1a1a2e; }
.modal-desc { font-size: 14px; color: #6b7280; margin-bottom: 16px; }
.modal-url-wrapper { display: flex; gap: 8px; margin-bottom: 12px; }
.modal-url-input {
  flex: 1; padding: 10px 14px; border: 2px solid #e5e7eb; border-radius: 10px;
  font-size: 13px; outline: none; cursor: pointer;
}
.modal-url-input:focus { border-color: #667eea; }
.modal-hint { font-size: 12px; color: #9ca3af; margin: 0; }

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

/* ───── Responsive ───── */
@media (max-width: 640px) {
  .upload-form { flex-direction: column; align-items: stretch; }
  .file-input-wrapper { flex-direction: column; align-items: stretch; }
  .file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .file-name-cell { max-width: 140px; }
}
