/* Remark Dashboard Styles */

:root {
  --color-bg: #f7fafc;
  --color-sidebar: #1a202c;
  --color-card: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #2d3748;
  --color-text-muted: #718096;
  --color-primary: #4299e1;
  --color-primary-dark: #3182ce;
  --color-danger: #e53e3e;
  --color-success: #48bb78;
  --color-input-bg: #ffffff;
  --sidebar-width: 240px;
  --sidebar-narrow: 200px;
}

/* Dark theme */
[data-theme="dark"] {
  --color-bg: #0d1117;
  --color-sidebar: #161b22;
  --color-card: #161b22;
  --color-border: #30363d;
  --color-text: #e6edf3;
  --color-text-muted: #8b949e;
  --color-primary: #58a6ff;
  --color-primary-dark: #79c0ff;
  --color-danger: #f85149;
  --color-success: #3fb950;
  --color-input-bg: #0d1117;
}

[data-theme="dark"] .login-card {
  background: var(--color-card);
}

[data-theme="dark"] .login-page {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--color-input-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

[data-theme="dark"] .btn-outline {
  border-color: var(--color-border);
  color: var(--color-text);
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--color-border);
}

[data-theme="dark"] code {
  background: #0d1117;
  color: var(--color-text);
}

[data-theme="dark"] .markdown-editor {
  background: var(--color-input-bg);
  color: var(--color-text);
}

/* Theme toggle button */
.theme-toggle {
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--color-text-muted);
  transition: background 0.2s, color 0.2s;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
}

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

.login-theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  color: rgba(255, 255, 255, 0.7);
}

.login-theme-toggle:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-header p {
  color: var(--color-text-muted);
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: var(--color-text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

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

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

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

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

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-oauth {
  padding: 12px 20px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
}

.btn-oauth:hover {
  background: var(--color-bg);
}

.btn-google svg {
  color: #4285f4;
}

.btn-github svg {
  color: #333;
}

[data-theme="dark"] .btn-github svg {
  color: #e6edf3;
}

/* App Layout */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--color-sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
}

.sidebar-narrow {
  width: var(--sidebar-narrow);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
}

.back-link {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
}

.back-link:hover {
  color: white;
}

.nav-menu {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: all 0.2s;
}

.nav-item a:hover,
.nav-item.active a {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon {
  font-size: 16px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.user-name {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
}

.app-editor .main-content {
  margin-left: var(--sidebar-narrow);
}

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

.page-header h2 {
  font-size: 24px;
  font-weight: 600;
}

.page-actions {
  display: flex;
  gap: 12px;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  background: var(--color-success);
  color: white;
}

.presentation-card.registered {
  border-color: var(--color-success);
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--color-card);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--color-border);
}

.stat-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--color-primary);
}

.stat-label {
  font-size: 14px;
  color: var(--color-text-muted);
}

.stat-detail {
  font-size: 12px;
  margin-top: 4px;
}

.stat-detail a {
  text-decoration: none;
}

/* Sections */
.section {
  margin-bottom: 32px;
}

.section h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text-muted);
}

/* Presentations Grid */
.presentations-grid,
.templates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.presentation-card,
.template-card {
  background: var(--color-card);
  border-radius: 8px;
  padding: 20px;
  border: 1px solid var(--color-border);
}

.presentation-card h4,
.template-card h4 {
  font-size: 16px;
  margin-bottom: 8px;
}

.presentation-description {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.presentation-path {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
  font-family: 'Monaco', 'Menlo', monospace;
  background: var(--color-bg);
  padding: 2px 6px;
  border-radius: 3px;
  display: inline-block;
  word-break: break-all;
}

.presentation-meta {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.presentation-actions,
.template-actions {
  display: flex;
  gap: 8px;
}

.presentation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.presentation-header h4 {
  margin-bottom: 0;
  flex: 1;
}

.presentation-icons {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 20px;
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
  background: var(--color-bg);
  color: var(--color-text);
}

.icon-btn-danger:hover {
  background: rgba(229, 62, 62, 0.1);
  color: var(--color-danger);
}

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

.icon-btn-primary:hover {
  background: var(--color-primary-dark);
  color: white;
}

.presentation-actions-icons {
  display: flex;
  gap: 8px;
  justify-content: flex-start;
}

/* Loading & Empty States */
.loading,
.empty {
  color: var(--color-text-muted);
  font-style: italic;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.form-group textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow: auto;
}

.modal-large {
  max-width: 800px;
}

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

.modal-header h3 {
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-muted);
}

.modal-content form {
  padding: 20px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
}

.modal-footer span {
  font-size: 13px;
  color: var(--color-text-muted);
  font-family: 'Monaco', 'Menlo', monospace;
}

/* File Browser */
.browser-container {
  padding: 0;
}

.browser-path {
  padding: 12px 20px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 13px;
  color: var(--color-text-muted);
}

.browser-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 8px 0;
}

.browser-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background 0.15s;
}

.browser-item:hover {
  background: var(--color-bg);
}

.browser-item.selected {
  background: rgba(66, 153, 225, 0.15);
}

.browser-icon {
  font-size: 18px;
}

.browser-name {
  font-size: 14px;
}

.browser-file:not(.browser-selectable) {
  opacity: 0.5;
  cursor: default;
}

.browser-md {
  color: var(--color-primary);
}

.browser-html {
  color: var(--color-success);
}

/* Editor */
.editor-tabs {
  padding: 16px;
}

.tab-btn {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 4px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
}

.tab-btn:hover,
.tab-btn.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.tab-panel {
  display: none;
  height: 100%;
}

.tab-panel.active {
  display: block;
}

.editor-container {
  height: calc(100vh - 48px);
}

.editor-pane {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.editor-header {
  padding: 16px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.editor-header .title-input {
  flex: 1;
}

.editor-mode-toggle {
  display: flex;
  background: var(--color-bg);
  border-radius: 6px;
  padding: 2px;
}

.mode-btn {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
}

.mode-btn:hover {
  color: var(--color-text);
}

.mode-btn.active {
  background: var(--color-card);
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.title-input {
  width: 100%;
  font-size: 20px;
  font-weight: 600;
  border: none;
  outline: none;
}

.markdown-editor {
  flex: 1;
  padding: 16px;
  border: none;
  resize: none;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.code-editor {
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 13px;
}

/* Settings */
.settings-container {
  max-width: 600px;
  padding: 24px;
}

.settings-container h3 {
  margin-bottom: 24px;
}

.settings-container h4 {
  margin-top: 24px;
  margin-bottom: 12px;
  font-size: 14px;
}

.token-display,
.link-display {
  display: flex;
  gap: 12px;
  align-items: center;
}

.token-display code {
  flex: 1;
  padding: 8px 12px;
  background: var(--color-bg);
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
}

.link-display input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  font-size: 12px;
}

.hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 8px;
}

/* Assets */
.assets-container {
  padding: 24px;
}

.upload-zone {
  border: 2px dashed var(--color-border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  color: var(--color-text-muted);
  cursor: pointer;
  margin-bottom: 24px;
  transition: all 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--color-primary);
  background: rgba(66, 153, 225, 0.05);
}

.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

/* Notifications */
.notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--color-sidebar);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  animation: slideIn 0.3s ease;
  z-index: 2000;
}

@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Navbar (alternative layout) */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--color-sidebar);
  color: white;
}

.nav-brand a {
  color: white;
  text-decoration: none;
  font-size: 18px;
  font-weight: 600;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: white;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-user .user-name {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.nav-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.nav-user .logout-link {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 12px;
  margin-left: 8px;
}

.nav-user .logout-link:hover {
  color: white;
}

/* Container for main content with navbar */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Toast notifications */
.toast,
.toast-success,
.toast-error {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  z-index: 2000;
}

.toast-success {
  background: var(--color-success);
}

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

/* Button secondary */
.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .main-content {
    margin-left: 0;
  }

  .app {
    flex-direction: column;
  }

  .nav-menu {
    display: flex;
    padding: 0;
    overflow-x: auto;
  }

  .nav-item a {
    padding: 12px 16px;
    white-space: nowrap;
  }

  .navbar {
    flex-wrap: wrap;
    height: auto;
    padding: 12px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-top: 12px;
    gap: 16px;
  }
}

/* Includes List */
.includes-list {
  margin-top: 8px;
}

.includes-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px 0;
}

.includes-header:first-child {
  margin-top: 0;
}

.include-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
}

.include-item:last-child {
  border-bottom: none;
}

.include-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
}

.include-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.include-name {
  flex: 1;
}

.include-type {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-weight: 600;
}

.include-desc {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
  margin-left: 24px;
}
