/* OpenBuilder - Global Styles */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #020617;
  color: #e2e8f0;
  min-height: 100vh;
}

/* Reset */
ul, ol { list-style: none; margin: 0; padding: 0; }
a { color: inherit; }
button { font-family: inherit; }
input, textarea, select { font-family: inherit; }
h1,h2,h3,h4,h5,h6 { margin: 0; }
p { margin: 0; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-spin { animation: spin 1s linear infinite; }

/* Editor layout */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.editor-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Canvas container */
.canvas-container {
  flex: 1;
  overflow: auto;
  background: #1e293b;
  background-image: radial-gradient(circle at 1px 1px, rgba(99,102,241,0.12) 1px, transparent 0);
  background-size: 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

/* AI loading skeleton */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Tooltip */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.1);
  color: #e2e8f0;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
}
.tooltip:hover::after { opacity: 1; }

/* Grid responsive helpers */
@media (max-width: 768px) {
  .grid-footer {
    grid-template-columns: 1fr 1fr !important;
  }
}
@media (max-width: 480px) {
  .grid-footer {
    grid-template-columns: 1fr !important;
  }
}

/* Focus styles */
*:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Selection */
::selection {
  background: rgba(99,102,241,0.3);
  color: #e2e8f0;
}

/* Landing page specific */
.landing-gradient {
  background: linear-gradient(135deg, #020617 0%, #0f172a 50%, #1e1b4b 100%);
}

/* Feature card glow */
.feature-card:hover {
  box-shadow: 0 0 0 1px rgba(99,102,241,0.3), 0 20px 40px rgba(99,102,241,0.1);
}

/* Prose styles for preview */
.prose h1 { font-size: 2.5rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.prose h2 { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.prose h3 { font-size: 1.5rem; font-weight: 600; }
.prose p { font-size: 1rem; line-height: 1.7; color: #64748b; }
.prose ul { list-style: disc; padding-left: 1.5rem; }
.prose a { color: #6366f1; text-decoration: underline; }

/* Transition utilities */
.transition-all { transition: all 0.2s ease; }
.transition-transform { transition: transform 0.2s ease; }
.transition-opacity { transition: opacity 0.2s ease; }

/* Context menu */
.context-menu {
  position: fixed;
  background: #0f172a;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  padding: 6px;
  z-index: 9999;
  min-width: 160px;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #94a3b8;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.context-menu-item:hover {
  background: rgba(255,255,255,0.06);
  color: #e2e8f0;
}

.context-menu-item.danger:hover {
  background: rgba(239,68,68,0.1);
  color: #fca5a5;
}

/* Preview mode device frames */
.device-frame-mobile {
  border-radius: 36px;
  box-shadow: 0 0 0 8px #0f172a, 0 0 0 10px rgba(255,255,255,0.05), 0 30px 80px rgba(0,0,0,0.5);
}

.device-frame-tablet {
  border-radius: 20px;
  box-shadow: 0 0 0 6px #0f172a, 0 0 0 8px rgba(255,255,255,0.05), 0 25px 60px rgba(0,0,0,0.4);
}

/* Status badge */
.badge-live { 
  display: inline-flex; 
  align-items: center; 
  gap: 5px; 
}
.badge-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
  animation: pulse 2s infinite;
}
