/* PhillyXR - Dark Theme */
:root {
  /* Dark backgrounds - various shades of black */
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #2a2a2a;
  --bg-card: #1f1f1f;
  --bg-hover: #2f2f2f;
  
  /* Accent - Red */
  --accent: #ff3333;
  --accent-dark: #cc0000;
  --accent-light: #ff6666;
  --accent-hover: #ff5555;
  
  /* Text colors - light */
  --text-primary: #ffffff;
  --text-secondary: #e0e0e0;
  --text-muted: #b0b0b0;
  
  /* Borders and dividers */
  --border-color: #333333;
  --border-light: #444444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  background: var(--bg-primary);
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  background-attachment: fixed;
  line-height: 1.6;
  min-height: 100vh;
}

/* Header - Dark with red accent */
header {
  background: #010101;
  color: var(--text-primary);
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  border-bottom: 2px solid var(--accent);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  min-height: 80px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
}

/* Logo is ALWAYS absolutely centered, regardless of other elements */
.header-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}

/* Back button positioned separately, doesn't affect logo centering */
.header-content .btn-back-header {
  position: relative;
  z-index: 10;
}

/* Back button in header */
.btn-back-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-radius: 50%;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: bold;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.btn-back-header:hover {
  background: var(--accent);
  color: var(--text-primary);
  transform: scale(1.1) rotate(-5deg);
  box-shadow: 0 4px 12px rgba(255, 51, 51, 0.4);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  background: var(--bg-primary);
  min-height: calc(100vh - 200px);
}

/* Hero Section - Dark background */
.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-secondary);
  border-radius: 16px;
  margin-bottom: 3rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 30% 50%, rgba(255, 51, 51, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

.hero h2 {
  color: var(--text-primary);
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.hero h2::after {
  content: '';
  display: block;
  width: 100px;
  height: 3px;
  background: var(--accent);
  margin: 1rem auto 0;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 800px;
  margin: 0 auto;
  line-height: 1.8;
  position: relative;
  z-index: 1;
}

/* About Section */
.about {
  background: var(--bg-secondary);
  padding: 3rem 2rem;
  border-radius: 12px;
  margin-bottom: 3rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
}

.about h2 {
  color: var(--text-primary);
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.5rem;
  display: inline-block;
}

.about p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.about p:last-child {
  margin-bottom: 0;
}

/* Models Section */
.models-section {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--bg-primary);
  border-radius: 16px;
}

.models-section h2 {
  color: var(--text-primary);
  font-size: 2rem;
  margin-bottom: 2rem;
  font-weight: 700;
  text-align: center;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1rem;
  display: inline-block;
  width: 100%;
}

/* Model Grid */
.models-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.model-card {
  background: var(--bg-card);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  border: 1px solid var(--border-color);
  position: relative;
}

.model-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.model-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(255, 51, 51, 0.3);
  border-color: var(--accent);
  background: var(--bg-hover);
}

.model-card:hover::before {
  opacity: 1;
}

.model-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg-tertiary);
  transition: transform 0.3s ease;
  filter: brightness(0.9);
}

.model-card:hover .model-card-image {
  transform: scale(1.05);
  filter: brightness(1);
}

.model-card-content {
  padding: 1.5rem;
  background: var(--bg-card);
}

.model-card-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  transition: all 0.3s ease;
}

.model-card:hover .model-card-title {
  color: var(--accent);
  transform: translateX(4px);
}

.model-card-location {
  color: var(--text-secondary);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  margin-top: 0.5rem;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.model-card:hover .model-card-location {
  background: var(--bg-secondary);
  border-color: var(--accent);
  color: var(--text-primary);
  transform: translateX(4px);
}

.model-card-location::before {
  content: "📍";
  font-size: 1rem;
}

/* Model Viewer Page */
.model-viewer-container {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  display: block;
  overflow: visible;
  min-height: auto;
  border: 1px solid var(--border-color);
}

.model-viewer-container > * {
  position: relative;
  z-index: auto;
}

.model-viewer-wrapper {
  width: 100%;
  height: 500px;
  margin: 2rem 0;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  position: relative;
  display: block;
}

model-viewer {
  width: 100%;
  height: 100%;
  display: block;
}

/* Hide default AR button in model-viewer shadow DOM */
model-viewer::part(default-ar-button),
model-viewer::part(ar-button) {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.model-info {
  margin-top: 0;
  margin-bottom: 1rem;
}

.model-title {
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.model-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.model-location {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
  border: 1px solid var(--border-color);
}

.model-location h3 {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.model-location p {
  color: var(--text-secondary);
}

/* Buttons - Red accent */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.btn-primary {
  background: var(--accent);
  color: var(--text-primary);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 51, 51, 0.5);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 51, 51, 0.3);
}

.btn-back {
  margin-bottom: 2rem;
  display: inline-block;
}

/* Model Details Section */
.model-details {
  margin-top: 2rem;
  padding-top: 2rem;
  display: block !important;
  width: 100%;
  clear: both;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative;
  z-index: 1;
}

.model-description-section {
  margin-bottom: 2rem;
}

.model-description-section p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1rem;
}

.model-description {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
}

/* AR Instructions */
.ar-instructions {
  background: var(--bg-tertiary);
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 2rem;
  border-left: 4px solid var(--accent);
  border: 1px solid var(--border-color);
}

.ar-instructions h3 {
  color: var(--accent);
  margin-bottom: 1rem;
}

.ar-instructions ul {
  list-style: none;
  padding-left: 0;
}

.ar-instructions li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
}

.ar-instructions li:before {
  content: "→ ";
  color: var(--accent);
  font-weight: bold;
}

/* Photo Confirmation */
.photo-confirmation {
  display: none;
  background: var(--accent);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
  text-align: center;
  font-weight: 600;
}

.photo-confirmation.show {
  display: block;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 600;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 2px dashed var(--accent);
}

.loading::before {
  content: "⏳ ";
  display: inline-block;
  margin-right: 0.5rem;
  animation: pulse 1.5s ease-in-out infinite;
  font-size: 1.3rem;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

/* Model Loading Indicator */
.model-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 10;
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  color: var(--text-primary);
  border: 2px solid var(--accent);
}

.model-loading-spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.model-loading-text {
  color: var(--text-primary);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.model-loading-progress {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
}

/* Duplicate removed - position: relative already set above */

.model-loading.hidden {
  display: none;
}

/* Custom AR Button */
.custom-ar-button {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: var(--accent) !important;
  color: var(--text-primary) !important;
  border: none !important;
  border-radius: 24px !important;
  padding: 12px 20px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  box-shadow: 0 4px 12px rgba(255, 51, 51, 0.4) !important;
  transition: all 0.3s ease !important;
  font-family: inherit !important;
  z-index: 10 !important;
}

.custom-ar-button:hover {
  background: var(--accent-hover) !important;
  transform: scale(1.05) !important;
  box-shadow: 0 6px 16px rgba(255, 51, 51, 0.5) !important;
}

.custom-ar-button:active {
  transform: scale(0.95) !important;
}

.custom-ar-button svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.custom-ar-button span {
  display: inline-block;
}

@media (max-width: 768px) {
  .custom-ar-button {
    padding: 10px 16px !important;
    font-size: 13px !important;
  }
  
  .custom-ar-button svg {
    width: 18px;
    height: 18px;
  }
}

/* Error State */
.error {
  background: #ffebee;
  color: #c62828;
  padding: 1rem;
  border-radius: 6px;
  margin: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    padding: 0.75rem 1rem;
  }
  
  .header-content {
    min-height: 60px;
    padding: 0 0.5rem;
  }
  
  .header-logo {
    height: 100%;
  }
  
  .btn-back-header {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
  }
  
  .models-grid {
    grid-template-columns: 1fr;
  }
  
  .model-viewer-wrapper {
    height: 400px;
  }
  
  .model-title {
    font-size: 1.5rem;
  }
  
  .container {
    padding: 1.5rem 1rem;
  }
}

/* Admin Styles */
.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

.admin-header {
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 1.5rem;
  border-radius: 8px 8px 0 0;
  margin-bottom: 0;
  border-bottom: 2px solid var(--accent);
}

.admin-content {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  color: var(--text-primary);
}

.admin-form {
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.models-list {
  margin-top: 2rem;
}

.model-item {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border-color);
}

.model-item-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.model-item-thumb {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.model-item-details h3 {
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.model-item-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

.btn-danger {
  background: #c62828;
  color: var(--text-primary);
}

.btn-danger:hover {
  background: #b71c1c;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .model-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .model-item-actions {
    width: 100%;
    margin-top: 1rem;
  }
  
  .model-item-actions .btn {
    flex: 1;
  }
}

/* Admin Loading Overlay */
.admin-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.admin-loading-content {
  background: var(--bg-secondary);
  padding: 3rem;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  text-align: center;
  border: 2px solid var(--accent);
  min-width: 300px;
  max-width: 90%;
}

.admin-loading-overlay.hidden {
  opacity: 0;
  transition: opacity 0.3s ease-out;
  pointer-events: none;
}