/* ClipFlow Dashboard */
:root {
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --bg: #0f0f14;
  --bg-card: #1a1a24;
  --bg-sidebar: #141419;
  --text: #e4e4e7;
  --text-muted: #a1a1aa;
  --border: #27272a;
  --danger: #ef4444;
  --success: #10b981;
  --radius: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

#app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 240px; background: var(--bg-sidebar); border-right: 1px solid var(--border); padding: 24px 16px; display: flex; flex-direction: column; position: fixed; height: 100vh; }
.sidebar-brand { font-size: 1.3em; font-weight: 700; margin-bottom: 32px; padding: 0 8px; }
.sidebar ul { list-style: none; flex: 1; }
.sidebar li { margin-bottom: 4px; }
.sidebar li a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text-muted); text-decoration: none; cursor: pointer; transition: all 0.15s; }
.sidebar li a:hover { background: var(--bg-card); color: var(--text); }
.sidebar li.active a { background: var(--primary); color: #fff; }
.sidebar-footer { padding-top: 16px; border-top: 1px solid var(--border); }
.user-email { display: block; font-size: 0.8em; color: var(--text-muted); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; }
.logout-link { font-size: 0.85em; color: var(--text-muted); cursor: pointer; text-decoration: none; }
.logout-link:hover { color: var(--danger); }

/* Content */
.content { flex: 1; margin-left: 240px; padding: 40px; }

/* Auth Pages */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; margin-left: 0; }
.auth-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 1.5em; margin-bottom: 4px; }
.auth-card h2 { font-size: 1.1em; color: var(--text-muted); font-weight: 400; margin-bottom: 24px; }
.auth-trial { color: var(--success); font-size: 0.85em; margin-bottom: 20px; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card input { padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 0.95em; }
.auth-card input:focus { outline: none; border-color: var(--primary); }
.auth-switch { margin-top: 16px; font-size: 0.85em; color: var(--text-muted); }
.auth-switch a { color: var(--primary); cursor: pointer; text-decoration: none; }
.error { color: var(--danger); font-size: 0.85em; margin-top: 8px; }

/* Page */
.page { max-width: 800px; }
.page h1 { font-size: 1.8em; margin-bottom: 8px; }
.welcome { color: var(--text-muted); margin-bottom: 4px; }
.plan-badge { color: var(--text-muted); margin-bottom: 32px; }
.plan-badge strong { color: var(--primary); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 32px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat-value { font-size: 2em; font-weight: 700; }
.stat-label { color: var(--text-muted); font-size: 0.85em; margin-top: 4px; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; }
.card h3 { margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: 0.9em; }

/* Quick Actions */
.quick-actions h3 { margin-bottom: 16px; }
.action-grid { display: flex; gap: 12px; flex-wrap: wrap; }
.action-btn { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 20px; color: var(--text); text-decoration: none; cursor: pointer; transition: border-color 0.2s; }
.action-btn:hover { border-color: var(--primary); }

/* Storage */
.storage-bar { height: 8px; background: var(--border); border-radius: 4px; margin: 12px 0 8px; overflow: hidden; }
.storage-fill { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.3s; }
.storage-text { font-size: 0.85em; color: var(--text-muted); }

/* Device list */
.device-item { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.device-item:last-child { border-bottom: none; }
.device-icon { font-size: 1.8em; }
.device-info { flex: 1; min-width: 0; }
.device-name { font-weight: 600; margin-bottom: 4px; }
.device-meta { font-size: 0.8em; color: var(--text-muted); }
.device-limit { margin-top: 16px; padding: 12px; background: rgba(234, 179, 8, 0.1); border: 1px solid rgba(234, 179, 8, 0.3); border-radius: 8px; font-size: 0.85em; }
.device-limit a { color: var(--primary); cursor: pointer; text-decoration: underline; }
.empty-state { text-align: center; padding: 32px 0; }
.empty-state .hint { font-size: 0.85em; color: var(--text-muted); margin-top: 8px; }

/* Privacy list */
.privacy-list { list-style: none; padding: 0; }
.privacy-list li { padding: 6px 0; color: var(--text-muted); font-size: 0.9em; }
.privacy-list li::before { content: "• "; color: var(--primary); }

/* Buttons */
.btn { display: inline-block; padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer; font-weight: 600; font-size: 0.9em; transition: all 0.2s; text-decoration: none; white-space: nowrap; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-sm { padding: 6px 14px; font-size: 0.85em; }

.loading { color: var(--text-muted); font-style: italic; }
.loading-dots { color: var(--text-muted); animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

/* Section */
.section { margin-bottom: 32px; }
.section h3 { margin-bottom: 12px; }

/* Activity items */
.activity-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { font-size: 1.2em; }
.activity-name { flex: 1; font-weight: 500; }
.activity-time { color: var(--text-muted); font-size: 0.85em; }
.empty-hint { color: var(--text-muted); font-size: 0.9em; text-align: center; padding: 16px 0; }

/* Plan options (Subscription page) */
.plan-options { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.plan-option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color 0.2s; }
.plan-option:hover { border-color: var(--primary); }
.plan-option.current { border-color: var(--primary); background: rgba(124, 58, 237, 0.1); }
.plan-option input[type="radio"] { accent-color: var(--primary); }
.plan-price { color: var(--text-muted); font-size: 0.85em; margin-left: 8px; }
.save-tag { background: #059669; color: #fff; padding: 1px 6px; border-radius: 4px; font-size: 0.8em; font-weight: 600; }

/* Storage details */
.storage-detail { color: var(--text-muted); font-size: 0.8em; margin-top: 4px; }
.storage-note { color: var(--text-muted); font-size: 0.8em; margin-top: 16px; font-style: italic; }
.storage-options { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.hint { color: var(--text-muted); font-size: 0.85em; margin-top: 4px; }

/* Mobile bottom nav */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; width: 100%; background: var(--bg-sidebar); border-top: 1px solid var(--border); z-index: 100; padding: 6px 0; padding-bottom: env(safe-area-inset-bottom, 6px); }
.mobile-nav ul { list-style: none; display: flex; justify-content: space-around; }
.mobile-nav li a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; color: var(--text-muted); text-decoration: none; font-size: 0.65em; cursor: pointer; transition: color 0.15s; }
.mobile-nav li a .nav-icon { font-size: 1.5em; line-height: 1; }
.mobile-nav li.active a { color: var(--primary); }
.mobile-nav li .nav-more { font-size: 0.7em; }

/* Responsive — Tablet */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .content { margin-left: 0; padding: 20px; }
  .mobile-nav { display: block; }
  .auth-page { padding: 20px; }

  /* Push content above bottom nav */
  .content { padding-bottom: 80px; }

  /* Stats: stack on narrow screens */
  .stats-grid { grid-template-columns: 1fr; }
}

/* Responsive — Mobile */
@media (max-width: 480px) {
  .content { padding: 16px 12px 80px; }
  .auth-card { padding: 24px; }
  .page h1 { font-size: 1.4em; }
  .stat-value { font-size: 1.5em; }
  .action-grid { flex-direction: column; }
  .action-btn { text-align: center; }
  .device-item { flex-wrap: wrap; }
  .device-item .btn { margin-top: 8px; }
}
