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

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-raised: #191919;
  --border: #2a2a2a;
  --border-light: #333333;
  --text: #ffffff;
  --text-secondary: #aaaaaa;
  --text-muted: #666666;
  --accent: #8B0000;
  --accent-hover: #a50000;
  --accent-glow: rgba(139, 0, 0, 0.3);
  --success: #4caf50;
  --error: #dc3545;
  --font-heading: 'Playfair Display', serif;
  --font-body: 'Poppins', sans-serif;
}

html, body {
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */

.header {
  padding: 24px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
}

.header-split {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  height: 36px;
  width: auto;
}

/* --- Main --- */

.main {
  flex: 1;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.main-wide {
  max-width: 800px;
}

.main-upload {
  max-width: 1080px;
}

/* --- Upload page two-column layout --- */

.upload-layout {
  display: flex;
  gap: 24px;
  align-items: stretch;
}

.upload-col-main {
  flex: 1;
  min-width: 0;
}

.upload-col-sidebar {
  width: 280px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
}

.sidebar-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 20px;
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
}

.sidebar-heading {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.sidebar-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sidebar-list {
  overflow-y: auto;
  flex: 1;
}

.sidebar-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-file:last-child {
  border-bottom: none;
}

.sidebar-file-icon {
  width: 16px;
  height: 16px;
  color: var(--success);
  flex-shrink: 0;
}

.sidebar-file-info {
  flex: 1;
  min-width: 0;
}

.sidebar-file-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-file-type {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  font-weight: 300;
  margin-bottom: 32px;
}

/* --- Buttons --- */

.btn-primary {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--accent);
  border: none;
  padding: 10px 24px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.2s;
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-text:hover {
  color: var(--text-secondary);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: var(--error);
}

/* --- Login --- */

.login-card {
  max-width: 380px;
  margin: 40px auto 0;
}

.login-form {
  margin-top: 24px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--text-muted);
}

.form-error {
  font-size: 13px;
  color: var(--error);
  min-height: 20px;
  margin-bottom: 8px;
}

.login-form .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
}

/* --- Dashboard: Create bar --- */

.create-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.input-name {
  flex: 1;
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.input-name:focus {
  border-color: var(--text-muted);
}

.input-name::placeholder {
  color: var(--text-muted);
}

/* --- Dashboard: Sessions list --- */

.sessions-list {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loading-text, .empty-text {
  color: var(--text-muted);
  font-size: 14px;
  padding: 24px 0;
}

.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px 20px;
}

.session-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.session-name {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 2px;
}

.session-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.session-link-row {
  display: flex;
  gap: 8px;
}

.session-link-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 12px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  outline: none;
  min-width: 0;
}

.btn-copy {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--accent);
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

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

/* --- Security banner --- */

.security-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  background: rgba(21, 87, 36, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.2);
  margin-top: 20px;
}

.security-banner-icon {
  flex-shrink: 0;
  color: var(--success);
  margin-top: 1px;
}

.security-banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--success);
  margin-bottom: 4px;
}

.security-banner-detail {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.success-security {
  font-size: 12px;
  color: var(--success);
  margin-bottom: 24px;
}

/* --- Drop zone --- */

.upload-area {
  border: 2px dashed var(--border-light);
  background: var(--surface);
  padding: 48px 24px;
  text-align: center;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  cursor: pointer;
  position: relative;
}

.upload-area:hover {
  border-color: var(--text-muted);
}

.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--surface-raised);
  box-shadow: inset 0 0 40px var(--accent-glow);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.upload-area.drag-over .upload-icon {
  color: var(--accent);
}

.drop-text {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 4px;
}

.drop-subtext {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}

.browse-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--accent);
  border: none;
  padding: 10px 28px;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background 0.2s;
}

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

.file-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 16px;
}

/* --- File list (pending uploads) --- */

.file-list {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.file-item-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--accent-glow);
  transition: width 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.file-item > *:not(.file-item-progress) {
  position: relative;
  z-index: 1;
}

.file-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size {
  font-size: 12px;
  color: var(--text-muted);
}

.file-status {
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.file-status.pending { color: var(--text-muted); }
.file-status.uploading { color: var(--text-secondary); }
.file-status.complete { color: var(--success); }
.file-status.error { color: var(--error); }

.file-remove {
  width: 20px;
  height: 20px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: color 0.2s;
}

.file-remove:hover { color: var(--error); }
.file-remove.hidden { visibility: hidden; }

/* --- Actions --- */

.actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.upload-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  font-size: 15px;
}

.upload-btn-count {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.2);
  padding: 2px 8px;
}

.clear-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 11px 24px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.clear-btn:hover {
  color: var(--text-secondary);
  border-color: var(--border-light);
}

/* --- Status bar --- */

.status-bar {
  margin-top: 24px;
}

.status-progress-track {
  width: 100%;
  height: 3px;
  background: var(--border);
}

.status-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.status-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* --- Success --- */

.success-message {
  text-align: center;
  padding: 48px 24px;
  margin-top: 32px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.success-icon {
  width: 56px;
  height: 56px;
  color: var(--success);
  margin-bottom: 20px;
}

.success-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 28px;
  margin-bottom: 8px;
}

.success-text {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 28px;
}

.upload-more-btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: 1px solid var(--text-muted);
  padding: 10px 28px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.upload-more-btn:hover {
  border-color: var(--text);
}

/* --- Not found --- */

.notfound-card {
  text-align: center;
  padding: 48px 24px;
}

/* --- Responsive --- */

@media (max-width: 860px) {
  .upload-layout {
    flex-direction: column;
  }

  .upload-col-sidebar {
    width: 100%;
    position: static;
    order: -1;
  }

  .sidebar-inner {
    max-height: 200px;
  }
}

@media (max-width: 600px) {
  .header {
    padding: 16px 20px;
  }

  .main {
    padding: 32px 16px 48px;
  }

  .title {
    font-size: 26px;
  }

  .upload-area {
    padding: 32px 16px;
  }

  .create-bar {
    flex-direction: column;
  }

  .actions {
    flex-direction: column;
  }

  .upload-btn, .clear-btn {
    width: 100%;
    justify-content: center;
  }

  .session-link-row {
    flex-direction: column;
  }
}
