/* =========================================================
   KsK Secure File Transfer — style.css
   Theme driven by CSS variables from config.json
   ========================================================= */

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

:root {
  --gradient-start:  #000000;
  --gradient-end:    #3600ad;
  --text-color:      #ffffff;
  --container-bg:    rgba(31, 0, 77, 0.75);
  --content-bg:      rgba(0, 0, 0, 0.66);
  --border-color:    rgba(227, 227, 227, 0.80);
  --accent:          #7c3aed;
  --btn-bg:          #5b21b6;
  --btn-hover:       #7c3aed;
  --danger:          #dc2626;
  --success:         #16a34a;
  --warning:         #d97706;
  --input-bg:        rgba(0,0,0,0.45);
  --shadow:          0 8px 32px rgba(0,0,0,0.55);
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
  background-attachment: fixed;
  color: var(--text-color);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Layout ─────────────────────────────────────────────── */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: var(--container-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar-brand img.logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.top-bar-brand .brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color);
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}

.top-bar-user .username-label {
  opacity: 0.8;
}

.main-container {
  flex: 1;
  padding: 2rem 1.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* ─── Cards / Panels ─────────────────────────────────────── */
.card {
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title .icon { font-size: 1.2rem; }

/* ─── Center auth card ───────────────────────────────────── */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-card {
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.auth-card .brand-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-card .brand-header .app-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.auth-card .brand-header .app-slogan {
  font-size: 0.82rem;
  opacity: 0.65;
}

.auth-card .brand-header img.logo {
  height: 60px;
  margin-bottom: 0.75rem;
}

/* ─── Forms ──────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  opacity: 0.9;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.9rem;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.25);
}

.form-control::placeholder { opacity: 0.45; }

select.form-control option { background: #1a0040; color: #fff; }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--btn-bg);
  color: #fff;
}
.btn-primary:hover { background: var(--btn-hover); }

.btn-secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: rgba(255,255,255,0.20); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #ef4444; }

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover { background: #22c55e; }

.btn-warning {
  background: var(--warning);
  color: #fff;
}
.btn-warning:hover { background: #f59e0b; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.8rem 1.75rem;
  font-size: 1rem;
  width: 100%;
}

.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── Alerts / Notices ───────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.alert-error   { background: rgba(220,38,38,0.2);  border-color: rgba(220,38,38,0.5);  color: #fca5a5; }
.alert-success { background: rgba(22,163,74,0.2);  border-color: rgba(22,163,74,0.5);  color: #86efac; }
.alert-warning { background: rgba(217,119,6,0.2);  border-color: rgba(217,119,6,0.5);  color: #fcd34d; }
.alert-info    { background: rgba(99,102,241,0.2); border-color: rgba(99,102,241,0.5); color: #c7d2fe; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  background: rgba(0,0,0,0.40);
  padding: 0.65rem 0.9rem;
  text-align: left;
  font-weight: 700;
  opacity: 0.85;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-color);
}

tbody tr {
  border-bottom: 1px solid rgba(255,255,255,0.07);
  transition: background 0.15s;
}

tbody tr:hover { background: rgba(255,255,255,0.05); }

tbody td {
  padding: 0.65rem 0.9rem;
  vertical-align: middle;
}

.td-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* ─── Badge/Tags ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active   { background: rgba(22,163,74,0.3);  color: #86efac; border: 1px solid rgba(22,163,74,0.5); }
.badge-pending  { background: rgba(217,119,6,0.3);  color: #fcd34d; border: 1px solid rgba(217,119,6,0.5); }
.badge-disabled { background: rgba(107,114,128,0.3);color: #d1d5db; border: 1px solid rgba(107,114,128,0.5); }
.badge-locked   { background: rgba(220,38,38,0.3);  color: #fca5a5; border: 1px solid rgba(220,38,38,0.5); }
.badge-admin    { background: rgba(124,58,237,0.3); color: #ddd6fe; border: 1px solid rgba(124,58,237,0.5); }
.badge-user     { background: rgba(59,130,246,0.3); color: #bfdbfe; border: 1px solid rgba(59,130,246,0.5); }

/* ─── Dropzone ───────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-color);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--content-bg);
}

.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(124,58,237,0.12);
}

.dropzone .dz-icon {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.dropzone .dz-text {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.dropzone .dz-subtext {
  font-size: 0.82rem;
  opacity: 0.6;
}

#fileInput { display: none; }

/* ─── Upload progress ────────────────────────────────────── */
.upload-queue { margin-top: 1rem; }

.upload-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  background: var(--content-bg);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.upload-item .ui-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-item .ui-size { opacity: 0.6; white-space: nowrap; }
.upload-item .ui-status { white-space: nowrap; font-weight: 600; }
.ui-status.ok   { color: #86efac; }
.ui-status.err  { color: #fca5a5; }
.ui-status.wait { color: #fcd34d; }

.progress-bar-wrap {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 0.3rem;
}
.progress-bar { height: 100%; background: var(--accent); transition: width 0.3s; }

/* ─── File list ──────────────────────────────────────────── */
.file-list { list-style: none; }

.file-list li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.35rem;
  background: var(--content-bg);
  border: 1px solid rgba(255,255,255,0.06);
  transition: background 0.15s;
}

.file-list li:hover { background: rgba(255,255,255,0.07); }
.file-list li .fl-icon { font-size: 1.2rem; flex-shrink: 0; }
.file-list li .fl-info { flex: 1; min-width: 0; }
.file-list li .fl-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-list li .fl-meta { font-size: 0.77rem; opacity: 0.6; margin-top: 0.15rem; }
.file-list li .fl-actions { display: flex; gap: 0.4rem; flex-shrink: 0; }

/* ─── Tab navigation ─────────────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 0.6rem 1.2rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover { color: #fff; }
.tab-btn.active { color: #fff; border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal-box {
  background: #0e0028;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  opacity: 0.7;
  line-height: 1;
}
.modal-close:hover { opacity: 1; }

/* ─── Setup / QR enrollment ──────────────────────────────── */
.setup-steps { counter-reset: step; }

.setup-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--btn-bg);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.setup-step .step-body { flex: 1; }
.setup-step .step-body p { font-size: 0.88rem; opacity: 0.85; line-height: 1.5; margin-bottom: 0.3rem; }

.qr-container {
  background: #fff;
  border-radius: 10px;
  display: inline-block;
  padding: 10px;
  margin: 0.75rem 0;
}

.manual-key {
  background: var(--content-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  word-break: break-all;
  margin: 0.5rem 0;
}

/* ─── Copy link ──────────────────────────────────────────── */
.copy-link-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  background: var(--content-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0.75rem 0;
}

.copy-link-box input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-color);
  font-size: 0.82rem;
  outline: none;
  word-break: break-all;
}

/* ─── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Empty states ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  opacity: 0.55;
}

.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* ─── Grid layout for dashboard ─────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .two-col { grid-template-columns: 1fr; }
  .top-bar { flex-wrap: wrap; }
  .auth-card { padding: 1.75rem 1.25rem; }
}

/* ─── Admin stats strip ──────────────────────────────────── */
.stats-strip {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-box {
  flex: 1;
  min-width: 130px;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  text-align: center;
}

.stat-box .stat-val { font-size: 2rem; font-weight: 800; }
.stat-box .stat-label { font-size: 0.78rem; opacity: 0.6; margin-top: 0.2rem; }

/* ─── Misc ───────────────────────────────────────────────── */
.text-muted   { opacity: 0.55; font-size: 0.85rem; }
.text-small   { font-size: 0.82rem; }
.text-center  { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.gap-1 { gap: 0.5rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.font-mono { font-family: 'Courier New', monospace; }

.divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 1.25rem 0;
}

.footer-bar {
  text-align: center;
  padding: 1rem;
  font-size: 0.78rem;
  opacity: 0.45;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.size-badge {
  font-size: 0.75rem;
  background: rgba(255,255,255,0.1);
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
