/* Pattern Playground - Admin Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
}

/* App Header */
.app-header {
  background: #1f515b;
  color: #fff;
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-header .app-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-logo {
  font-size: 1.3em;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.app-nav a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.9em;
}

.app-nav a:hover { color: #fff; }

.app-user {
  color: rgba(255,255,255,0.6);
  font-size: 0.85em;
}

.app-main {
  padding: 30px 0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  background: #1f515b;
  color: #fff;
  border: 2px solid #1f515b;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
}

.btn:hover { background: #163d44; border-color: #163d44; }

.btn-small {
  padding: 6px 14px;
  font-size: 0.8em;
}

.btn-outline {
  background: transparent;
  color: #1f515b;
}

.btn-outline:hover {
  background: #1f515b;
  color: #fff;
}

.btn-danger {
  background: #dc3545;
  border-color: #dc3545;
}

.btn-danger:hover { background: #c82333; border-color: #c82333; }

.btn-link {
  color: #1f515b;
  text-decoration: none;
  font-weight: 500;
}

.btn-link:hover { text-decoration: underline; }

/* Auth Pages */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
}

.auth-card {
  background: #fff;
  padding: 50px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.auth-card h1 {
  color: #1f515b;
  margin-bottom: 10px;
}

.auth-card p { color: #666; margin-bottom: 24px; }

.auth-card input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 1em;
  font-family: inherit;
  margin-bottom: 16px;
}

.auth-card input:focus {
  outline: none;
  border-color: #1f515b;
}

.auth-card .btn {
  width: 100%;
  padding: 14px;
  font-size: 1em;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9em;
}

.alert-error {
  background: #fef2f2;
  color: #dc3545;
  border: 1px solid #fecaca;
}

.status-msg {
  padding: 10px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 0.9em;
}

.status-msg.success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.status-msg.error { background: #fef2f2; color: #dc3545; border: 1px solid #fecaca; }

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 { font-size: 1.6em; color: #1f515b; }

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.upload-form input[type="file"] {
  font-size: 0.85em;
}

/* Pattern Grid */
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.pattern-card {
  background: #fff;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
}

.pattern-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.pattern-card h3 {
  font-size: 1.1em;
  color: #1f515b;
  margin-bottom: 6px;
  word-break: break-all;
}

.pattern-card .meta {
  font-size: 0.8em;
  color: #999;
  margin-bottom: 16px;
}

.card-actions {
  display: flex;
  gap: 6px;
}

.empty-state {
  text-align: center;
  padding: 60px;
  color: #999;
}

/* Editor */
.editor-page { max-width: 100%; padding: 0 20px; }

.editor-layout {
  display: flex;
  gap: 0;
  height: calc(100vh - 180px);
}

.editor-pane {
  flex: 1;
  min-width: 0;
}

.editor-pane.full-width { flex: 1; }

.preview-pane {
  flex: 1;
  min-width: 0;
  border-left: 2px solid #e0e0e0;
}

#jsonEditor {
  width: 100%;
  height: 100%;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.5;
  padding: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  resize: none;
  background: #1e1e2e;
  color: #cdd6f4;
  tab-size: 2;
}

#jsonEditor:focus {
  outline: none;
  border-color: #1f515b;
}

#previewFrame {
  width: 100%;
  height: 100%;
  border: none;
}

/* Responsive */
@media (max-width: 768px) {
  .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
  .editor-layout { flex-direction: column; height: auto; }
  .editor-pane, .preview-pane { height: 50vh; }
  .preview-pane { border-left: none; border-top: 2px solid #e0e0e0; }
  .pattern-grid { grid-template-columns: 1fr; }
}
