/* 温图 - 全局样式（响应式） */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f5f7fa; color: #222; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: #ff5e62; text-decoration: none; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 18px; }

/* 顶栏 */
.topbar { background: #fff; border-bottom: 1px solid #eee; position: sticky; top: 0; z-index: 50; }
.topbar.light { background: transparent; border-bottom: 0; position: absolute; width: 100%; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-size: 22px; font-weight: 800; color: #222; letter-spacing: 1px; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.logo-ic { width: 32px; height: 32px; border-radius: 8px; }
.logo span { color: #ff5e62; }
.logo.dark { color: #fff; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a { color: #444; font-size: 15px; }
.nav.dark a { color: #fff; }
.nav-user { color: #666; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }

/* 按钮 */
.btn {
  display: inline-block; padding: 10px 22px; background: linear-gradient(135deg,#ff5e62,#ff9966);
  color: #fff; border: 0; border-radius: 8px; cursor: pointer; font-size: 15px;
  transition: .2s; text-align: center;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-lg { padding: 14px 40px; font-size: 17px; }
.btn-block { display: block; width: 100%; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin: 14px 0; font-size: 14px; }
.flash.ok { background: #e6ffed; color: #2e7d32; }
.flash.err { background: #ffe5e5; color: #c0392b; }

/* 登录/注册 */
.auth-wrap { padding: 50px 0; }
.auth-card {
  max-width: 420px; margin: 0 auto; background: #fff; padding: 34px;
  border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.auth-card h2 { font-size: 24px; }
.auth-card .sub { color: #888; margin: 4px 0 18px; font-size: 14px; }
.auth-card label { display: block; margin: 12px 0 6px; font-size: 14px; color: #555; }
.auth-card input {
  width: 100%; padding: 11px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 15px;
}
.auth-card .btn { margin-top: 20px; }
.auth-card .alt { text-align: center; margin-top: 16px; font-size: 14px; color: #888; }

/* Dashboard */
.dash { padding: 24px 18px 60px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.dash-head h2 { font-size: 22px; }
.dash-head .sub { color: #888; font-size: 14px; }
.dash-head-right { display: flex; align-items: center; gap: 10px; flex: 1; max-width: 500px; }
.quota-bar { flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.quota-fill { height: 100%; background: linear-gradient(90deg,#ff5e62,#ff9966); transition: width .3s; }

.crumb { margin: 18px 0; font-size: 14px; color: #888; }
.crumb a { color: #ff5e62; }

.panel { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.panel-item {
  background: #fff; border-radius: 12px; padding: 14px 18px; box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.panel-item summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.upload-form { margin-top: 12px; }
.drop {
  border: 2px dashed #cfd8dc; border-radius: 10px; padding: 24px; text-align: center;
  color: #888; cursor: pointer; transition: .2s; margin-bottom: 12px;
}
.drop:hover, .drop.over { border-color: #ff5e62; background: #fff5f5; color: #ff5e62; }
.drop input { display: none; }
.upload-form .hint { font-size: 12px; color: #aaa; margin-top: 8px; }
.inline-form { display: flex; gap: 8px; margin-top: 10px; }
.inline-form input { flex: 1; padding: 9px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; }

.sec-title { font-size: 17px; margin: 24px 0 12px; color: #333; }

/* 目录网格 */
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.dir-card {
  background: #fff; border-radius: 12px; padding: 18px; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.04); position: relative; transition: .2s;
}
.dir-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.dir-ic { font-size: 36px; }
.dir-name { font-weight: 600; margin-top: 6px; color: #333; word-break: break-all; }
.dir-meta { font-size: 12px; color: #999; margin-top: 2px; }
.dir-link { display: block; color: inherit; }
.del-btn {
  position: absolute; top: 8px; right: 8px; background: none; border: 0; cursor: pointer;
  font-size: 14px; opacity: .6;
}
.del-btn:hover { opacity: 1; }

/* 图片网格 */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.img-card {
  background: #fff; border-radius: 12px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.05); transition: .2s; display: flex; flex-direction: column;
}
.img-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.1); }
.img-thumb { display: block; height: 160px; background: #f0f2f5; overflow: hidden; }
.img-thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-info { padding: 10px 12px; }
.img-name { font-size: 13px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.img-meta { font-size: 11px; color: #999; margin-top: 2px; }
.link-box {
  width: 100%; margin-top: 8px; padding: 5px 8px; font-size: 11px; border: 1px solid #eee;
  border-radius: 6px; background: #fafafa; color: #666;
}
.img-ops { display: flex; justify-content: space-between; margin-top: 8px; }
.op-link, .del-link { font-size: 12px; background: none; border: 0; cursor: pointer; padding: 0; }
.op-link { color: #ff5e62; }
.del-link { color: #c0392b; }

.empty {
  text-align: center; padding: 60px 20px; color: #aaa; background: #fff;
  border-radius: 12px; border: 2px dashed #e0e0e0;
}

.footer { text-align: center; padding: 24px; color: #aaa; font-size: 13px; }

/* ============ 手机适配 ============ */
@media (max-width: 768px) {
  .wrap { padding: 0 12px; }
  .topbar-in { height: 52px; }
  .logo { font-size: 19px; }
  .nav { gap: 12px; font-size: 14px; }
  .nav span { display: none; }

  .auth-wrap { padding: 24px 0; }
  .auth-card { padding: 24px 20px; }

  .dash { padding: 16px 12px 40px; }
  .dash-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .quota-bar { max-width: 100%; width: 100%; }

  .panel { grid-template-columns: 1fr; }

  .dir-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
  .dir-card { padding: 14px 8px; }
  .dir-ic { font-size: 28px; }

  .img-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .img-thumb { height: 120px; }
  .img-info { padding: 8px; }
  .img-name { font-size: 12px; }
  .link-box { font-size: 10px; padding: 4px 6px; }
}

@media (max-width: 380px) {
  .img-grid { grid-template-columns: 1fr; }
}

/* 管理表格 */
.admin-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.admin-table th, .admin-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eee; }
.admin-table th { color: #888; font-weight: 600; background: #fafafa; }
.admin-table code { background: #f4f4f4; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* ============ 资源管理器风格 ============ */
.explorer { display: flex; min-height: calc(100vh - 60px); }

/* 左侧栏 */
.explorer-side {
    width: 180px; background: #fff; border-right: 1px solid #e5e7eb;
    display: flex; flex-direction: column; flex-shrink: 0;
}
.side-quota { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; }
.quota-text { font-size: 12px; color: #888; margin-bottom: 6px; }
.side-quota .quota-bar { height: 5px; }
.side-tree { flex: 1; overflow-y: auto; padding: 6px 0; }
.side-title { font-size: 11px; color: #aaa; padding: 8px 16px 4px; text-transform: uppercase; letter-spacing: .5px; }
.tree-node {
    display: flex; align-items: center; font-size: 14px;
    padding: 6px 16px; color: #444; text-decoration: none; transition: .15s;
}
.tree-node a {
    display: flex; align-items: center; flex: 1; color: inherit; text-decoration: none;
    overflow: hidden; white-space: nowrap;
}
.tree-node:hover { background: #f5f7fa; }
.tree-node.active { background: #fff0f0; color: #ff5e62; font-weight: 600; }
.f-icon { margin-right: 8px; flex-shrink: 0; }
.tree-count {
    background: #f0f0f0; color: #999; font-size: 11px;
    padding: 1px 7px; border-radius: 8px; margin-left: 8px; flex-shrink: 0;
}
.tree-node.active .tree-count { background: #ffd6d6; color: #ff5e62; }
.side-actions { padding: 8px 0; border-top: 1px solid #f0f0f0; }
.side-link { display: flex; align-items: center; padding: 8px 16px; color: #666; text-decoration: none; font-size: 13px; }
.side-link:hover { background: #f5f7fa; color: #333; }
.side-ic { width: 16px; height: 16px; margin-right: 10px; flex-shrink: 0; }

/* 右侧主区 */
.explorer-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* 工具栏 */
.explorer-toolbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; background: #fff; border-bottom: 1px solid #e5e7eb; flex-wrap: wrap; gap: 10px;
}
.toolbar-left { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.crumb-bar { display: flex; align-items: center; gap: 6px; font-size: 14px; overflow-x: auto; }
.crumb-bar a { color: #666; text-decoration: none; white-space: nowrap; }
.crumb-bar a:hover { color: #ff5e62; }
.crumb-sep { color: #ccc; }
.toolbar-right { display: flex; gap: 8px; }
.btn-tool {
    padding: 8px 14px; border: 1px solid #e0e0e0; background: #fff; border-radius: 8px;
    cursor: pointer; font-size: 13px; color: #444; transition: .15s; text-decoration: none; display: inline-block;
}
.btn-tool:hover { background: #f5f7fa; }
.btn-tool.primary { background: linear-gradient(135deg,#ff5e62,#ff9966); color: #fff; border: 0; }
.btn-tool.ghost { background: #f5f5f5; color: #666; }

/* 上传/新建文件夹面板 */
.upload-panel, .newdir-panel {
    padding: 14px 20px; background: #fffbeb; border-bottom: 1px solid #fde68a;
}
.drop {
    border: 2px dashed #fbbf24; border-radius: 10px; padding: 20px; text-align: center;
    color: #92400e; cursor: pointer; background: #fff;
}
.drop input { display: none; }
.upload-ops { margin-top: 10px; display: flex; gap: 8px; }
.inline-form { display: flex; gap: 8px; }
.inline-form input { flex: 1; padding: 9px 12px; border: 1px solid #e0e0e0; border-radius: 8px; font-size: 14px; }

/* 文件视图 */
.file-view {
    flex: 1; padding: 20px; display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px; align-content: start; overflow-y: auto;
}
.file-item {
    background: #fff; border-radius: 12px; overflow: hidden;
    transition: .2s; cursor: pointer; position: relative;
    display: flex; flex-direction: column; text-decoration: none; color: inherit;
}
.file-item:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.file-thumb {
    height: 110px; background: #f5f7fa; display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.folder-item .file-thumb { background: #fef9c3; }
.image-item .file-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* CSS 画的文件夹图标 */
.css-folder {
    width: 56px; height: 44px; background: #fbbf24; border-radius: 4px; position: relative;
}
.css-folder::before {
    content: ''; position: absolute; top: -6px; left: 0; width: 20px; height: 8px;
    background: #fbbf24; border-radius: 4px 4px 0 0;
}
.css-folder::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 18px;
    background: #f59e0b; border-radius: 0 0 4px 4px;
}

/* 侧边栏小图标 */
.f-icon {
    display: inline-block; width: 8px; height: 8px; border-radius: 2px;
    margin-right: 8px; flex-shrink: 0;
}
.f-all { background: #ff5e62; }
.f-jpg { background: #f97316; }
.f-png { background: #3b82f6; }
.f-gif { background: #22c55e; }
.f-webp { background: #a855f7; }
.f-bmp { background: #6b7280; }
.f-svg { background: #ec4899; }

/* 空状态大文件夹 */
.empty-ic { margin-bottom: 20px; }
.empty-folder {
    width: 100px; height: 80px; background: #e5e7eb; border-radius: 8px; position: relative; margin: 0 auto;
}
.empty-folder::before {
    content: ''; position: absolute; top: -10px; left: 0; width: 36px; height: 12px;
    background: #e5e7eb; border-radius: 8px 8px 0 0;
}
.empty-folder::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 36px;
    background: #d1d5db; border-radius: 0 0 8px 8px;
}
.file-name {
    padding: 8px 10px 2px; font-size: 13px; color: #333;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.file-url {
    padding: 0 10px; font-size: 11px; color: #888;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-family: ui-monospace, monospace;
}
.file-ops {
    display: flex; gap: 5px; padding: 6px 10px 8px;
}
.op-btn {
    padding: 3px 10px; border: 1px solid #e0e0e0; background: #fff;
    border-radius: 5px; font-size: 11px; color: #555; cursor: pointer;
    line-height: 1.3;
}
.op-btn:hover { background: #f5f7fa; }
.op-btn.danger { color: #e53e3e; border-color: #fecaca; }
.op-btn.danger:hover { background: #fee; }
.file-hover-ops {
    position: absolute; top: 6px; right: 6px; display: flex; gap: 4px;
    opacity: 0; transition: .2s;
}
.image-item:hover .file-hover-ops { opacity: 1; }
.hover-btn {
    padding: 4px 10px; border-radius: 6px; border: 0; cursor: pointer;
    background: rgba(255,255,255,.95); font-size: 12px; color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,.15); white-space: nowrap;
}
.hover-btn:hover { background: #fff; }
.hover-btn.danger { color: #e53e3e; }
.hover-btn.danger:hover { background: #fee; }
.file-hover-ops form { margin: 0; }

/* 空状态 */
.empty-state {
    grid-column: 1 / -1; text-align: center; padding: 80px 20px; color: #aaa;
}
.empty-ic { font-size: 64px; margin-bottom: 16px; }
.empty-state p { font-size: 16px; margin: 4px 0; }
.empty-hint { font-size: 13px !important; color: #ccc; }

/* 手机适配 */
@media (max-width: 768px) {
    .explorer { flex-direction: column; }
    .explorer-side {
        width: 100%; flex-direction: row; align-items: center; padding: 8px 12px;
        border-right: 0; border-bottom: 1px solid #e5e7eb;
    }
    .side-quota { border: 0; padding: 0 12px 0 0; flex: 1; }
    .side-quota .quota-text { font-size: 11px; }
    .side-tree {
        flex: none; display: flex; overflow-x: auto; padding: 0;
    }
    .tree-node { flex-shrink: 0; }
    .tree-node a { white-space: nowrap; padding: 6px 10px; }
    .side-actions { display: flex; border: 0; padding: 0; }
    .side-link { padding: 6px 8px; }
    .file-view { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; padding: 12px; }
    .file-thumb { height: 90px; }
    .toolbar-left { flex-wrap: wrap; }
}

/* 右键菜单 */
.ctx-menu {
    display: none; position: fixed; z-index: 9999; min-width: 140px;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0,0,0,.15); padding: 4px 0;
}
.ctx-item {
    padding: 8px 18px; font-size: 14px; color: #333; cursor: pointer;
}
.ctx-item:hover { background: #f5f7fa; }
.ctx-item.danger { color: #e53e3e; }
.ctx-item.danger:hover { background: #fee; }
.ctx-sep { height: 1px; background: #f0f0f0; margin: 4px 0; }

.side-title { font-size: 12px; color: #aaa; padding: 10px 14px 4px; text-transform: uppercase; letter-spacing: 1px; }
