/* ============================================================
   Markly — style.css  |  Glassmorphism redesign
   Font: Inter (body) + Cabinet Grotesk (display)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');
@import url('https://api.fontshare.com/v2/css?f[]=cabinet-grotesk@700,800,900&display=swap');

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

/* ---- LIGHT MODE ---- */
:root {
  --accent:        #2a7a52;
  --accent-2:      #1d5c3d;
  --accent-light:  rgba(42,122,82,0.10);
  --accent-border: rgba(42,122,82,0.25);
  --star:          #b10303;
  --star-2:        #ee5f5f;
  --danger:        #c0392b;
  --danger-light:  rgba(192,57,43,0.10);
  --bg-gradient:   linear-gradient(135deg,#eef2f7 0%,#e8f0eb 50%,#eeedf7 100%);
  --bg:            #eff2f6;
  --bg-2:          rgba(255,255,255,0.55);
  --bg-3:          rgba(255,255,255,0.80);
  --glass:         rgba(255,255,255,0.72);
  --glass-2:       rgba(255,255,255,0.50);
  --glass-border:  rgba(255,255,255,0.88);
  --glass-border-2:rgba(190,205,220,0.55);
  --glass-shadow:  0 4px 24px rgba(0,0,0,0.06),0 1px 4px rgba(0,0,0,0.04);
  --glass-shadow-hover:0 8px 32px rgba(0,0,0,0.10),0 2px 8px rgba(0,0,0,0.05);
  --surface:       rgba(255,255,255,0.90);
  --surface-2:     rgba(255,255,255,0.65);
  --text:          #1a1a2e;
  --text-2:        #4a5568;
  --text-3:        #a0aec0;
  --text-inv:      #ffffff;
  --border:        rgba(190,205,220,0.50);
  --border-2:      rgba(150,170,192,0.60);
  --radius-sm:     8px;
  --radius:        14px;
  --radius-lg:     18px;
  --radius-xl:     24px;
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --shadow:        0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.12);
  --font-display:  'Cabinet Grotesk','Inter',system-ui,sans-serif;
  --font-body:     'Inter',system-ui,sans-serif;
  --header-h:      60px;
  --sidebar-w:     228px;
  --transition:    0.18s ease;
  --blur:          blur(20px) saturate(1.4);
  --blur-sm:       blur(10px);
}

/* ---- DARK MODE ---- */
[data-theme="dark"] {
  --accent:        #52b788;
  --accent-2:      #74c69d;
  --accent-light:  rgba(82,183,136,0.12);
  --accent-border: rgba(82,183,136,0.25);
  --danger:        #e74c3c;
  --danger-light:  rgba(231,76,60,0.12);
  --bg-gradient:   linear-gradient(135deg,#0d1117 0%,#0e1a12 50%,#0f0e1a 100%);
  --bg:            #0d1117;
  --bg-2:          rgba(255,255,255,0.04);
  --bg-3:          rgba(255,255,255,0.08);
  --glass:         rgba(22,27,34,0.85);
  --glass-2:       rgba(22,27,34,0.65);
  --glass-border:  rgba(255,255,255,0.08);
  --glass-border-2:rgba(255,255,255,0.14);
  --glass-shadow:  0 4px 24px rgba(0,0,0,0.35),0 1px 4px rgba(0,0,0,0.20);
  --glass-shadow-hover:0 8px 32px rgba(0,0,0,0.50),0 2px 8px rgba(0,0,0,0.30);
  --surface:       rgba(22,27,34,0.92);
  --surface-2:     rgba(22,27,34,0.70);
  --text:          #e6edf3;
  --text-2:        #8b949e;
  --text-3:        #484f58;
  --text-inv:      #0d1117;
  --border:        rgba(255,255,255,0.08);
  --border-2:      rgba(255,255,255,0.14);
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.30);
  --shadow:        0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg:     0 16px 48px rgba(0,0,0,0.60);
}

/* ---- BASE ---- */
html { height:100%; }
body {
  font-family:var(--font-body);
  background:var(--bg);
  background-image:var(--bg-gradient);
  background-attachment:fixed;
  color:var(--text);
  font-size:14px;
  line-height:1.6;
  height:100%;
  -webkit-font-smoothing:antialiased;
}
a { text-decoration:none; color:inherit; }
button { font-family:var(--font-body); }
::-webkit-scrollbar { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border-2); border-radius:10px; }
::-webkit-scrollbar-thumb:hover { background:var(--text-3); }

/* ---- LAYOUT ---- */
.app { display:flex; flex-direction:column; height:100vh; overflow:hidden; }

/* ---- HEADER ---- */
header {
  height:var(--header-h);
  background:var(--glass);
  backdrop-filter:var(--blur);
  -webkit-backdrop-filter:var(--blur);
  border-bottom:1px solid var(--glass-border);
  display:grid;
  grid-template-columns:1fr auto 1fr;
  align-items:center;
  padding:0 1.25rem;
  flex-shrink:0;
  z-index:50;
  gap:1rem;
}
.header-col-left  { display:flex; align-items:center; }
.header-col-center { display:flex; align-items:center; justify-content:center; }
.header-col-right  { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:nowrap; white-space:nowrap; }

.logo { display:flex; align-items:center; flex-shrink:0; }
.logo-img { height:26px; width:auto; display:block; }
.logo-text { font-family:var(--font-display); font-size:1.2rem; font-weight:900; color:var(--accent); letter-spacing:-0.04em; }

.header-search { width:340px; }
.header-search-btn {
  width:100%; height:34px;
  background:var(--glass-2);
  backdrop-filter:var(--blur-sm);
  border:1px solid var(--glass-border-2);
  border-radius:50px;
  display:flex; align-items:center; gap:8px;
  padding:0 12px; cursor:pointer;
  transition:all var(--transition);
  color:var(--text-3); font-size:13px;
}
.header-search-btn:hover { border-color:var(--accent-border); background:var(--glass); color:var(--text-2); box-shadow:0 0 0 3px var(--accent-light); }
.header-search-btn .kbd { margin-left:auto; font-size:11px; background:var(--bg-2); border:1px solid var(--border); border-radius:4px; padding:1px 6px; color:var(--text-3); }

.header-tabs { display:flex; gap:4px; }
.tab-btn { height:28px; padding:0 16px; border:none; background:none; border-radius:50px; font-family:var(--font-body); font-size:13px; font-weight:500; color:var(--text-2); cursor:pointer; transition:all var(--transition); }
.tab-btn:hover { color:var(--text); background:var(--bg-2); }
.tab-btn.active { background:var(--accent); color:#fff; font-weight:600; }

.header-actions { display:flex; align-items:center; gap:8px; margin-left:auto; }
.user-badge-name { font-size:13px; font-weight:500; color:var(--accent); padding:0 4px; }
.header-icon-btn {
  height:32px; padding:0 12px; border-radius:50px;
  font-family:var(--font-body); font-size:12px; font-weight:500;
  cursor:pointer; transition:all var(--transition);
  display:flex; align-items:center; gap:6px;
  border:1px solid var(--border);
  background:var(--glass-2); color:var(--text-2);
  backdrop-filter:var(--blur-sm);
}
.header-icon-btn:hover { background:var(--glass); border-color:var(--border-2); color:var(--text); }
.header-icon-btn.import-btn { color:#e05a00; border-color:rgba(224,90,0,0.3); background:rgba(224,90,0,0.07); }
.header-icon-btn.import-btn:hover { background:rgba(224,90,0,0.13); }
.header-icon-btn.export-btn { color:#2471a3; border-color:rgba(36,113,163,0.3); background:rgba(36,113,163,0.07); }
.header-icon-btn.export-btn:hover { background:rgba(36,113,163,0.13); }
.theme-toggle { width:32px; height:32px; border-radius:50%; border:1px solid var(--border); background:var(--glass-2); color:var(--text-2); cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all var(--transition); flex-shrink:0; }
.theme-toggle:hover { background:var(--glass); border-color:var(--border-2); color:var(--text); }
.theme-toggle .icon-sun  { display:none; }
.theme-toggle .icon-moon { display:block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display:block; }
[data-theme="dark"] .theme-toggle .icon-moon { display:none; }

/* ---- MAIN WRAP ---- */
.main-wrap { display:flex; flex:1; overflow:hidden; }
.tab-view { display:none; flex:1; overflow:hidden; flex-direction:row; }
.tab-view.active { display:flex; }

/* ---- SIDEBAR ---- */
aside {
  width:var(--sidebar-w); flex-shrink:0;
  background:var(--glass);
  backdrop-filter:var(--blur);
  -webkit-backdrop-filter:var(--blur);
  border-right:1px solid var(--glass-border);
  display:flex; flex-direction:column;
  overflow-y:auto; overflow-x:hidden;
  padding:1rem 0.75rem; gap:2px; align-items:stretch;
}
.sidebar-resizer { width:4px; cursor:col-resize; background:transparent; flex-shrink:0; transition:background var(--transition); position:relative; z-index:10; }
.sidebar-resizer:hover,.sidebar-resizer.resizing { background:var(--accent-border); }
.sidebar-resizer::after { content:''; position:absolute; top:0; bottom:0; left:-4px; right:-4px; }

.aside-section { font-size:10px; font-weight:700; letter-spacing:0.12em; text-transform:uppercase; color:var(--text-3); padding:12px 8px 4px; margin-top:4px; }
.aside-section:first-child { padding-top:4px; margin-top:0; }

.sidebar-add-btn {
  width:100%; height:36px; min-height:36px;
  border-radius:var(--radius);
  background:var(--accent); color:#fff; border:none;
  font-family:var(--font-body); font-size:13px; font-weight:600;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px;
  margin-bottom:6px; flex-shrink:0; transition:all var(--transition);
  box-shadow:0 2px 12px var(--accent-light);
}
.sidebar-add-btn:hover { opacity:0.90; transform:translateY(-1px); box-shadow:0 4px 20px rgba(42,122,82,0.30); }

.sidebar-import-btn { width:100%; height:30px; min-height:30px; border-radius:var(--radius-sm); background:none; border:1px solid var(--border); color:var(--text-2); font-family:var(--font-body); font-size:12px; font-weight:500; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:6px; margin-bottom:8px; flex-shrink:0; transition:all var(--transition); }
.sidebar-import-btn:hover { background:var(--glass-2); border-color:var(--border-2); color:var(--text); }

.nav-item { display:flex; align-items:center; gap:8px; padding:7px 10px; border-radius:var(--radius-sm); font-size:13px; color:var(--text-2); cursor:pointer; transition:all var(--transition); border:none; background:none; width:100%; text-align:left; }
.nav-item:hover { background:var(--glass-2); color:var(--text); }
.nav-item.active { background:var(--accent-light); color:var(--accent); font-weight:600; box-shadow:inset 0 0 0 1px var(--accent-border); }
.nav-item svg { flex-shrink:0; opacity:0.7; }
.nav-item.active svg { opacity:1; }
.nav-item .count { margin-left:auto; font-size:11px; color:var(--text-3); background:var(--bg-2); padding:1px 7px; border-radius:10px; }
.nav-item.active .count { background:var(--accent-border); color:var(--accent-2); }
#nav-top svg { fill:var(--accent); stroke:var(--accent); }

.tag-nav-item { display:flex; align-items:center; border-radius:var(--radius-sm); overflow:hidden; position:relative; }
.tag-nav-item:hover .tag-nav-actions { opacity:1; }
.tag-nav-item.active .tag-nav-btn { background:var(--accent-light); color:var(--accent); font-weight:500; }
.tag-nav-item.active .count { background:var(--accent-border); color:var(--accent-2); }
.tag-nav-btn { flex:1; display:flex; align-items:center; gap:7px; padding:6px 10px; font-size:13px; color:var(--text-2); cursor:pointer; border:none; background:none; text-align:left; transition:all var(--transition); min-width:0; }
.tag-nav-btn:hover { background:var(--glass-2); color:var(--text); }
.tag-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; box-shadow:0 0 0 2px rgba(255,255,255,0.25); }
.tag-nav-name { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tag-nav-actions { display:flex; gap:2px; padding-right:4px; opacity:0; transition:opacity var(--transition); }
.tag-action-btn { width:20px; height:20px; border:none; background:none; color:var(--text-3); cursor:pointer; border-radius:4px; font-size:11px; display:flex; align-items:center; justify-content:center; transition:all var(--transition); }
.tag-action-btn:hover { background:var(--bg-2); color:var(--text); }
.tag-action-btn.danger:hover { background:var(--danger-light); color:var(--danger); }

.aside-label-btn { display:flex; align-items:center; justify-content:space-between; padding:10px 8px 4px; margin-top:4px; }
.aside-label-btn span { font-size:10px; font-weight:700; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-3); }
.aside-label-action { width:18px; height:18px; border:none; background:none; color:var(--text-3); cursor:pointer; border-radius:4px; display:flex; align-items:center; justify-content:center; transition:all var(--transition); }
.aside-label-action:hover { background:var(--bg-2); color:var(--accent); }

.coll-nav-card { display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:var(--radius-sm); cursor:pointer; transition:all var(--transition); position:relative; }
.coll-nav-card:hover { background:var(--glass-2); }
.coll-nav-card:hover .coll-nav-actions { opacity:1; }
.coll-nav-cover { display:grid; grid-template-columns:1fr 1fr; grid-template-rows:1fr 1fr; gap:2px; width:28px; height:28px; border-radius:7px; overflow:hidden; flex-shrink:0; background:var(--bg-2); border:1px solid var(--border); }
.coll-nav-fav { background:var(--bg-2); display:flex; align-items:center; justify-content:center; overflow:hidden; }
.coll-nav-fav img { width:10px; height:10px; object-fit:contain; }
.coll-nav-body { flex:1; min-width:0; }
.coll-nav-name { font-size:12px; font-weight:500; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.coll-nav-meta { font-size:10px; color:var(--text-3); margin-top:1px; }
.coll-nav-actions { display:flex; gap:2px; opacity:0; transition:opacity var(--transition); }

/* ---- CONTENT AREA ---- */
main.content { flex:1; overflow-y:auto; padding:1.5rem 2rem; display:flex; flex-direction:column; gap:1rem; }
.content-header { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.view-title { font-family:var(--font-display); font-size:1.6rem; font-weight:900; color:var(--text); letter-spacing:-0.04em; }
.view-controls { display:flex; align-items:center; gap:8px; }
.sort-select { height:30px; padding:0 12px; border-radius:50px; border:1px solid var(--border); background:var(--glass-2); backdrop-filter:var(--blur-sm); color:var(--text-2); font-family:var(--font-body); font-size:12px; cursor:pointer; outline:none; transition:all var(--transition); }
.sort-select:hover { border-color:var(--border-2); background:var(--glass); }
.view-toggle { display:flex; gap:2px; background:var(--glass-2); border-radius:var(--radius-sm); padding:3px; border:1px solid var(--border); backdrop-filter:var(--blur-sm); }
.view-toggle button { width:28px; height:26px; border:none; background:none; padding:0; border-radius:5px; cursor:pointer; color:var(--text-3); display:flex; align-items:center; justify-content:center; transition:all var(--transition); }
.view-toggle button:hover { color:var(--text-2); background:var(--bg-3); }
.view-toggle button.active { background:var(--glass); color:var(--text); box-shadow:var(--shadow-sm); }

#active-tags-bar { display:flex; flex-wrap:wrap; align-items:center; gap:6px; padding:8px 12px; background:var(--accent-light); border:1px solid var(--accent-border); border-radius:var(--radius-sm); backdrop-filter:var(--blur-sm); }
.active-tag-badge { display:inline-flex; align-items:center; gap:4px; font-size:12px; font-weight:500; padding:3px 8px; border-radius:50px; }
.active-tag-badge button { background:none; border:none; cursor:pointer; font-size:11px; color:inherit; opacity:0.7; padding:0; line-height:1; }
.active-tag-badge button:hover { opacity:1; }
.active-tags-clear { font-size:11px; color:var(--text-3); background:none; border:none; cursor:pointer; padding:3px 6px; border-radius:4px; transition:all var(--transition); font-family:var(--font-body); }
.active-tags-clear:hover { background:var(--bg-3); color:var(--text-2); }

/* ---- CARDS ---- */
.grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(270px,1fr)); gap:14px; align-content:start; }
.list { display:flex; flex-direction:column; gap:8px; }

.bookmark-card {
  background:var(--glass);
  backdrop-filter:var(--blur);
  -webkit-backdrop-filter:var(--blur);
  border:1px solid var(--glass-border);
  border-radius:var(--radius);
  padding:16px 16px 52px;
  cursor:pointer;
  display:flex; flex-direction:column; gap:10px;
  transition:all 0.22s ease;
  position:relative;
  box-shadow:var(--glass-shadow);
}
.bookmark-card:hover {
  border-color:var(--glass-border-2);
  box-shadow:var(--glass-shadow-hover);
  transform:translateY(-2px);
}
.bookmark-card.list-mode { flex-direction:column; gap:0; padding:10px 14px 14px; border-radius:var(--radius-sm); transform:none; }
.bookmark-card.list-mode .card-header-row { width:100%; }
.bookmark-card.list-mode .card-main { flex-direction:row; align-items:center; width:100%; margin-top:0; }
.bookmark-card.list-mode .card-note { display:none; }

.card-header-row { display:flex; align-items:center; gap:12px; }
.card-favicon-lg { width:64px; height:64px; border-radius:14px; background:var(--glass-2); border:1px solid var(--glass-border); display:flex; align-items:center; justify-content:center; flex-shrink:0; overflow:hidden; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.card-favicon-lg img { width:40px; height:40px; object-fit:contain; }
.card-icon-emoji { font-size:26px; display:flex; align-items:center; justify-content:center; width:100%; height:100%; }
.card-icon-letter { font-size:22px; font-weight:800; display:flex; align-items:center; justify-content:center; width:100%; height:100%; color:var(--text-inv); }
.card-header-text { flex:1; min-width:0; }
.card-title { font-size:14px; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; line-height:1.3; }
.card-url { font-size:11px; color:var(--text-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:2px; }
.card-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; }
.card-note { font-size:12px; color:var(--text-2); line-height:1.5; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.card-tags { display:flex; flex-wrap:wrap; gap:4px; }
.tag { font-size:11px; font-weight:600; padding:2px 9px; border-radius:50px; cursor:pointer; transition:opacity var(--transition); opacity:0.90; }
.tag:hover { opacity:0.70; }
.card-footer { display:flex; align-items:center; gap:8px; margin-top:2px; }
.card-date { font-size:11px; color:var(--text-3); }

/* Stelle rating */
.card-header-row .card-stars { display:flex; margin-left:0; margin-top:4px; }
.card-stars { display:flex; gap:1px; }
.star-btn { background:none; border:none; cursor:pointer; font-size:14px; color:var(--border-2); padding:0 1px; line-height:1; transition:color .12s,transform .1s; }
.star-btn.active { color:var(--star); }
.bookmark-card:hover .star-btn { color:var(--text-3); }
.bookmark-card:hover .star-btn.active { color:var(--star); }
.star-btn:hover { color:var(--star) !important; transform:scale(1.25); }

/* Pannello azioni */
.card-actions {
  display:grid; grid-template-columns:repeat(9,1fr);
  position:absolute; bottom:0; left:0; right:0;
  background:var(--glass);
  backdrop-filter:var(--blur);
  -webkit-backdrop-filter:var(--blur);
  border-top:1px solid var(--glass-border);
  border-radius:0 0 var(--radius) var(--radius);
  padding:6px 8px;
  opacity:0; transform:translateY(4px);
  transition:opacity var(--transition),transform var(--transition);
  align-items:center; gap:2px;
}
.bookmark-card:hover .card-actions { opacity:1; transform:translateY(0); }
.bookmark-card.list-mode .card-actions { display:none; }
.icon-btn { width:100%; height:30px; display:flex; align-items:center; justify-content:center; border-radius:var(--radius-sm); border:none; background:none; color:var(--text-3); cursor:pointer; font-size:13px; transition:all var(--transition); }
.icon-btn:hover { background:var(--glass-2); color:var(--text); }
.icon-btn.delete:hover { background:var(--danger-light); color:var(--danger); }
.icon-btn-spacer { display:block; }
.top-active { color:var(--accent); }
.top-active svg { stroke:var(--accent); fill:var(--accent); }

/* Drag handle */
.card-drag-handle { position:absolute; top:10px; left:8px; font-size:14px; color:var(--text-3); cursor:grab; opacity:0; transition:opacity var(--transition); line-height:1; user-select:none; }
.bookmark-card:hover .card-drag-handle { opacity:1; }
.card-drag-handle:active { cursor:grabbing; }
.tag-drag-ghost { opacity:0.4; background:var(--accent-light); border-radius:var(--radius-sm); }

/* ---- EMPTY STATES ---- */
.empty { grid-column:1/-1; text-align:center; padding:4rem 2rem; color:var(--text-3); }
.empty-icon { font-size:2.5rem; margin-bottom:1rem; }
.empty h3 { font-family:var(--font-display); font-size:1.25rem; font-weight:700; color:var(--text-2); margin-bottom:0.5rem; }
.empty p { font-size:13px; }
.empty-first { grid-column:1/-1; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:4rem 2rem; gap:1rem; }
.empty-add-btn { width:120px; height:120px; border:2px dashed var(--border-2); border-radius:var(--radius-xl); background:none; color:var(--text-3); cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.2s; }
.empty-add-btn:hover { border-color:var(--accent-border); color:var(--accent); background:var(--accent-light); transform:scale(1.04); }
.empty-add-btn svg { transition:transform 0.25s; }
.empty-add-btn:hover svg { transform:rotate(90deg); }
.empty-add-label { font-size:13px; color:var(--text-3); font-weight:500; }

/* ---- BUTTONS ---- */
.btn { display:inline-flex; align-items:center; gap:6px; height:32px; padding:0 14px; border-radius:50px; font-family:var(--font-body); font-size:13px; font-weight:500; cursor:pointer; border:1px solid var(--border); background:var(--glass-2); color:var(--text-2); backdrop-filter:var(--blur-sm); transition:all var(--transition); white-space:nowrap; }
.btn:hover { background:var(--glass); border-color:var(--border-2); color:var(--text); }
.btn-primary { background:var(--accent); color:#fff; border-color:var(--accent); box-shadow:0 2px 12px var(--accent-light); }
.btn-primary:hover { opacity:0.88; background:var(--accent); color:#fff; transform:translateY(-1px); }
.btn-blue { background:#2980b9; color:#fff; border-color:#2980b9; }
.btn-blue:hover { opacity:0.88; }
.btn-danger { color:var(--danger); border-color:transparent; background:transparent; }
.btn-danger:hover { background:var(--danger-light); border-color:var(--danger); }

/* ---- MODALS ---- */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.40); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); z-index:200; display:flex; align-items:center; justify-content:center; padding:1rem; animation:fadeIn 0.15s ease; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
@keyframes slideUp { from{transform:translateY(16px);opacity:0} to{transform:translateY(0);opacity:1} }
@keyframes loadpulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

.modal { background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); border:1px solid var(--glass-border); border-radius:var(--radius-lg); width:100%; max-width:500px; max-height:90vh; overflow-y:auto; padding:1.5rem; animation:slideUp 0.2s ease; display:flex; flex-direction:column; gap:1.1rem; box-shadow:var(--shadow-lg); }
.modal-header { display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.modal-title { font-family:var(--font-display); font-size:1.1rem; font-weight:800; letter-spacing:-0.03em; }
.modal-close { width:28px; height:28px; border:none; background:none; color:var(--text-3); cursor:pointer; font-size:15px; border-radius:50%; display:flex; align-items:center; justify-content:center; transition:all var(--transition); }
.modal-close:hover { background:var(--bg-2); color:var(--text); }

.field { display:flex; flex-direction:column; gap:5px; }
.field label { font-size:11px; font-weight:700; letter-spacing:0.07em; text-transform:uppercase; color:var(--text-3); }
.field input,.field textarea,.field select { padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--glass-2); backdrop-filter:var(--blur-sm); font-family:var(--font-body); font-size:13px; color:var(--text); outline:none; transition:all var(--transition); resize:vertical; }
.field input:focus,.field textarea:focus { border-color:var(--accent-border); box-shadow:0 0 0 3px var(--accent-light); background:var(--glass); }
.field input::placeholder,.field textarea::placeholder { color:var(--text-3); }
.modal-footer { display:flex; gap:8px; justify-content:flex-end; }

.tag-input-wrap { display:flex; flex-wrap:wrap; gap:5px; padding:7px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--glass-2); min-height:38px; align-items:center; cursor:text; transition:all var(--transition); }
.tag-input-wrap:focus-within { border-color:var(--accent-border); box-shadow:0 0 0 3px var(--accent-light); background:var(--glass); }
.tag-input-wrap input { border:none; background:none; padding:1px 4px; font-family:var(--font-body); font-size:13px; color:var(--text); outline:none; flex:1; min-width:80px; }
.tag-input-wrap input::placeholder { color:var(--text-3); }
.tag-rm { background:none; border:none; cursor:pointer; font-size:11px; margin-left:2px; color:inherit; opacity:0.7; }
.tag-rm:hover { opacity:1; }

.auth-tab { flex:1; padding:6px; border:none; background:none; border-radius:5px; font-family:var(--font-body); font-size:13px; font-weight:500; color:var(--text-2); cursor:pointer; transition:all var(--transition); }
.auth-tab:hover { background:var(--bg-2); color:var(--text); }
.auth-tab.active { background:var(--glass); color:var(--text); box-shadow:var(--shadow-sm); }

/* ---- ICON PICKER ---- */
.ip-wrap { border:1px solid var(--border); border-radius:var(--radius-sm); padding:10px; background:var(--glass-2); display:flex; flex-direction:column; gap:8px; }
.ip-tabs { display:flex; gap:3px; background:var(--glass); border-radius:8px; padding:3px; border:1px solid var(--border); }
.ip-tab { flex:1; padding:4px; border:none; background:none; border-radius:5px; font-family:var(--font-body); font-size:12px; font-weight:500; color:var(--text-2); cursor:pointer; transition:all var(--transition); }
.ip-tab:hover { color:var(--text); }
.ip-tab.active { background:var(--accent); color:#fff; }
.ip-tab-reset.active { background:var(--glass-2); color:var(--text-2); }
.ip-cat-label { font-size:10px; font-weight:700; letter-spacing:0.07em; text-transform:uppercase; color:var(--text-3); }
.ip-emoji-grid { display:flex; flex-wrap:wrap; gap:4px; }
.ip-emoji-btn { width:32px; height:32px; border:1px solid transparent; border-radius:8px; background:var(--glass); font-size:16px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:all 0.1s; }
.ip-emoji-btn:hover { transform:scale(1.12); border-color:var(--border); }
.ip-emoji-btn.selected { border-color:var(--accent-border); background:var(--accent-light); transform:scale(1.08); }
.ip-colors { display:flex; flex-wrap:wrap; gap:6px; }
.ip-color-btn { width:26px; height:26px; border-radius:8px; border:2px solid transparent; cursor:pointer; transition:transform 0.1s; }
.ip-color-btn:hover { transform:scale(1.1); }
.ip-color-btn.selected { border-color:var(--text); transform:scale(1.05); }
.ip-preview { display:flex; align-items:center; gap:10px; padding:8px 10px; background:var(--glass); border-radius:var(--radius-sm); border:1px solid var(--border); }
.ip-icon-demo { width:40px; height:40px; border-radius:10px; background:var(--glass-2); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; font-size:13px; color:var(--text-3); flex-shrink:0; font-weight:700; }

/* ---- TAG EDITOR ---- */
.tag-editor { margin:4px 6px 8px; background:var(--glass); border:1px solid var(--glass-border); border-radius:var(--radius-sm); padding:10px; display:flex; flex-direction:column; gap:8px; animation:slideUp 0.15s ease; box-shadow:var(--shadow-sm); backdrop-filter:var(--blur-sm); }
.tag-editor-field { display:flex; flex-direction:column; gap:4px; }
.tag-editor-field label { font-size:10px; font-weight:700; letter-spacing:0.07em; text-transform:uppercase; color:var(--text-3); }
.tag-editor-field input { padding:6px 10px; border:1px solid var(--border); border-radius:5px; background:var(--glass-2); font-family:var(--font-body); font-size:12px; color:var(--text); outline:none; transition:border-color var(--transition); }
.tag-editor-field input:focus { border-color:var(--accent-border); }
.tep-color-row { display:flex; align-items:center; gap:7px; }
.tep-color-swatch { width:26px; height:26px; border-radius:7px; border:2px solid transparent; cursor:pointer; transition:transform 0.1s; flex-shrink:0; }
.tep-color-swatch:hover { transform:scale(1.1); }
.tep-color-swatch.selected { border-color:var(--text); }
.tep-btns { display:flex; justify-content:flex-end; gap:6px; margin-top:2px; }
.tep-save { padding:5px 12px; background:var(--accent); color:#fff; border:none; border-radius:5px; font-family:var(--font-body); font-size:12px; font-weight:600; cursor:pointer; transition:opacity var(--transition); }
.tep-save:hover { opacity:0.88; }
.tep-cancel { padding:5px 10px; background:none; border:none; font-family:var(--font-body); font-size:12px; color:var(--text-3); cursor:pointer; border-radius:5px; transition:all var(--transition); }
.tep-cancel:hover { background:var(--bg-2); color:var(--text); }

/* ---- IMPORT MODAL ---- */
.ibg { display:flex; flex-direction:column; gap:6px; max-height:220px; overflow-y:auto; }
.ibg-folder { background:var(--glass-2); border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; }
.ibg-folder-header { display:flex; align-items:center; gap:8px; padding:8px 12px; cursor:pointer; }
.ibg-folder-header:hover { background:var(--bg-2); }
.ibg-cb { width:14px; height:14px; accent-color:var(--accent); cursor:pointer; }
.ibg-fname { font-size:12px; font-weight:500; color:var(--text); flex:1; }
.ibg-count { font-size:11px; color:var(--text-3); }
.ibg-item { display:flex; align-items:flex-start; gap:8px; padding:6px 12px 6px 20px; }
.ibg-item:hover { background:var(--bg-2); }
.ibg-name { font-size:12px; color:var(--text-2); flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ibg-steps { font-size:11px; color:var(--text-3); flex:1; }
.ibg-sel-all { font-size:11px; color:var(--accent); background:none; border:none; cursor:pointer; font-family:var(--font-body); padding:0; }
.ibg-sel-all:hover { text-decoration:underline; }
.ibg-info { padding:10px; background:var(--glass-2); border-radius:var(--radius-sm); border:1px solid var(--border); font-size:12px; color:var(--text-2); line-height:1.5; }
.ibg-steps-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; }

/* ---- URL SCHEME ---- */
.url-scheme-wrap { display:flex; border:1px solid var(--border); border-radius:var(--radius-sm); overflow:hidden; background:var(--glass-2); transition:all var(--transition); }
.url-scheme-wrap:focus-within { border-color:var(--accent-border); box-shadow:0 0 0 3px var(--accent-light); background:var(--glass); }
.url-scheme-select { border:none; border-right:1px solid var(--border); background:transparent; padding:9px 8px; font-family:monospace; font-size:11px; color:var(--text-3); cursor:pointer; outline:none; max-width:110px; }
.url-scheme-input { flex:1; border:none; background:transparent; padding:9px 12px; font-family:var(--font-body); font-size:13px; color:var(--text); outline:none; }
.url-custom-wrap { margin-top:4px; }
.url-custom-input { width:100%; padding:9px 12px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--glass-2); font-family:var(--font-body); font-size:13px; color:var(--text); outline:none; transition:all var(--transition); }
.url-custom-input:focus { border-color:var(--accent-border); box-shadow:0 0 0 3px var(--accent-light); }

/* ---- COLLECTION PICKER ---- */
.cv-container { display:flex; flex-direction:column; gap:8px; }
.cv-filter { display:flex; gap:6px; align-items:center; }
.cv-search { flex:1; padding:7px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--glass-2); font-family:var(--font-body); font-size:12px; color:var(--text); outline:none; transition:all var(--transition); }
.cv-search:focus { border-color:var(--accent-border); }
.cv-action-btn { padding:6px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--glass-2); font-family:var(--font-body); font-size:11px; color:var(--text-2); cursor:pointer; transition:all var(--transition); }
.cv-action-btn:hover { background:var(--glass); border-color:var(--border-2); color:var(--text); }
.cv-list { max-height:240px; overflow-y:auto; display:flex; flex-direction:column; gap:3px; }
.cv-item { display:flex; align-items:center; gap:8px; padding:7px 10px; border-radius:6px; cursor:pointer; transition:background var(--transition); }
.cv-item:hover { background:var(--glass-2); }
.cv-item.selected { background:var(--accent-light); }
.cv-check { width:15px; height:15px; border-radius:4px; border:1.5px solid var(--border); background:var(--glass-2); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.cv-item.selected .cv-check { background:var(--accent); border-color:var(--accent); }
.cv-name { font-size:13px; color:var(--text); }
.cv-count { font-size:11px; color:var(--text-3); margin-left:auto; }

/* ---- COMMAND PALETTE ---- */
.cmd-overlay { position:fixed; inset:0; z-index:300; background:rgba(0,0,0,0.45); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); display:flex; align-items:flex-start; justify-content:center; padding-top:14vh; animation:fadeIn 0.12s ease; }
.cmd-box { width:560px; max-width:95vw; background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); border:1px solid var(--glass-border); border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); overflow:hidden; animation:slideUp 0.18s ease; }
.cmd-input-row { display:flex; align-items:center; gap:10px; padding:14px 18px; border-bottom:1px solid var(--border); }
.cmd-input { flex:1; border:none; background:none; font-family:var(--font-body); font-size:16px; color:var(--text); outline:none; }
.cmd-input::placeholder { color:var(--text-3); }
.cmd-results { max-height:400px; overflow-y:auto; padding:6px; }
.cmd-item { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:var(--radius-sm); cursor:pointer; transition:background var(--transition); }
.cmd-item:hover,.cmd-item.active { background:var(--accent-light); }
.cmd-item-favicon { width:30px; height:30px; border-radius:8px; overflow:hidden; background:var(--glass-2); border:1px solid var(--border); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.cmd-item-favicon img { width:20px; height:20px; object-fit:contain; }
.cmd-item-body { flex:1; min-width:0; }
.cmd-item-title { font-size:13px; font-weight:500; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cmd-item-url { font-size:11px; color:var(--text-3); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; margin-top:1px; }
.cmd-empty { padding:2rem; text-align:center; color:var(--text-3); font-size:13px; }
.cmd-footer { padding:8px 14px; border-top:1px solid var(--border); display:flex; gap:16px; background:var(--glass-2); }
.cmd-hint { font-size:11px; color:var(--text-3); display:flex; align-items:center; gap:4px; }
.cmd-hint kbd { background:var(--bg-2); border:1px solid var(--border); border-radius:4px; padding:1px 5px; font-size:10px; }

/* ---- TAG POPOVER ---- */
.tag-popover { position:fixed; z-index:400; background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); border:1px solid var(--glass-border); border-radius:var(--radius); box-shadow:var(--shadow-lg); width:220px; padding:8px; animation:slideUp 0.15s ease; }
.tag-popover-search { width:100%; padding:6px 10px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--glass-2); font-family:var(--font-body); font-size:12px; color:var(--text); outline:none; margin-bottom:6px; transition:all var(--transition); }
.tag-popover-search:focus { border-color:var(--accent-border); }
.tag-popover-list { max-height:200px; overflow-y:auto; display:flex; flex-direction:column; gap:1px; }
.tag-popover-item { display:flex; align-items:center; gap:7px; padding:6px 8px; border-radius:6px; cursor:pointer; transition:background var(--transition); font-size:12px; color:var(--text-2); }
.tag-popover-item:hover { background:var(--glass-2); color:var(--text); }
.tag-popover-item.applied { color:var(--accent); font-weight:500; }
.tag-popover-item.applied .tp-check { opacity:1; }
.tp-check { margin-left:auto; font-size:11px; color:var(--accent); opacity:0; }
.tag-popover-create { display:flex; align-items:center; gap:7px; padding:7px 8px; border-radius:6px; cursor:pointer; font-size:12px; color:var(--accent); font-weight:500; transition:background var(--transition); }
.tag-popover-create:hover { background:var(--accent-light); }

/* ---- TOAST ---- */
.toast { position:fixed; bottom:24px; left:50%; transform:translateX(-50%); background:var(--glass); backdrop-filter:var(--blur); -webkit-backdrop-filter:var(--blur); border:1px solid var(--glass-border); border-radius:50px; padding:10px 18px; font-size:13px; font-weight:500; color:var(--text); box-shadow:var(--shadow-lg); z-index:500; white-space:nowrap; animation:slideUp 0.2s ease; }
.toast.error { background:var(--danger-light); border-color:rgba(192,57,43,0.25); color:var(--danger); }
.toast.success { background:var(--accent-light); border-color:var(--accent-border); color:var(--accent); }

/* ---- LOADING BAR ---- */
.loading-bar { position:fixed; top:0; left:0; right:0; height:2px; background:linear-gradient(90deg,var(--accent),#52b788,var(--accent)); background-size:200%; z-index:1000; animation:loadpulse 1.5s ease infinite; }

/* ---- HERO / ONBOARDING ---- */
.hero-section { grid-column:1/-1; display:flex; flex-direction:column; align-items:center; padding:4rem 2rem; gap:2rem; text-align:center; }
.hero-icon { font-size:3.5rem; margin-bottom:0.5rem; }
.hero-title { font-family:var(--font-display); font-size:2rem; font-weight:900; color:var(--text); letter-spacing:-0.04em; }
.hero-sub { font-size:15px; color:var(--text-2); max-width:440px; line-height:1.6; }
.hero-features { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; width:100%; max-width:600px; }
.hero-feat { background:var(--glass); backdrop-filter:var(--blur-sm); -webkit-backdrop-filter:var(--blur-sm); border:1px solid var(--glass-border); border-radius:var(--radius); padding:16px; text-align:left; }
.hero-feat-icon { font-size:1.5rem; margin-bottom:8px; }
.hero-feat-title { font-size:13px; font-weight:600; color:var(--text); margin-bottom:4px; }
.hero-feat-desc { font-size:12px; color:var(--text-2); line-height:1.5; }
.hero-actions { display:flex; gap:10px; flex-wrap:wrap; justify-content:center; }

.anon-banner { grid-column:1/-1; background:var(--glass); backdrop-filter:var(--blur-sm); -webkit-backdrop-filter:var(--blur-sm); border:1px solid var(--glass-border-2); border-radius:var(--radius); padding:12px 16px; display:flex; align-items:center; gap:12px; font-size:13px; color:var(--text-2); }
.anon-banner-close { margin-left:auto; background:none; border:none; color:var(--text-3); cursor:pointer; font-size:16px; transition:color var(--transition); }
.anon-banner-close:hover { color:var(--text); }
