/* Tabletop Page Styles */

/* Additional CSS Variables */
:root {
  --surface-light: #f8f9fa;
  --surface-dark: #2d3748;
  --border-dark: #4a5568;
  --text-muted: #6b7280;
  --border-hover: #d1d5db;
  --danger-50: #fef2f2;
  --danger-200: #fecaca;
  --danger-700: #b91c1c;
  --warning-50: #fffbeb;
  --warning-200: #fed7aa;
  --warning-700: #b45309;
  --success-50: #f0fdf4;
  --success-200: #bbf7d0;
  --success-700: #15803d;
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.tabletop-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Page Header */
.tabletop-header {
  text-align: center;
  margin-bottom: var(--space-6);
  padding: var(--space-6);
  background: #ffffff !important;
  border-radius: var(--radius-lg);
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.tabletop-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  color: #1d4ed8 !important;
  -webkit-text-fill-color: #1d4ed8 !important;
  background: none !important;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
}

.tabletop-subtitle {
  color: #4b5563 !important;
  font-size: 1.125rem;
  margin-bottom: var(--space-6);
}

/* Room Info */
.room-info {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
  display: none;
}

.room-info.show {
  display: block;
}

.room-info-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.room-info-content {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.room-share-link {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface-light);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.copy-button {
  flex-shrink: 0;
  padding: var(--space-3);
  min-width: auto;
  background: var(--primary-500);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.copy-button:hover {
  background: var(--primary-600);
  transform: translateY(-1px);
}

/* Toolbar */
.tabletop-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: #ffffff !important;
  border: 1px solid #e5e7eb !important;
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2);
}

.toolbar-separator {
  width: 1px;
  height: 32px;
  background: #d1d5db !important;
  margin: 0 var(--space-2);
}

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.connection-status svg {
  stroke: currentColor !important;
}

.connection-status.connected {
  background: #f0fdf4 !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0 !important;
}

.connection-status.connecting {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1px solid #fed7aa !important;
}

.connection-status.disconnected {
  background: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
}

/* Toolbar Buttons */
.toolbar-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid #d1d5db !important;
  background: #ffffff !important;
  color: #1f2937 !important;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 40px;
}

.toolbar-button svg {
  color: #4b5563 !important;
  stroke: #4b5563 !important;
}

.toolbar-button:hover {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #1d4ed8 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.toolbar-button:hover svg {
  color: #1d4ed8 !important;
  stroke: #1d4ed8 !important;
}

.toolbar-button:active {
  transform: translateY(0);
}

.toolbar-button.active {
  background: #3b82f6 !important;
  color: white !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.toolbar-button.active svg {
  color: white !important;
  stroke: white !important;
}

.toolbar-button:focus {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

/* Toolbar Inputs */
.toolbar-input-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: #ffffff !important;
  border: 1px solid #d1d5db !important;
  border-radius: var(--radius-md);
  min-height: 40px;
}

.toolbar-input-group label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #1f2937 !important;
  white-space: nowrap;
}

.toolbar-input-group svg {
  color: #6b7280 !important;
  stroke: #6b7280 !important;
}

.toolbar-input-group input[type="color"] {
  border: none;
  background: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  padding: 0;
}

.toolbar-input-group input[type="range"] {
  width: 80px;
  height: 6px;
  border-radius: 3px;
  background: var(--border-light);
  outline: none;
  cursor: pointer;
}

.toolbar-input-group input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-500);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.toolbar-input-group input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary-500);
  cursor: pointer;
  border: none;
  box-shadow: var(--shadow-sm);
}

/* Canvas Container */
.tabletop-canvas-container {
  position: relative;
  width: 100%;
  height: calc(100vh - 400px);
  min-height: 600px;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(45deg, #f8f9fa 25%, transparent 25%), 
              linear-gradient(-45deg, #f8f9fa 25%, transparent 25%), 
              linear-gradient(45deg, transparent 75%, #f8f9fa 75%), 
              linear-gradient(-45deg, transparent 75%, #f8f9fa 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  box-shadow: var(--shadow-lg);
}

.tabletop-canvas {
  display: block;
  cursor: crosshair;
  width: 100%;
  height: 100%;
}

/* Token Controls */
.token-controls {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-lg);
  z-index: 20;
  display: none;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}

.token-controls.show {
  display: block;
}

.token-controls button {
  margin-right: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-light);
  background: var(--surface-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.token-controls button:hover {
  background: var(--primary-50);
  border-color: var(--primary-200);
  color: var(--primary-700);
}

.token-controls button:last-child {
  margin-right: 0;
}

/* Modal Styles */
.tabletop-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.tabletop-modal.show {
  display: flex;
}

.tabletop-modal-content {
  background: var(--surface);
  padding: var(--space-8);
  border-radius: var(--radius-2xl);
  max-width: 500px;
  width: 90%;
  position: relative;
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--border-light);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--surface-light);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Form Styles */
.tabletop-form-group {
  margin-bottom: var(--space-4);
}

.tabletop-form-label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
}

.tabletop-form-input {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  background: var(--surface-light);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.tabletop-form-input:focus {
  outline: none;
  border-color: var(--primary-300);
  box-shadow: 0 0 0 3px var(--primary-100);
}

.tabletop-form-input::placeholder {
  color: var(--text-muted);
}

.tabletop-form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.tabletop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 44px;
}

.tabletop-btn-primary {
  background: var(--primary-500);
  color: white;
  border-color: var(--primary-500);
}

.tabletop-btn-primary:hover {
  background: var(--primary-600);
  border-color: var(--primary-600);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.tabletop-btn-secondary {
  background: var(--surface-light);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.tabletop-btn-secondary:hover {
  background: var(--surface);
  border-color: var(--border-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.tabletop-btn:focus {
  outline: 2px solid var(--primary-300);
  outline-offset: 2px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .tabletop-toolbar {
    padding: var(--space-3);
    gap: var(--space-1);
  }
  
  .toolbar-section {
    padding: 0 var(--space-1);
  }
  
  .toolbar-button {
    padding: var(--space-2);
    font-size: 0.8rem;
    min-height: 36px;
  }
  
  .toolbar-input-group {
    padding: var(--space-2);
    min-height: 36px;
  }
}

@media (max-width: 768px) {
  .tabletop-container {
    padding: 0 16px;
  }
  
  .tabletop-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    position: relative;
  }
  
  .toolbar-section {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .toolbar-separator {
    display: none;
  }
  
  .tabletop-canvas-container {
    height: calc(100vh - 500px);
    min-height: 400px;
  }
  
  .tabletop-modal-content {
    padding: var(--space-6);
    margin: var(--space-4);
  }
  
  .tabletop-form-actions {
    flex-direction: column;
  }
  
  .tabletop-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .tabletop-title {
    font-size: 1.75rem;
  }
  
  .tabletop-subtitle {
    font-size: 1rem;
  }
  
  .toolbar-button {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-2);
  }
  
  .toolbar-input-group label {
    font-size: 0.8rem;
  }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
  .tabletop-modal-content {
    animation: none;
  }
  
  .toolbar-button,
  .tabletop-btn {
    transition: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .tabletop-toolbar {
    border-width: 2px;
  }
  
  .toolbar-button {
    border-width: 2px;
  }
  
  .tabletop-canvas-container {
    border-width: 3px;
  }
}

/* Dark mode support - DISABLED for tabletop toolbar to ensure readability */
/* Force light theme for toolbar regardless of system preference */
@media (prefers-color-scheme: dark) {
  .tabletop-header {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
  }
  
  .tabletop-title {
    color: #1d4ed8 !important;
    -webkit-text-fill-color: #1d4ed8 !important;
  }
  
  .tabletop-subtitle {
    color: #4b5563 !important;
  }
  
  .tabletop-toolbar {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
  }
  
  .toolbar-button {
    background: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
  }
  
  .toolbar-button svg {
    color: #4b5563 !important;
    stroke: #4b5563 !important;
  }
  
  .toolbar-button:hover {
    background: #eff6ff !important;
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
  }
  
  .toolbar-button:hover svg {
    color: #1d4ed8 !important;
    stroke: #1d4ed8 !important;
  }
  
  .toolbar-button.active {
    background: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
  }
  
  .toolbar-button.active svg {
    color: white !important;
    stroke: white !important;
  }
  
  .toolbar-input-group {
    background: #ffffff !important;
    border-color: #d1d5db !important;
  }
  
  .toolbar-input-group label {
    color: #1f2937 !important;
  }
  
  .toolbar-input-group svg {
    color: #6b7280 !important;
    stroke: #6b7280 !important;
  }
  
  .toolbar-separator {
    background: #d1d5db !important;
  }
  
  .tabletop-modal-content {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
  }
  
  .token-controls {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
  }
  
  .token-controls button {
    background: #ffffff !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
  }
  
  .token-controls button:hover {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
  }
  
  .room-info {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
  }
  
  .room-share-link {
    background: #f8f9fa !important;
    border-color: #d1d5db !important;
    color: #1f2937 !important;
  }
}
