﻿/* ===== RESET & BASE ===== */
* { -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, Helvetica, Arial, sans-serif;
  font-size: 15px;
  background: #fff;
  color: #000;
  -webkit-text-size-adjust: 100%;
  -webkit-overflow-scrolling: touch;
}
body.modal-open { overflow: hidden; }
a { color: #000; text-decoration: underline; }
a:active { opacity: 0.6; }
img { display: block; }

/* ===== DARK BASE ===== */
html.dark body { background: #000; color: #fff; }
html.dark a { color: #fff; }

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== TOAST ===== */
#toast-container {
  position: fixed;
  top: 12px; left: 50%;
  width: 90%; max-width: 380px;
  margin-left: -45%;
  z-index: 999;
}
.toast {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  opacity: 0;
  color: #fff;
  background: #000;
  border: 1.5px solid #fff;
  -webkit-transition: opacity 0.2s;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
.toast.toast-success { background: #000; border-color: #fff; }
.toast.toast-error { background: #fff; color: #000; border: 1.5px solid #000; }
html.dark .toast { background: #fff; color: #000; border-color: #000; }
html.dark .toast.toast-success { background: #fff; color: #000; }
html.dark .toast.toast-error { background: #000; color: #fff; border-color: #fff; }

/* ===== LOGIN ===== */
#page-login {
  min-height: 100%;
  background: #000;
  padding: 0 20px 40px;
}
html.dark #page-login { background: #000; }
.login-logo { text-align: center; padding: 64px 0 36px; color: #fff; }
.login-logo h1 { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.login-logo p { font-size: 13px; color: #888; margin-top: 6px; }
.login-card {
  background: #fff;
  border: 2px solid #fff;
  padding: 28px 22px 22px;
  max-width: 380px;
  margin: 0 auto;
}
html.dark .login-card { background: #111; border-color: #333; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #555;
  margin-bottom: 6px;
}
html.dark .form-group label { color: #aaa; }
.form-group input[type="text"],
.form-group input[type="password"] {
  width: 100%;
  padding: 12px 10px;
  border: 1.5px solid #000;
  font-size: 16px;
  background: #fff;
  color: #000;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
}
html.dark .form-group input[type="text"],
html.dark .form-group input[type="password"] {
  background: #000;
  border-color: #555;
  color: #fff;
}
.form-group input:focus { outline: none; border-color: #000; }
html.dark .form-group input:focus { border-color: #fff; }

/* ===== BUTTONS ===== */
.btn {
  display: block; width: 100%;
  padding: 13px 18px;
  border: 2px solid #000;
  font-size: 15px; font-weight: 700;
  cursor: pointer; text-align: center;
  -webkit-appearance: none; appearance: none;
  border-radius: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-transition: background 0.1s, color 0.1s;
  transition: background 0.1s, color 0.1s;
}
.btn:active { opacity: 0.65; }
.btn:disabled { opacity: 0.35; }
.btn-primary { background: #000; color: #fff; border-color: #000; }
html.dark .btn-primary { background: #fff; color: #000; border-color: #fff; }
.btn-sm {
  display: inline-block; width: auto;
  padding: 7px 12px; font-size: 12px;
  font-weight: 600; border-radius: 0;
  border-width: 1.5px;
}
.btn-ghost { background: #fff; color: #000; border-color: #000; }
html.dark .btn-ghost { background: #000; color: #fff; border-color: #fff; }
.btn-danger-ghost { background: #fff; color: #000; border-color: #000; }
html.dark .btn-danger-ghost { background: #000; color: #fff; border-color: #555; }

/* ===== NAVBAR ===== */
.navbar {
  background: #000;
  color: #fff;
  padding: 0 16px;
  border-bottom: 2px solid #000;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 80;
}
html.dark .navbar { background: #000; border-bottom-color: #333; }
.navbar-inner {
  max-width: 640px; margin: 0 auto; height: 50px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
}
.navbar-brand { font-size: 17px; font-weight: 800; letter-spacing: -0.5px; color: #fff; }
.hamburger-btn {
  background: none; border: none; color: #fff;
  font-size: 20px; cursor: pointer; padding: 8px 4px; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}

/* ===== NAV MENU DROPDOWN ===== */
.nav-menu {
  display: none;
  background: #111;
  border-bottom: 2px solid #333;
}
html.dark .nav-menu { background: #0a0a0a; border-bottom-color: #333; }
.nav-menu.open { display: block; }
.nav-menu-inner { max-width: 640px; margin: 0 auto; padding: 6px 0 10px; }
.nav-menu-user {
  padding: 12px 18px 10px;
  font-size: 12px; color: #888;
  border-bottom: 1px solid #333;
  margin-bottom: 4px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.nav-menu-user strong { color: #fff; font-size: 15px; display: block; text-transform: none; letter-spacing: 0; margin-top: 2px; }
.nav-menu-item {
  display: block; width: 100%;
  padding: 12px 18px;
  background: none; border: none;
  color: #ccc; font-size: 15px;
  text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-menu-item:active { background: #222; color: #fff; }
.nav-menu-item.theme-toggle {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
}
.nav-menu-divider { border: none; border-top: 1px solid #333; margin: 4px 0; }
.theme-pill {
  background: #333; color: #ccc;
  padding: 2px 10px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* ===== STATUS BAR ===== */
.status-bar {
  background: #f8f8f8;
  border-bottom: 1.5px solid #e0e0e0;
  padding: 8px 16px;
}
html.dark .status-bar { background: #111; border-bottom-color: #2a2a2a; }
.status-bar-inner {
  max-width: 640px; margin: 0 auto;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
}
.status-track {
  -webkit-box-flex: 1; -webkit-flex: 1; flex: 1;
  background: #e0e0e0; height: 4px; margin-right: 12px;
}
html.dark .status-track { background: #2a2a2a; }
.status-fill { background: #000; height: 4px; max-width: 100%; -webkit-transition: width 0.4s; transition: width 0.4s; }
html.dark .status-fill { background: #fff; }
.status-fill.warn { background: #555; }
.status-fill.danger { background: #000; }
html.dark .status-fill.warn { background: #aaa; }
html.dark .status-fill.danger { background: #fff; }
.status-text { font-size: 11px; color: #666; white-space: nowrap; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
html.dark .status-text { color: #888; }

/* ===== WRAP ===== */
.wrap { max-width: 640px; margin: 0 auto; padding: 14px 12px 48px; }

/* ===== UPLOAD CARD ===== */
.upload-card {
  border: 1.5px solid #000;
  padding: 16px; margin-bottom: 14px;
  background: #fff;
}
html.dark .upload-card { background: #000; border-color: #333; }
.upload-zone {
  border: 2px dashed #bbb;
  padding: 24px 16px; text-align: center;
  background: #fafafa; margin-bottom: 12px;
  -webkit-transition: border-color 0.15s, background 0.15s;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
html.dark .upload-zone { background: #0a0a0a; border-color: #333; }
.upload-zone.dragover { border-color: #000; background: #f0f0f0; border-style: solid; }
.upload-zone.has-file { border-color: #000; border-style: solid; background: #f0f0f0; }
html.dark .upload-zone.dragover,
html.dark .upload-zone.has-file { border-color: #fff; background: #111; }
.upload-icon { font-size: 28px; margin-bottom: 6px; }
.upload-hint { font-size: 14px; color: #555; }
html.dark .upload-hint { color: #888; }
.upload-hint strong { color: #000; }
html.dark .upload-hint strong { color: #fff; }
.choose-btn-wrap { display: inline-block; position: relative; margin-top: 10px; }
.choose-btn {
  display: inline-block; padding: 9px 20px;
  background: #000; color: #fff;
  font-size: 14px; font-weight: 700; pointer-events: none;
  border: 2px solid #000;
}
html.dark .choose-btn { background: #fff; color: #000; border-color: #fff; }
#file-input {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px;
}
.chosen-file-row {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  margin-top: 10px; background: #fff;
  border: 1.5px solid #000; padding: 8px 10px;
}
html.dark .chosen-file-row { background: #111; border-color: #444; }
.chosen-file-info { -webkit-box-flex: 1; -webkit-flex: 1; flex: 1; min-width: 0; }
.chosen-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chosen-file-size { font-size: 12px; color: #666; }
html.dark .chosen-file-size { color: #999; }
.chosen-file-clear {
  background: none; border: none; color: #666;
  font-size: 20px; cursor: pointer; padding: 4px;
  line-height: 1; -webkit-tap-highlight-color: transparent;
}
.progress-track { background: #e0e0e0; height: 4px; margin-bottom: 12px; display: none; }
html.dark .progress-track { background: #222; }
.progress-fill { background: #000; height: 4px; width: 0%; -webkit-transition: width 0.1s; transition: width 0.1s; }
html.dark .progress-fill { background: #fff; }
.progress-pct { text-align: center; font-size: 12px; color: #666; margin-top: 4px; }
html.dark .progress-pct { color: #999; }

/* ===== SECTION HEADER ===== */
.section-header {
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: justify; -webkit-justify-content: space-between; justify-content: space-between;
  margin-bottom: 10px;
}
.section-title { font-size: 11px; font-weight: 700; color: #888; text-transform: uppercase; letter-spacing: 1px; }
html.dark .section-title { color: #555; }
.refresh-btn {
  background: none; border: 1px solid #ccc; color: #555;
  font-size: 12px; cursor: pointer; padding: 4px 10px;
  -webkit-tap-highlight-color: transparent;
}
html.dark .refresh-btn { border-color: #333; color: #777; }
.refresh-btn:active { background: #f0f0f0; }
html.dark .refresh-btn:active { background: #111; }

/* ===== FILE GRID ===== */
.file-grid { margin: 0 -4px; overflow: hidden; }
.file-grid:after { content: ''; display: table; clear: both; }
.file-card-wrap { float: left; width: 50%; padding: 0 4px 8px; }
@media (min-width: 480px) { .file-card-wrap { width: 33.333%; } }

.file-card {
  background: #fff;
  border: 1.5px solid #000;
  cursor: pointer;
  -webkit-transition: background 0.1s; transition: background 0.1s;
}
html.dark .file-card { background: #000; border-color: #333; }
.file-card:active { background: #f0f0f0; }
html.dark .file-card:active { background: #111; }

.card-preview {
  height: 110px; overflow: hidden;
  background: #f0f0f0;
  border-bottom: 1.5px solid #000;
  position: relative;
}
html.dark .card-preview { background: #111; border-bottom-color: #333; }
.card-preview img { width: 100%; height: 110px; object-fit: cover; min-height: 110px; }
.card-preview-icon {
  height: 110px;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
}

/* file type badges — monochrome */
.file-type-badge {
  border: 1.5px solid #000;
  padding: 4px 7px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px;
  display: inline-block;
  background: #fff; color: #000;
}
html.dark .file-type-badge { border-color: #888; background: #000; color: #fff; }
.badge-img, .badge-vid, .badge-aud, .badge-pdf, .badge-zip, .badge-doc, .badge-file {}
html.dark .badge-img, html.dark .badge-vid, html.dark .badge-aud,
html.dark .badge-pdf, html.dark .badge-zip, html.dark .badge-doc,
html.dark .badge-file {}

.card-footer { padding: 8px 9px; }
.card-filename {
  font-size: 12px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #000;
}
html.dark .card-filename { color: #fff; }
.card-size { font-size: 11px; color: #888; margin-top: 2px; }
html.dark .card-size { color: #555; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 48px 20px; color: #aaa; }
html.dark .empty-state { color: #444; }
.empty-icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ===== MODAL ===== */
.modal-backdrop {
  display: none;
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}
html.dark .modal-backdrop { background: rgba(0,0,0,0.85); }
.modal-backdrop.show { display: block; }
.modal {
  background: #fff;
  border: 2px solid #000;
  padding: 20px 18px 18px;
  max-width: 420px;
  margin: 52px 10px 40px;
  position: relative;
}
html.dark .modal { background: #000; border-color: #444; }
.modal h3 { font-size: 16px; font-weight: 800; margin-bottom: 14px; letter-spacing: -0.3px; }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  background: #000; border: none;
  width: 28px; height: 28px;
  font-size: 16px; cursor: pointer; color: #fff;
  line-height: 28px; text-align: center; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html.dark .modal-close { background: #fff; color: #000; }
.modal-close:active { opacity: 0.7; }

/* ===== DETAIL MODAL ===== */
.detail-preview {
  overflow: hidden;
  background: #f0f0f0;
  border: 1.5px solid #000;
  margin-bottom: 14px;
  text-align: center;
}
html.dark .detail-preview { background: #111; border-color: #333; }
.detail-preview img { width: 100%; height: auto; max-height: 260px; object-fit: contain; }
.detail-preview-icon {
  padding: 28px 0;
  display: -webkit-box; display: -webkit-flex; display: flex;
  -webkit-box-align: center; -webkit-align-items: center; align-items: center;
  -webkit-box-pack: center; -webkit-justify-content: center; justify-content: center;
}
.detail-preview-icon .file-type-badge { font-size: 14px; padding: 8px 16px; }
.detail-filename { font-size: 15px; font-weight: 700; word-break: break-all; margin-bottom: 5px; }
.detail-meta { font-size: 12px; color: #666; margin-bottom: 16px; }
html.dark .detail-meta { color: #888; }
.detail-actions { overflow: hidden; }
.detail-actions .btn-sm { float: left; width: 31%; margin-right: 3.5%; text-align: center; padding: 9px 4px; }
.detail-actions .btn-sm:last-child { margin-right: 0; }
.detail-actions:after { content: ''; display: table; clear: both; }

/* ===== SHARE MODAL ===== */
.url-box {
  background: #f0f0f0;
  border: 1.5px solid #000;
  padding: 10px 12px; margin-bottom: 14px;
  word-break: break-all; font-size: 12px;
  color: #000; font-family: monospace;
}
html.dark .url-box { background: #111; border-color: #444; color: #ccc; }
