/* ===========================================
   Opinionate - Styles
   =========================================== */

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Dark earthy/warm palette - not typical AI blue */
  --bg-primary: #1c1917;
  --bg-secondary: #292524;
  --bg-tertiary: #3f3a36;
  --bg-hover: #44403c;
  --text-primary: #e7e5e4;
  --text-secondary: #a8a29e;
  --text-muted: #78716c;
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-subtle: #451a03;
  --border: #44403c;
  --danger: #b91c1c;
  --danger-hover: #991b1b;
  
  /* Tier colors - muted, less saturated */
  --tier-s: #fbbf24;
  --tier-a: #f87171;
  --tier-b: #fb923c;
  --tier-c: #a3e635;
  --tier-d: #38bdf8;
  --tier-f: #6b7280;
  --tier-unsorted: #3f3a36;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

/* ===========================================
   Landing Page
   =========================================== */

.landing-container {
  flex: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 80px 24px;
  text-align: center;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo svg {
  color: var(--accent);
}

.logo h1,
.landing-container h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.subtitle {
  color: var(--text-secondary);
  margin-bottom: 48px;
  font-size: 1rem;
}

.name-section {
  margin-bottom: 40px;
}

.name-section label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.name-section input {
  width: 100%;
  max-width: 280px;
  padding: 10px 16px;
  font-size: 0.9375rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  text-align: center;
  transition: border-color 0.15s;
}

.name-section input:focus {
  outline: none;
  border-color: var(--accent);
}

.name-section input::placeholder {
  color: var(--text-muted);
}

.room-actions {
  display: flex;
  gap: 24px;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
}

.action-card {
  background: var(--bg-secondary);
  padding: 32px 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  min-width: 220px;
  flex: 1;
  max-width: 280px;
}

.card-icon {
  margin-bottom: 16px;
  color: var(--text-secondary);
}

.action-card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.action-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

.divider {
  color: var(--text-muted);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
}

#roomCode {
  width: 100%;
  padding: 10px;
  font-size: 1.25rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  margin-bottom: 16px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

#roomCode:focus {
  outline: none;
  border-color: var(--accent);
}

#roomCode::placeholder {
  color: var(--text-muted);
  letter-spacing: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-small {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.btn-icon:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-icon svg {
  display: block;
}

.error-message {
  color: #ef4444;
  margin-top: 24px;
  font-size: 0.875rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.error-message.visible {
  opacity: 1;
}

/* ===========================================
   Room Page
   =========================================== */

.room-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-wrap: wrap;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo-small {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9375rem;
}

.logo-small svg {
  color: var(--accent);
}

.room-code {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

.room-code .room-label {
  color: var(--text-muted);
}

.room-code #roomCodeDisplay {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 2px;
  font-family: 'SF Mono', 'Consolas', monospace;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.users-list {
  display: flex;
  gap: 6px;
}

.user-badge {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  color: white;
  position: relative;
  cursor: default;
}

.user-tooltip {
  position: absolute;
  bottom: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  border: 1px solid var(--border);
  z-index: 10;
}

.user-badge:hover .user-tooltip {
  opacity: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main Content */
.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 180px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.paste-zone {
  padding: 28px 16px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.paste-zone:hover,
.paste-zone:focus {
  background: var(--bg-tertiary);
  outline: none;
}

.paste-zone.drag-active {
  background: var(--bg-tertiary);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.paste-zone.loading {
  opacity: 0.5;
  pointer-events: none;
}

.paste-icon {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.paste-icon svg {
  display: inline-block;
}

.paste-zone p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

.paste-hint {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  margin-top: 4px !important;
}

.sidebar-images {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Tier Area */
.tier-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: var(--bg-primary);
}

.tier-row {
  display: flex;
  margin-bottom: 4px;
  min-height: 72px;
  border-radius: 4px;
  overflow: hidden;
}

.tier-label {
  width: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.025em;
}

.tier-content {
  flex: 1;
  background: var(--bg-secondary);
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
  padding: 8px;
  min-height: 72px;
}

/* Tier Colors */
.tier-s { background: var(--tier-s); color: #1c1917; }
.tier-a { background: var(--tier-a); color: #1c1917; }
.tier-b { background: var(--tier-b); color: #1c1917; }
.tier-c { background: var(--tier-c); color: #1c1917; }
.tier-d { background: var(--tier-d); color: #1c1917; }
.tier-f { background: var(--tier-f); color: #fff; }
.unsorted-label { 
  background: var(--tier-unsorted); 
  color: var(--text-secondary); 
  font-size: 0.6875rem; 
  font-weight: 600;
  letter-spacing: 0.05em;
}

.unsorted-row {
  margin-bottom: 16px;
  border: 1px dashed var(--border);
  border-radius: 4px;
}

.unsorted-row .tier-content {
  background: transparent;
}

/* Tier Images */
.tier-image {
  width: 64px;
  height: 64px;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  transition: transform 0.1s;
  background: var(--bg-tertiary);
}

.tier-image:hover {
  transform: scale(1.05);
}

.tier-image:active {
  cursor: grabbing;
}

.tier-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 3px;
  background: rgba(185, 28, 28, 0.9);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.tier-image:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: var(--danger);
}

/* Hide elements during export */
body.exporting .delete-btn,
body.exporting .room-header,
body.exporting .sidebar {
  display: none !important;
}

body.exporting .tier-area {
  padding: 24px;
}

/* SortableJS Classes */
.sortable-ghost {
  opacity: 0.3;
}

.sortable-chosen {
  box-shadow: 0 0 0 2px var(--accent);
}

.sortable-drag {
  opacity: 1 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ===========================================
   Remote Cursors
   =========================================== */

#cursorsContainer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

.remote-cursor {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.05s linear;
}

.cursor-pointer {
  width: 16px;
  height: 16px;
  border: 2px solid;
  border-radius: 50%;
}

.cursor-label {
  position: absolute;
  left: 18px;
  top: -2px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  color: white;
  white-space: nowrap;
}

.drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  width: 56px;
  height: 56px;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.6;
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.05s linear;
}

.drag-ghost img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ===========================================
   Toast Notifications
   =========================================== */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 10000;
}

.toast {
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.2s;
}

.toast.visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-success {
  border-left: 3px solid #22c55e;
}

.toast-error {
  border-left: 3px solid #ef4444;
}

.toast-warning {
  border-left: 3px solid #eab308;
}

.toast-info {
  border-left: 3px solid #3b82f6;
}

/* ===========================================
   Responsive
   =========================================== */

@media (max-width: 768px) {
  .room-header {
    flex-direction: column;
    text-align: center;
    padding: 12px 16px;
  }
  
  .header-left, .header-right {
    width: 100%;
    justify-content: center;
  }
  
  .sidebar {
    width: 140px;
  }
  
  .tier-label {
    width: 48px;
    font-size: 1.125rem;
  }
  
  .unsorted-label {
    font-size: 0.5625rem;
  }
  
  .tier-image {
    width: 52px;
    height: 52px;
  }
}

@media (max-width: 480px) {
  .main-content {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    flex-direction: row;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .paste-zone {
    padding: 16px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
  }
  
  .sidebar-images {
    flex-direction: row;
    overflow-x: auto;
  }
  
  .room-actions {
    flex-direction: column;
  }
  
  .action-card {
    max-width: 100%;
  }
  
  .divider {
    margin: 8px 0;
  }
}

/* ===========================================
   Scrollbar Styling
   =========================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ===========================================
   Landing Page Footer
   =========================================== */

.landing-footer {
  margin-top: auto;
  padding: 30px 20px;
  background: linear-gradient(180deg, rgba(42, 42, 42, 0) 0%, rgba(42, 42, 42, 0.5) 100%);
  border-top: 1px solid rgba(78, 205, 196, 0.2);
}

.footer-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.footer-proprietor {
  font-size: 0.95rem;
  color: #ddd;
  margin-bottom: 8px;
}

.footer-proprietor strong {
  color: var(--accent);
  font-weight: 600;
}

.footer-tagline {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 20px;
}

.footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: #45B7D1;
  text-decoration: underline;
}

.footer-links .separator {
  color: #666;
  user-select: none;
}

@media (max-width: 600px) {
  .landing-footer {
    margin-top: 40px;
    padding: 25px 15px;
  }
  
  .footer-proprietor {
    font-size: 0.9rem;
  }
  
  .footer-links {
    gap: 8px;
  }
  
  .footer-links a {
    font-size: 0.85rem;
  }
}

/* ===========================================
   Consent Checkbox Section
   =========================================== */

.consent-section {
  margin: 25px auto;
  max-width: 450px;
}

.consent-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.consent-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  flex-shrink: 0;
}

.consent-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.consent-checkbox .checkmark {
  display: block;
  height: 20px;
  width: 20px;
  background-color: #1a1a1a;
  border: 2px solid #4a4a4a;
  border-radius: 4px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.consent-checkbox:hover .checkmark {
  border-color: var(--accent);
}

.consent-checkbox input[type="checkbox"]:checked ~ .checkmark {
  background-color: var(--accent);
  border-color: var(--accent);
}

.consent-checkbox .checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #1a1a1a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.consent-checkbox input[type="checkbox"]:checked ~ .checkmark:after {
  display: block;
}

.consent-text {
  color: #ddd;
  font-size: 0.9rem;
  line-height: 1.5;
  flex: 1;
}

.consent-text a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  z-index: 1000;
  pointer-events: auto !important;
  display: inline-block;
}

.consent-text a:hover {
  color: #45B7D1;
  text-decoration: underline;
  text-shadow: 0 0 8px rgba(78, 205, 196, 0.3);
}

@media (max-width: 600px) {
  .consent-section {
    margin: 20px 15px;
  }
  
  .consent-wrapper {
    gap: 10px;
  }
  
  .consent-text {
    font-size: 0.85rem;
  }
}
