/* ============================================================
   EasyShare v1.0 样式表
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #4a90d9; --primary-hover: #3a7bc8;
  --danger: #e74c3c; --danger-hover: #c0392b;
  --success: #2ecc71; --info: #3498db; --warning: #f39c12;
  --bg: #f5f7fa; --surface: #fff; --surface-hover: #f8f9fa;
  --border: #e8ecf1; --text: #2c3e50; --text-secondary: #7f8c8d;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --radius: 8px; --radius-lg: 12px;
  --transition: all .2s ease;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; min-height: 100vh; }
#app { max-width: 1200px; margin: 0 auto; padding: 0 20px; min-height: 100vh; display: flex; flex-direction: column; }

/* --- Navbar --- */
.navbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.navbar-brand { display: flex; align-items: center; gap: 10px; }
.navbar-brand .logo { font-size: 28px; }
.navbar-brand h1 { font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.navbar-actions { display: flex; align-items: center; gap: 10px; }

/* --- Search --- */
.search-box { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: var(--transition); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,.15); }
.search-box input { border: none; outline: none; padding: 8px 12px; font-size: .9rem; width: 180px; background: transparent; font-family: var(--font); }
.search-scope-label { font-size: .72rem; color: var(--text-secondary); background: var(--bg); padding: 2px 8px; border-radius: 10px; }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font-size: .9rem; font-family: var(--font); cursor: pointer; transition: var(--transition); white-space: nowrap; text-decoration: none; user-select: none; }
.btn:hover { background: var(--surface-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }
.btn-info { background: var(--info); color: #fff; border-color: var(--info); }
.btn-info:hover { background: #2980b9; }
.btn-outline { background: transparent; border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: none; background: transparent; cursor: pointer; font-size: 1rem; border-radius: var(--radius); transition: var(--transition); }
.btn-icon:hover { background: var(--surface-hover); }
.btn-sm { padding: 4px 10px; font-size: .8rem; }
.btn-block { width: 100%; }
.upload-btn { cursor: pointer; }

/* --- User Menu --- */
.user-menu { position: relative; }
.user-menu-trigger { font-weight: 600; }
.user-dot { color: var(--success); }
.caret { font-size: .7rem; opacity: .6; }
.user-dropdown { position: absolute; top: calc(100% + 6px); right: 0; width: 220px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 8px 30px rgba(0,0,0,.15); z-index: 100; display: none; overflow: hidden; animation: dropIn .15s ease; }
.user-dropdown.show { display: block; }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-header { padding: 14px 16px; background: var(--bg); display: flex; align-items: center; gap: 10px; font-weight: 600; }
.role-badge { font-size: .7rem; padding: 2px 8px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 600; }
.dropdown-divider { height: 1px; background: var(--border); }
.dropdown-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 10px 16px; border: none; background: transparent; cursor: pointer; font-size: .9rem; font-family: var(--font); color: var(--text); transition: var(--transition); text-align: left; }
.dropdown-item:hover { background: var(--surface-hover); }
.dropdown-danger { color: var(--danger); }
.dropdown-danger:hover { background: #fdf0ed; }

/* --- Announcement --- */
.announcement { margin: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.announcement-item, .anno { padding: 12px 16px; border-radius: var(--radius); font-size: .9rem; display: flex; align-items: flex-start; gap: 10px; }
.announcement-item.danger, .anno.danger { background: #fdf0ed; border-left: 4px solid var(--danger); color: #c0392b; }
.announcement-item.info, .anno.info { background: #edf4fc; border-left: 4px solid var(--info); color: #2471a3; }
.announcement-item.success, .anno.success { background: #edf8f0; border-left: 4px solid var(--success); color: #1e8449; }

/* --- Breadcrumb --- */
.breadcrumb { display: flex; align-items: center; gap: 4px; padding: 10px 0; font-size: .9rem; color: var(--text-secondary); flex-wrap: wrap; }
.breadcrumb-item, .bc-item { cursor: pointer; color: var(--primary); transition: var(--transition); }
.breadcrumb-item:hover, .bc-item:hover { text-decoration: underline; }
.breadcrumb-sep, .bc-sep { margin: 0 2px; }
.breadcrumb-current, .bc-cur { color: var(--text); font-weight: 600; }

/* --- Toolbar --- */
.toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; gap: 10px; flex-wrap: wrap; }
.toolbar-left { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- File Table --- */
.file-table-container { flex: 1; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px; }
.file-table { width: 100%; border-collapse: collapse; }
.file-table thead { background: #f0f4f8; position: sticky; top: 0; z-index: 1; }
.file-table th { padding: 12px 16px; text-align: left; font-weight: 600; font-size: .85rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .5px; border-bottom: 2px solid var(--border); user-select: none; }
.file-table th.sortable { cursor: pointer; }
.file-table th.sortable:hover { color: var(--primary); }
.file-table th .sort-icon { font-size: .65rem; margin-left: 2px; opacity: .3; }
.file-table th.asc .sort-icon::after { content: '▲'; opacity: 1; }
.file-table th.desc .sort-icon::after { content: '▼'; opacity: 1; }
.file-table td { padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
.file-table tbody tr { transition: var(--transition); }
.file-table tbody tr:hover { background: var(--surface-hover); }
.file-table tbody tr:last-child td { border-bottom: none; }
.col-name { width: 42%; } .col-size { width: 12%; } .col-time { width: 26%; } .col-actions { width: 20%; text-align: right; }

.file-item { display: flex; align-items: center; gap: 10px; }
.file-icon { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.file-name { color: var(--primary); cursor: pointer; text-decoration: none; transition: var(--transition); word-break: break-all; }
.file-name:hover { text-decoration: underline; }
.file-size, .file-time, .fmeta { color: var(--text-secondary); font-size: .85rem; }
.action-buttons { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }

/* --- Empty / Loading --- */
.empty-state, .loading-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; margin: 0 auto 12px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Modal --- */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.4); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(0,0,0,.15); max-height: 85vh; overflow-y: auto; animation: slideUp .25s ease; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-sm { width: 400px; max-width: 92vw; }
.modal-md { width: 600px; max-width: 92vw; }
.modal-lg { width: 860px; max-width: 95vw; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-header > div { display: flex; gap: 8px; align-items: center; }
.modal-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; font-size: 1.2rem; cursor: pointer; border-radius: var(--radius); transition: var(--transition); color: var(--text-secondary); }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; }

/* --- Form --- */
.form-group, .fg { margin-bottom: 16px; }
.form-group label, .fg label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .85rem; color: var(--text-secondary); }
.form-group input, .form-group textarea, .form-group select,
.fg input, .fg textarea, .fg select { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: .9rem; font-family: var(--font); transition: var(--transition); outline: none; background: var(--surface); }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus,
.fg input:focus, .fg textarea:focus, .fg select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(74,144,217,.15); }
.form-group textarea, .fg textarea { resize: vertical; min-height: 100px; }
.auth-switch { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--text-secondary); }
.auth-switch a { color: var(--primary); text-decoration: none; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* --- Upload Progress --- */
.upload-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.upload-item:last-child { border-bottom: none; }
.upload-item-name { flex: 1; font-size: .9rem; word-break: break-all; }
.upload-progress-bar { width: 120px; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.upload-progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s ease; }
.upload-status { font-size: .8rem; color: var(--text-secondary); min-width: 40px; text-align: right; }
.upload-status.success { color: var(--success); }
.upload-status.error { color: var(--danger); }

/* --- Preview --- */
.preview-body { min-height: 300px; display: flex; align-items: center; justify-content: center; }
.preview-body img { max-width: 100%; max-height: 70vh; border-radius: var(--radius); }
.preview-body video { max-width: 100%; max-height: 70vh; border-radius: var(--radius); }
.preview-body audio { width: 100%; }
.preview-body pre { width: 100%; max-height: 70vh; overflow: auto; background: #1e1e2e; color: #cdd6f4; padding: 20px; border-radius: var(--radius); font-size: .85rem; line-height: 1.7; font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace; white-space: pre-wrap; word-break: break-all; }
.preview-body .pdf-frame { width: 100%; height: 70vh; border: none; border-radius: var(--radius); }
.preview-body iframe { width: 100%; height: 70vh; border: none; border-radius: var(--radius); }
.preview-loading { color: var(--text-secondary); font-size: 1rem; }

/* --- Search Results --- */
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.search-result-item:hover { background: var(--surface-hover); }
.search-result-icon { font-size: 20px; flex-shrink: 0; }
.search-result-info { flex: 1; }
.search-result-name { font-weight: 600; color: var(--primary); }
.search-result-path { font-size: .8rem; color: var(--text-secondary); }
.search-result-meta { font-size: .8rem; color: var(--text-secondary); text-align: right; }

/* --- Admin --- */
.admin-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border); padding-bottom: 0; }
.admin-tab { padding: 10px 20px; border: none; background: transparent; cursor: pointer; font-size: .9rem; font-family: var(--font); color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.admin-tab:hover { color: var(--primary); }
.admin-tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--bg); border-radius: var(--radius); padding: 16px; text-align: center; }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: .8rem; color: var(--text-secondary); margin-top: 4px; }

.admin-user-table { width: 100%; border-collapse: collapse; }
.admin-user-table th, .admin-user-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.admin-user-table th { font-weight: 600; color: var(--text-secondary); font-size: .8rem; text-transform: uppercase; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-grid .form-group.full-width { grid-column: 1 / -1; }
.toggle-switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-switch input[type="checkbox"] { width: 40px; height: 22px; appearance: none; background: var(--border); border-radius: 11px; position: relative; cursor: pointer; transition: var(--transition); }
.toggle-switch input[type="checkbox"]::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: var(--transition); }
.toggle-switch input[type="checkbox"]:checked { background: var(--success); }
.toggle-switch input[type="checkbox"]:checked::after { left: 20px; }

/* --- Footer --- */
.footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 0; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-secondary); margin-top: auto; }

/* --- Toast --- */
.toast-container, .tc { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius); color: #fff; font-size: .9rem; box-shadow: 0 4px 16px rgba(0,0,0,.15); animation: toastIn .3s ease; max-width: 360px; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

/* --- Select bar --- */
.sel-bar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #edf4fc; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid #c8ddf0; }

.file-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }

/* --- Search result item --- */
.sr-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius); cursor: pointer; transition: var(--transition); }
.sr-item:hover { background: var(--surface-hover); }
.sr-icon { font-size: 20px; flex-shrink: 0; }
.scope-lbl { font-size: .72rem; color: var(--text-secondary); background: var(--bg); padding: 2px 8px; border-radius: 10px; }

/* --- Admin --- */
.atabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.atab { padding: 10px 20px; border: none; background: transparent; cursor: pointer; font-size: .9rem; font-family: var(--font); color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.atab:hover { color: var(--primary); }
.atab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--primary); }
.astats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 20px; }
.acard { background: var(--bg); border-radius: var(--radius); padding: 16px; text-align: center; }
.aval { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.alab { font-size: .8rem; color: var(--text-secondary); margin-top: 4px; }
.autbl { width: 100%; border-collapse: collapse; }
.autbl th, .autbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: .9rem; }
.autbl th { font-weight: 600; color: var(--text-secondary); font-size: .8rem; text-transform: uppercase; }
.sgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sgrid .full { grid-column: 1 / -1; }
.tswitch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.tswitch input[type="checkbox"] { width: 40px; height: 22px; appearance: none; background: var(--border); border-radius: 11px; position: relative; cursor: pointer; transition: var(--transition); }
.tswitch input[type="checkbox"]::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: var(--transition); }
.tswitch input[type="checkbox"]:checked { background: var(--success); }
.tswitch input[type="checkbox"]:checked::after { left: 20px; }
.rbadge { font-size: .7rem; padding: 2px 8px; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 600; display: inline-block; }

/* --- Announcement Edit Items --- */
.ann-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .navbar { flex-direction: column; align-items: stretch; }
  .search-box input { width: 120px; }
  .toolbar { flex-direction: column; }
  .col-t { display: none; }
  .col-n { width: 55%; } .col-s { width: 15%; } .col-a { width: 30%; }
  .file-table th, .file-table td { padding: 8px 10px; }
  .sgrid { grid-template-columns: 1fr; }
  .astats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  #app { padding: 0 10px; }
  .col-size { display: none; }
  .col-name { width: 60%; } .col-actions { width: 40%; }
  .btn { padding: 6px 12px; font-size: .8rem; }
}
