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

:root {
  --bg:        #f8f9fa;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --accent:    #2563eb;
  --accent-h:  #1d4ed8;
  --text:      #1e293b;
  --text-muted:#64748b;
  --text-xmut: #94a3b8;
  --folder:    #f59e0b;
  --danger:    #dc2626;
  --radius:    6px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow);
}
header .logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
}
header .logo svg { color: var(--accent); flex-shrink: 0; }

/* ── Layout ── */
.page { max-width: 1024px; margin: 0 auto; padding: 24px 24px 48px; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--accent); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--text-xmut); padding: 0 2px; }
.breadcrumb .current { color: var(--text); font-weight: 500; }

/* ── Search ── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.search-bar input {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.search-bar input::placeholder { color: var(--text-xmut); }
.btn {
  height: 36px;
  padding: 0 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-ghost {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* ── Hint text ── */
.hint { font-size: 12px; color: var(--text-xmut); margin-top: -14px; margin-bottom: 16px; }

/* ── Actions bar ── */
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.actions .spacer { flex: 1; }

/* ── File table ── */
.file-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.file-table-header {
  display: grid;
  grid-template-columns: 1fr 90px 150px 68px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-xmut);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.file-row {
  display: grid;
  grid-template-columns: 1fr 90px 150px 68px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background .1s;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: #f8faff; }

.file-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.file-name svg { flex-shrink: 0; }
.file-name a {
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name a:hover { color: var(--accent); }
.file-name.is-folder a { font-weight: 500; }

.file-size { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.file-date { color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.file-action { display: flex; justify-content: flex-end; gap: 2px; }

.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  color: var(--text-xmut);
  transition: background .15s, color .15s;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}
.dl-btn:hover { background: var(--bg); color: var(--accent); }
.copy-btn.copied { color: #16a34a; }

/* ── Empty state ── */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.empty svg { margin-bottom: 12px; color: var(--border); }
.empty p { font-size: 14px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.pagination a, .pagination .pg-current, .pagination .pg-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border-radius: var(--radius);
  font-size: 13px;
  text-decoration: none;
  transition: background .15s;
}
.pagination a { color: var(--text-muted); border: 1px solid transparent; }
.pagination a:hover { background: var(--surface); border-color: var(--border); color: var(--text); }
.pagination .pg-current {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  pointer-events: none;
}
.pagination .pg-gap { color: var(--text-xmut); pointer-events: none; }
.pagination .pg-arrow { font-size: 16px; color: var(--text-muted); }

/* ── Bucket grid ── */
.bucket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.bucket-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.bucket-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}
.bucket-card svg { color: var(--folder); flex-shrink: 0; }
.bucket-card span {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Page title ── */
.page-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

/* ── Error ── */
.error-card {
  background: var(--surface);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  max-width: 480px;
  margin: 64px auto;
  box-shadow: var(--shadow);
}
.error-card svg { color: var(--danger); margin-bottom: 12px; }
.error-card h2 { font-size: 16px; margin-bottom: 8px; }
.error-card p { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }

/* ── Count badge ── */
.count-badge {
  font-size: 12px;
  color: var(--text-xmut);
  font-variant-numeric: tabular-nums;
}

/* ── Progress bar ── */
#nprogress {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 3px;
  z-index: 9999;
  pointer-events: none;
  transform: translateX(-100%);
  transition: transform .2s ease, opacity .3s ease;
  opacity: 0;
  background: linear-gradient(to right, var(--accent), #60a5fa);
}
#nprogress.running {
  opacity: 1;
  animation: progress-run 1.8s ease-in-out infinite;
}
#nprogress.done {
  transform: translateX(0);
  opacity: 0;
  transition: transform .15s ease, opacity .3s ease .1s;
}
@keyframes progress-run {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(-15%); }
  100% { transform: translateX(-5%); }
}

/* ── Loading overlay ── */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(248,249,250,.6);
  backdrop-filter: blur(1px);
  z-index: 9998;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 14px;
}
#loading-overlay.loading-open { display: flex !important; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Button loading state ── */
.btn.loading {
  opacity: .7;
  pointer-events: none;
  cursor: default;
}
.btn.loading .btn-spinner {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn.loading .btn-icon { display: none; }

/* ── Editor Modal Styles ── */
#editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.editor-container {
  width: 92%;
  max-width: 1200px;
  height: 88%;
  max-height: 900px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.editor-toolbar {
  padding: 12px 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  flex-shrink: 0;
}

.editor-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.editor-toolbar-left .label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.editor-toolbar-left .filename {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-toolbar-left .lang-badge {
  font-size: 11px;
  padding: 2px 10px;
  background: var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.editor-toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.editor-save-btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: background 0.15s, opacity 0.15s;
}
.editor-save-btn:hover:not(:disabled) { background: var(--accent-h); }
.editor-save-btn:disabled { opacity: 0.7; cursor: not-allowed; }

.editor-close-btn {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.editor-close-btn:hover {
  background: var(--bg);
  color: var(--text);
}

.editor-body {
  flex: 1;
  background: #1e1e1e;
  min-height: 0;
}

.error {
	align-items: center;
	display: flex;
	flex-direction: column;
	height: 100%;
	justify-content: center;
	padding: 5rem 0;
}

.error .code {
    font-size: 5rem;
    font-weight: 900;
    padding: 1.5rem 0 0.5rem 0;
}
		
.error .title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    padding: 0 0 1rem 0;
    text-transform: uppercase;
}
	
.error .subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.lock {
  position: relative;
  border-radius: 5px;
  width: 55px;
  height: 45px;
  background-color: #333;
  animation: dip 1s;
  animation-delay: 1.5s; /* 2s - 0.5s */
}

.lock::before,
.lock::after {
  content: '';
  position: absolute;
  border-left: 5px solid #333;
  height: 40px;
  width: 25px;
  left: calc(50% - 12.5px);
}

.lock::before {
  top: -30px;
  border: 5px solid #333;
  border-bottom-color: transparent;
  border-radius: 15px 15px 0 0;
  height: 40px;
  animation: lock 2s, spin 2s;
}

.lock::after {
  top: -10px;
  border-right: 5px solid transparent;
  animation: spin 2s;
}

@keyframes lock {
  0% {
    top: -45px;
  }
  65% {
    top: -45px;
  }
  100% {
    top: -30px;
  }
}

@keyframes spin {
  0% {
    transform: scaleX(-1);
    left: calc(50% - 30px);
  }
  65% {
    transform: scaleX(1);
    left: calc(50% - 12.5px);
  }
}

@keyframes dip {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.auth-links {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
}

.auth-links a {
    text-decoration: none;
    padding: 8px 20px;
    border-radius: 40px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: inline-block;
}

/* login link */
.auth-links .login-link {
    background: #eef2f6;
    color: #1e293b;
    border: 1px solid transparent;
}

.auth-links .login-link:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: scale(1.02);
}

/* logout link */
.auth-links .logout-link {
    background: #1e293b;
    color: white;
    border: 1px solid #1e293b;
}

.auth-links .logout-link:hover {
    background: #0f172a;
    border-color: #0f172a;
    transform: scale(1.02);
    box-shadow: 0 4px 10px rgba(30, 41, 59, 0.2);
}

