/**
 * here.is Dashboard - Xerox Star Aesthetic
 *
 * Design Principles:
 * - Monochrome palette with paper-like backgrounds
 * - Square corners (no rounded edges)
 * - Monospace font for URLs and usernames
 * - Clean, functional typography
 * - Minimal visual noise
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Light theme - paper metaphor */
  --background: #ffffff;
  --foreground: #141414;

  --card: #fafafa;
  --card-foreground: #141414;

  --muted: #f5f5f5;
  --muted-foreground: #737373;

  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #141414;

  --destructive: #dc2626;
  --destructive-bg: #fef2f2;
}

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

body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--foreground);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

::selection {
  background: var(--foreground);
  color: var(--background);
}

/* Header */
.header {
  background: var(--background);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--foreground);
  text-decoration: none;
  letter-spacing: -0.025em;
}

.header-divider {
  color: var(--border);
}

.header-page {
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-link {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
}

.header-link:hover {
  color: var(--foreground);
}

.header-link.feedback {
  color: var(--destructive);
}

.logout-btn {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-family: inherit;
  transition: color 0.2s;
}

.logout-btn:hover {
  color: var(--foreground);
}

/* Layout with sidebar preview - centered like and.here.is */
.layout {
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 60px);
  max-width: 1200px;
  margin: 0 auto;
}

/* Main content area */
.main-content {
  flex: 1;
  max-width: 640px;
  padding: 0 2rem 2rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.2s;
}

.tab:hover {
  color: var(--foreground);
}

.tab.active {
  color: var(--foreground);
  border-bottom-color: var(--foreground);
}

.tab-icon {
  width: 1rem;
  height: 1rem;
}

/* Section header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Preview panel */
.preview-panel {
  width: 360px;
  padding: 1.5rem 2rem;
  border-left: 1px solid var(--border);
  background: var(--card);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.preview-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
}

.preview-open {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s;
}

.preview-open:hover {
  color: var(--foreground);
}

/* Preview frame - square corners */
.preview-frame {
  background: var(--background);
  border: 1px solid var(--border);
  padding: 2rem 1.5rem;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Preview avatar - square */
.preview-avatar {
  width: 64px;
  height: 64px;
  border: 1px solid var(--foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 1.125rem;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.preview-path {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.preview-links {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* Preview link - square corners */
.preview-link {
  padding: 0.75rem 1rem;
  border: 1px solid var(--foreground);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
}

.preview-link:hover {
  background: var(--foreground);
  color: var(--background);
  transform: translateX(4px);
}

.preview-empty {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.preview-footer {
  margin-top: auto;
  padding-top: 2rem;
  font-size: 0.6875rem;
  color: var(--border);
}

.preview-name {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.preview-bio {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
  text-align: center;
  max-width: 200px;
}

.preview-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Cards - square corners */
.card {
  background: var(--background);
  border: 1px dashed var(--border);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.card-solid {
  border-style: solid;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
}

.empty-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 1rem;
  color: var(--border);
}

.empty-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-text {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
}

/* Buttons - square corners */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: 1px solid var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-family: inherit;
}

.btn:hover {
  opacity: 0.85;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--foreground);
  color: var(--background);
}

.btn-primary:hover {
  background: transparent;
  color: var(--foreground);
}

.btn-secondary {
  background: var(--background);
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--foreground);
}

.btn-outline {
  background: transparent;
  color: var(--foreground);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--foreground);
}

.btn-danger {
  background: var(--destructive-bg);
  color: var(--destructive);
  border-color: transparent;
}

.btn-danger:hover {
  border-color: var(--destructive);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

/* Forms - square corners */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  font-family: inherit;
  background: transparent;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--foreground);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Modal - square corners */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--background);
  padding: 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--muted-foreground);
}

.modal-close:hover {
  color: var(--foreground);
}

.modal-body {
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Messages */
.error {
  background: var(--destructive-bg);
  color: var(--destructive);
  padding: 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.success {
  background: #f0fdf4;
  color: #16a34a;
  padding: 0.75rem;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Link card - matches and.here.is style */
.link-card {
  background: var(--background);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  padding: 1.25rem;
}

.link-card-content {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.link-info {
  flex: 1;
  min-width: 0;
}

.link-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.link-card-edit {
  width: 100%;
}

.edit-field {
  margin-bottom: 1rem;
}

.edit-field label {
  font-size: 0.8125rem;
  margin-bottom: 0.375rem;
}

.edit-actions {
  display: flex;
  gap: 0.5rem;
}

/* Legacy link-item support */
.link-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--background);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
}

/* Drag controls container */
.drag-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* 6-dot drag handle */
.drag-handle {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  grid-template-rows: repeat(3, 4px);
  gap: 3px;
  cursor: pointer;
  padding: 0.5rem;
}

.drag-handle .dot {
  width: 4px;
  height: 4px;
  background: var(--border);
  border-radius: 50%;
}

.drag-handle:hover .dot {
  background: var(--muted-foreground);
}

/* Move buttons */
.move-buttons {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Reload button */
.reload-btn {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  margin-left: 0.5rem;
  transition: color 0.2s;
}

.reload-btn:hover {
  color: var(--foreground);
}

.link-title {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  color: var(--foreground);
}

.link-url {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s;
}

.link-url:hover {
  color: var(--foreground);
}

/* Move buttons */
.move-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  color: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.move-btn:hover:not(.move-btn-disabled) {
  color: var(--foreground);
}

.move-btn-disabled {
  opacity: 0.3;
  cursor: default;
}

/* Toggle switch - compact size to match icons */
.toggle-switch {
  width: 32px;
  height: 18px;
  background: var(--border);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s;
  flex-shrink: 0;
}

.toggle-switch.toggle-on {
  background: var(--foreground);
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--background);
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.toggle-switch.toggle-on .toggle-knob {
  transform: translateX(14px);
}

/* Icon buttons */
.icon-btn {
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: color 0.15s, background-color 0.15s;
}

.icon-btn:hover {
  color: var(--foreground);
  background: var(--muted);
}

.icon-btn-danger:hover {
  color: var(--destructive);
  background: var(--destructive-bg);
}

/* URL Input combo - square corners */
.url-input-wrapper {
  display: flex;
  align-items: center;
  border: 1px solid var(--foreground);
  margin-bottom: 1rem;
}

.url-prefix {
  padding: 0.75rem 1rem;
  background: rgba(245, 245, 245, 0.3);
  border-right: 1px solid var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.url-input-field {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  outline: none;
  background: transparent;
  margin-bottom: 0;
}

.url-status {
  padding: 0 1rem;
  font-size: 1rem;
}

.url-status.available { color: var(--foreground); }
.url-status.taken { color: var(--destructive); }

/* Color pickers */
.color-picker-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.color-picker-label {
  flex: 1;
  font-size: 0.875rem;
}

.color-picker-input {
  width: 48px;
  height: 32px;
  border: 1px solid var(--border);
  padding: 2px;
  cursor: pointer;
  background: transparent;
}

.color-picker-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-input::-webkit-color-swatch {
  border: none;
}

/* Monospace utility */
.mono {
  font-family: var(--font-mono);
}

/* Minimal scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Auth pages specific */
.auth-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.auth-box {
  width: 100%;
  max-width: 400px;
  text-align: center;
}

.auth-logo {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 2rem;
  color: var(--foreground);
  text-decoration: none;
  display: block;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.auth-form {
  text-align: left;
}

.auth-form label {
  text-align: left;
}

.auth-form .btn {
  width: 100%;
  margin-top: 0.5rem;
}

.auth-footer {
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.auth-footer a {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-links {
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.auth-links a {
  color: inherit;
  text-decoration: none;
}

.auth-links a:hover {
  color: var(--foreground);
}

.forgot-password {
  text-align: right;
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}

.forgot-password a {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-decoration: none;
}

.forgot-password a:hover {
  color: var(--foreground);
}

/* Password visibility toggle */
.password-wrapper {
  position: relative;
}

.password-wrapper input {
  padding-right: 3rem;
}

.password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-75%);
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 0.25rem;
}

.password-toggle:hover {
  color: var(--foreground);
}

/* Responsive */
@media (max-width: 1024px) {
  .preview-panel {
    display: none;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 1rem;
  }

  .main-content {
    padding: 0 1rem 2rem;
  }

  .auth-container {
    padding: 1rem;
  }
}
