/* Chaosmotic Systems Wiki Editor Styles */

:root {
  --primary-color: #6366f1;
  --secondary-color: #8b5cf6;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --dark-bg: #0d1117;
  --darker-bg: #010409;
  --card-bg: #161b22;
  --border-color: #30363d;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --background-primary: #0d1117;
  --background-secondary: #161b22;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--background-primary);
  min-height: 100vh;
  color: var(--text-primary);
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

/* Login Screen */
.login-container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 2rem;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
  color: var(--text-primary);
}

.login-header h1 {
  font-size: 2.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.login-header p {
  font-size: 1rem;
  color: var(--text-secondary);
}

.login-form {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 400px;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background: var(--background-primary);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
  background: var(--card-bg);
  color: var(--text-primary);
}

.btn:hover {
  background: var(--background-secondary);
  border-color: var(--text-muted);
}

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

.btn-primary:hover {
  background: #5856eb;
  border-color: #5856eb;
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--background-secondary);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.btn-success:hover {
  background: #059669;
  border-color: #059669;
}

.btn-info {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.btn-info:hover {
  background: #2563eb;
  border-color: #2563eb;
}

.btn-warning {
  background: var(--warning-color);
  color: white;
  border-color: var(--warning-color);
}

.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 2px solid var(--border-color);
}

.btn-outline:hover {
  background: var(--light-bg);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Editor Screen */
#editor-screen {
  background: var(--light-bg);
}

.app-header {
  background: var(--card-bg);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left h1 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.user-info {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.publish-status-container {
  position: relative;
  margin-left: 1rem;
}

.publish-status {
  color: var(--warning-color);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.publish-status:hover {
  background-color: rgba(255, 193, 7, 0.1);
}

.publish-status.published {
  color: var(--success-color);
  cursor: default;
}

.publish-status.published:hover {
  background-color: transparent;
}

.publish-status-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  min-width: 300px;
  max-width: 400px;
  margin-top: 0.5rem;
}

.dropdown-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--background-secondary);
  border-radius: 0.5rem 0.5rem 0 0;
}

.pending-files-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.pending-files-list li {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pending-files-list li:last-child {
  border-bottom: none;
}

.file-status-icon {
  font-size: 0.75rem;
  width: 1rem;
  text-align: center;
}

.file-status-modified {
  color: var(--warning-color);
}

.file-status-new {
  color: var(--success-color);
}

.file-status-deleted {
  color: var(--danger-color);
}

.file-path {
  color: var(--text-primary);
  flex-grow: 1;
}

.file-path-dir {
  color: var(--text-secondary);
}

.header-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: var(--card-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
}

.file-list {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.file-item {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.15s;
  color: var(--text-primary);
}

.file-item:hover {
  background: var(--background-secondary);
}

.file-item.active {
  background: var(--primary-color);
  color: white;
}

.file-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.file-meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.file-item.active .file-meta {
  color: rgba(255,255,255,0.8);
}

/* Editor Main Area */
.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.welcome {
  padding: 3rem 2rem;
  text-align: center;
  background: var(--card-bg);
  margin: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
}

.welcome h2 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.welcome p {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 2rem;
}

.welcome-help {
  background: var(--background-secondary);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin: 2rem 0;
  border-left: 4px solid var(--primary-color);
}

.welcome-help h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.welcome-help p {
  margin-bottom: 1rem;
  font-size: 1rem;
}

.help-examples {
  display: grid;
  gap: 1rem;
}

.help-example {
  background: white;
  padding: 1rem;
  border-radius: 0.25rem;
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  line-height: 1.5;
}

.help-example code {
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  color: var(--primary-color);
  font-weight: 600;
}

.welcome-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Welcome Screen Instruction Styles */
.welcome-section {
  margin: 2rem 0;
  text-align: left;
}

.welcome-section h3 {
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary-color);
  padding-left: 1rem;
}

.instruction-list {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.instruction-list li {
  margin: 0.75rem 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

.syntax-examples, .formatting-grid {
  background: var(--background-secondary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
}

.syntax-example, .format-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.syntax-example:last-child, .format-item:last-child {
  border-bottom: none;
}

.syntax-result {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.formatting-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.format-item span {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.workflow-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.workflow-step {
  background: var(--primary-color);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.workflow-arrow {
  color: var(--text-secondary);
  font-weight: bold;
}

.workflow-note {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 1rem;
}

.nav-instructions {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.nav-instructions li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
}

.nav-instructions li:last-child {
  border-bottom: none;
}

/* Editor Container */
#editor-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: white;
  margin: 1rem;
  border-radius: 1rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  overflow: hidden;
}

.editor-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.file-title-input {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  font-size: 1.125rem;
  font-weight: 600;
  background: var(--background-primary);
  color: var(--text-primary);
}

.file-title-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: var(--card-bg);
}

.editor-controls {
  display: flex;
  gap: 0.75rem;
}

.editor-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.editor-toolbar {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 0.5rem;
}

.tool-btn {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  background: white;
  border-radius: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.tool-btn:hover {
  background: var(--light-bg);
  border-color: var(--primary-color);
}

.tool-btn[data-action="wikilink"] {
  background: var(--primary-color);
  color: white;
  font-weight: bold;
}

.tool-btn[data-action="wikilink"]:hover {
  background: #5856eb;
}

.markdown-editor {
  flex: 1;
  padding: 1.5rem;
  border: none;
  resize: none;
  font-family: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  outline: none;
  background: var(--background-primary);
  color: var(--text-primary);
}

.preview-pane {
  flex: 1;
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
}

.preview-content {
  padding: 1.5rem;
  line-height: 1.8;
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
  color: var(--primary-color);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.preview-content h1:first-child,
.preview-content h2:first-child,
.preview-content h3:first-child {
  margin-top: 0;
}

.preview-content p {
  margin-bottom: 1rem;
}

.preview-content ul,
.preview-content ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

.preview-content a {
  color: var(--primary-color);
  text-decoration: none;
}

.preview-content a:hover {
  text-decoration: underline;
}

.preview-placeholder {
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
  margin-top: 2rem;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 0.75rem;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 500px;
  margin: 1rem;
}

.modal-content h3 {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 2rem;
  right: 2rem;
  z-index: 3000;
}

.toast {
  background: var(--card-bg);
  color: var(--text-primary);
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 15px rgba(0,0,0,0.3);
  margin-bottom: 1rem;
  border-left: 4px solid var(--success-color);
  animation: slideIn 0.3s ease-out;
}

.toast.error {
  border-left-color: var(--danger-color);
}

.toast.warning {
  border-left-color: var(--warning-color);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Error Messages */
.error-message {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  text-align: center;
}

/* GitHub OAuth Login Styles */
.login-divider {
  margin: 1.5rem 0;
  text-align: center;
  position: relative;
}

.login-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
}

.login-divider span {
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 0 1rem;
  position: relative;
}

.btn-github {
  width: 100%;
  background: #24292f;
  color: white;
  border-color: #24292f;
  justify-content: center;
  text-decoration: none;
}

.btn-github:hover {
  background: #1c2128;
  border-color: #1c2128;
  color: white;
}

.btn-github svg {
  margin-right: 0.5rem;
}

/* Tooltip styling removed - using browser default tooltips only */

/* Info toast styling */
.toast.info {
  border-left-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    max-height: 200px;
  }
  
  .editor-content {
    flex-direction: column;
  }
  
  .preview-pane {
    border-left: none;
    border-top: 1px solid var(--border-color);
    max-height: 300px;
  }
  
  .editor-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .editor-controls {
    justify-content: center;
  }
}