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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.6;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 20px;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Typography */
h1 { font-size: 1.75rem; margin-bottom: 8px; }
h2 { font-size: 1.25rem; margin-bottom: 16px; color: #333; }
.text-muted { color: #888; font-size: 0.9rem; }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* Forms */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
  font-size: 0.9rem;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: #fff;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; text-align: center; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-warning { background: #f59e0b; color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #22c55e; color: #fff; }

/* Login */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}
.login-card {
  width: 100%;
  max-width: 400px;
}
.login-card h1 {
  text-align: center;
  margin-bottom: 24px;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.table-wrapper { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
th {
  font-weight: 600;
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.row-disabled { opacity: 0.5; }
.actions { white-space: nowrap; }
.actions form { margin-right: 4px; }
.expires-form { display: flex; flex-direction: column; gap: 2px; }
.expires-select {
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.8rem;
  background: #fff;
  cursor: pointer;
}
.expires-select:focus { outline: none; border-color: #3b82f6; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-active { background: #dcfce7; color: #16a34a; }
.badge-inactive { background: #fee2e2; color: #dc2626; }
.badge-expired { background: #fef3c7; color: #b45309; }

/* Share page header */
.share-header {
  margin-bottom: 20px;
}

/* Dropzone */
.dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: #fafbfc;
}
.dropzone:hover, .dropzone.dragover {
  border-color: #3b82f6;
  background: #eff6ff;
}
.dropzone-icon {
  width: 48px;
  height: 48px;
  color: #9ca3af;
  margin-bottom: 12px;
}
.dropzone.dragover .dropzone-icon { color: #3b82f6; }
.dropzone-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: #4b5563;
  margin-bottom: 4px;
}
.dropzone-subtext {
  color: #9ca3af;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* Progress */
.progress-area {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.progress-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  transition: opacity 0.3s;
}
.progress-name {
  flex: 0 0 auto;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress-pct {
  flex: 0 0 40px;
  text-align: right;
}
.progress-bar {
  flex: 1;
  height: 8px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #3b82f6;
  border-radius: 4px;
  transition: width 0.3s;
}
.progress-fill.progress-error { background: #ef4444; }

/* File grid */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.file-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: box-shadow 0.2s;
}
.file-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.file-card-new {
  opacity: 0;
  transform: scale(0.95);
  animation: fileAppear 0.3s ease forwards;
}
@keyframes fileAppear {
  to { opacity: 1; transform: scale(1); }
}
.file-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
}
.file-icon svg {
  width: 48px;
  height: 48px;
  color: #9ca3af;
}
.file-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}
.file-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.file-name {
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size {
  font-size: 0.75rem;
  color: #888;
}

/* Change password */
.password-toggle {
  cursor: pointer;
  font-weight: 500;
  font-size: 0.95rem;
  color: #374151;
  padding: 4px 0;
  list-style: none;
}
.password-toggle::-webkit-details-marker { display: none; }
.password-toggle::before {
  content: '▸ ';
  font-size: 0.85rem;
}
details[open] .password-toggle::before { content: '▾ '; }
.password-form {
  margin-top: 16px;
  max-width: 400px;
}

/* Not found */
.not-found {
  text-align: center;
  padding: 80px 20px;
}
.not-found h1 {
  font-size: 2rem;
  margin-bottom: 12px;
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 12px; }
  .card { padding: 16px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  table { font-size: 0.85rem; }
  th, td { padding: 8px; }
  .dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
}
