/* Flat modern theme w/ extremely subtle shadows */

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --text: #0f172a;
  --muted: #64748b;
  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.18);

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --danger-hover: #dc2626;

  --radius: 14px;
  --radius-sm: 10px;

  /* very very very subtle */
  --shadow-xs: 0 1px 1px rgba(15, 23, 42, 0.04), 0 4px 14px rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 28px rgba(15, 23, 42, 0.04);
  --shadow-focus: 0 0 0 4px rgba(37, 99, 235, 0.14);

  --container: 1120px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 20% 0%, rgba(37, 99, 235, 0.06), transparent 60%),
    radial-gradient(900px 500px at 80% 10%, rgba(99, 102, 241, 0.05), transparent 55%), var(--bg);
  color: var(--text);
  line-height: 1.4;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Layout */
.container {
  max-width: var(--container);
  margin: 32px auto;
  padding: 0 20px;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 600;
}

.page-title {
  margin: 0 0 18px 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

/* Surfaces */
.card,
.upload-card,
.actions,
.filters,
.file-card,
.login-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.actions,
.filters {
  padding: 16px;
}

.upload-card,
.card {
  padding: 24px;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.file-card {
  padding: 18px;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.file-card:hover {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 16px 44px rgba(15, 23, 42, 0.06);
  transform: translateY(-1px);
}

.file-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.file-name {
  font-weight: 750;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  word-break: break-word;
}

.file-info {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.file-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tag {
  background: rgba(37, 99, 235, 0.09);
  color: #1d4ed8;
  border: 1px solid rgba(37, 99, 235, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}

.directory-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, 0.05);
  color: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(15, 23, 42, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  margin-bottom: 10px;
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.06);
  color: rgba(15, 23, 42, 0.86);
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
  user-select: none;
}

.btn:hover {
  background: rgba(15, 23, 42, 0.08);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.16);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.75);
  border-color: var(--border);
  box-shadow: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--border-strong);
}

.btn-danger {
  background: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(239, 68, 68, 0.14);
}

.btn-danger:hover {
  background: var(--danger-hover);
}

/* Forms */
label {
  display: block;
  color: rgba(15, 23, 42, 0.8);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}

input[type="text"],
input[type="password"],
input[type="file"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.55);
  background: #ffffff;
  box-shadow: var(--shadow-focus);
}

.form-group {
  margin-bottom: 16px;
}

.help-text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.search-bar {
  flex: 1;
  min-width: 260px;
}

.filter-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.filter-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 220px;
}

/* File actions */
.file-actions {
  display: flex;
  gap: 10px;
}

.file-actions .btn {
  flex: 1;
  padding: 9px 12px;
  font-size: 12px;
}

.file-actions form {
  flex: 1;
  margin: 0;
}

/* Upload */
.file-input-wrapper {
  position: relative;
  background: rgba(15, 23, 42, 0.03);
  border: 1px dashed rgba(15, 23, 42, 0.24);
  border-radius: var(--radius-sm);
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.file-input-wrapper:hover {
  border-color: rgba(37, 99, 235, 0.5);
  background: rgba(37, 99, 235, 0.05);
  box-shadow: var(--shadow-xs);
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  opacity: 0;
  cursor: pointer;
}

.existing-tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.existing-tag {
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.1);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}

.existing-tag:hover {
  background: rgba(15, 23, 42, 0.07);
  border-color: rgba(15, 23, 42, 0.16);
}

.directory-option {
  margin-top: 12px;
  padding: 14px;
  background: rgba(15, 23, 42, 0.03);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-sm);
}

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

thead {
  background: rgba(15, 23, 42, 0.03);
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  color: rgba(15, 23, 42, 0.86);
}

th {
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(15, 23, 42, 0.6);
}

tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

/* States */
.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--muted);
}

.empty-state h2 {
  margin: 0 0 6px 0;
  color: rgba(15, 23, 42, 0.78);
}

.empty-state-icon {
  font-size: 54px;
  margin-bottom: 14px;
}

.error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.18);
  color: rgba(127, 29, 29, 0.92);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

.info {
  text-align: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Login page */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 22px;
}

.login-container {
  width: 100%;
  max-width: 420px;
  padding: 26px;
}

.login-container h1 {
  margin: 0 0 18px 0;
  font-size: 20px;
  text-align: center;
  letter-spacing: -0.02em;
}

.login-container button {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .file-card,
  .file-input-wrapper {
    transition: none;
  }
  .btn:active,
  .file-card:hover {
    transform: none;
  }
}


