:root {
  --bg: #0f0f0f;
  --surface: #1a1a2e;
  --surface-hover: #222240;
  --primary: #00d4aa;
  --primary-hover: #00b894;
  --text: #e0e0e0;
  --text-muted: #888;
  --danger: #ff4757;
  --danger-hover: #e84143;
  --success: #2ed573;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --transition: 200ms ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 1.2rem; font-weight: 600; }
.header-right { display: flex; align-items: center; gap: 12px; }
.logo-icon { font-size: 1.4rem; }
.user-badge {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 20px;
}
.back-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
}

/* Container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #0f0f0f; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); }
.btn-ghost:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.btn-small { padding: 6px 12px; font-size: 0.8rem; }
.btn-full { width: 100%; justify-content: center; }
.btn kbd {
  font-family: inherit;
  font-size: 0.7rem;
  padding: 2px 6px;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  opacity: 0.7;
}

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
}
textarea {
  font-family: 'JetBrains Mono', monospace;
  resize: vertical;
  min-height: 100px;
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Login */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .logo-icon { font-size: 2.4rem; display: block; margin-bottom: 8px; }
.login-logo h1 { font-size: 1.6rem; }
.login-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  cursor: pointer;
}
.error-msg {
  margin-top: 16px;
  padding: 10px 14px;
  background: rgba(255,71,87,0.15);
  border: 1px solid rgba(255,71,87,0.3);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.85rem;
  text-align: center;
}

/* New Clip Section */
.new-clip-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.clip-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 12px;
}
.clip-options-left { display: flex; align-items: center; gap: 8px; }
.clip-options-left select { width: auto; min-width: 120px; }
.label-input { margin-top: 12px; }

/* Clips List */
.clips-list { display: flex; flex-direction: column; gap: 12px; }
.clip-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.clip-card:hover { background: var(--surface-hover); }
.clip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.clip-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.clip-label {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.85rem;
}
.clip-expiry {
  padding: 2px 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  font-size: 0.75rem;
}
.clip-expiry.expiring-soon { color: var(--danger); background: rgba(255,71,87,0.15); }
.clip-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 72px;
  overflow: hidden;
  position: relative;
  transition: max-height 0.3s ease;
}
.clip-content.expanded { max-height: none; }
.clip-content.truncated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(transparent, var(--surface));
}
.clip-card:hover .clip-content.truncated::after {
  background: linear-gradient(transparent, var(--surface-hover));
}
.clip-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.btn-copy { background: var(--primary); color: #0f0f0f; }
.btn-copy.copied { background: var(--success); }
.btn-delete { background: transparent; color: var(--danger); border: 1px solid rgba(255,71,87,0.3); }
.btn-delete:hover { background: rgba(255,71,87,0.15); }
.btn-expand { background: transparent; color: var(--text-muted); border: none; cursor: pointer; font-size: 0.8rem; padding: 4px 8px; }

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 3rem; display: block; margin-bottom: 12px; }

/* Admin */
.admin-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.admin-card h2 { font-size: 1.1rem; margin-bottom: 16px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.stat-item { text-align: center; }
.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); }

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  box-shadow: var(--shadow);
}
.toast-success { background: var(--success); color: #0f0f0f; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--surface); color: var(--text); border: 1px solid rgba(255,255,255,0.1); }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

/* Utilities */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .app-header { padding: 12px 16px; }
  .container { padding: 16px 12px; }
  .clip-options { flex-direction: column; align-items: stretch; }
  .clip-options-left { justify-content: space-between; }
  .btn kbd { display: none; }
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .clip-actions { flex-wrap: wrap; }
}
