/* ============================================================
   Resources Wiki — Styles
   ============================================================ */

/* ---- Account for fixed navbar ---- */
body {
  padding-top: 70px;
}

/* ---- Reset container width for resources ---- */
#resources-root {
  max-width: none !important;
  padding: 0;
  margin: 0;
}
#resources-root .container-fluid {
  max-width: none;
}

/* ---- Loading Screen ---- */
.resources-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: #999;
}
.resources-loading .glyphicon {
  font-size: 36px;
  margin-bottom: 12px;
}
@keyframes res-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.res-spinning {
  display: inline-block;
  animation: res-spin 1s linear infinite;
}

/* ---- Auth Screen ---- */
.resources-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  padding: 20px;
}
.auth-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 40px 36px 30px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-header .glyphicon {
  font-size: 40px;
  color: #337ab7;
  margin-bottom: 12px;
  display: block;
}
.auth-header h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.auth-header p {
  color: #888;
  margin: 0;
  font-size: 14px;
}
.auth-card .form-group {
  margin-bottom: 14px;
}
.auth-toggle {
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: #888;
}
.auth-toggle a {
  color: #337ab7;
  font-weight: 600;
}

/* ---- Pending Screen ---- */
.resources-pending {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  text-align: center;
  padding: 20px;
}
.pending-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 48px 36px;
  max-width: 420px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.pending-card .glyphicon {
  font-size: 48px;
  color: #f0ad4e;
  display: block;
  margin-bottom: 16px;
}
.pending-card h2 {
  margin: 0 0 12px;
}
.pending-card p {
  color: #666;
}

/* ---- User Bar ---- */
.resources-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: #f8f8f8;
  border-bottom: 1px solid #e7e7e7;
  font-size: 13px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-info .glyphicon {
  color: #555;
}
.user-actions {
  display: flex;
  gap: 6px;
}

/* ---- Main Layout ---- */
.resources-main {
  display: flex;
  min-height: calc(100vh - 180px);
  position: relative;
}

/* ---- Sidebar ---- */
.resources-sidebar {
  width: 280px;
  min-width: 280px;
  background: #fafafa;
  border-right: 1px solid #e7e7e7;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s, min-width 0.2s;
}
.resources-sidebar.collapsed {
  width: 0;
  min-width: 0;
  border-right: none;
}
.sidebar-header {
  padding: 12px 12px 8px;
  border-bottom: 1px solid #eee;
}
.sidebar-header input {
  font-size: 13px;
}
.sidebar-actions {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.sidebar-toggle-btn {
  position: absolute;
  left: 280px;
  top: 8px;
  z-index: 10;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0 4px 4px 0;
  padding: 4px 6px;
  cursor: pointer;
  transition: left 0.2s;
  display: none;
}
.resources-sidebar.collapsed ~ .resources-content .sidebar-toggle-btn,
.sidebar-toggle-btn.show-toggle {
  display: block;
}

/* ---- Page Tree ---- */
.page-tree {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.tree-item {
  display: flex;
  align-items: center;
  padding: 5px 12px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  border-left: 3px solid transparent;
  transition: background 0.15s;
  user-select: none;
}
.tree-item:hover {
  background: #eef3f8;
}
.tree-item.active {
  background: #e3edf7;
  border-left-color: #337ab7;
  font-weight: 600;
}
.tree-toggle {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 10px;
  color: #999;
}
.tree-icon {
  margin-right: 6px;
  color: #888;
  font-size: 12px;
  flex-shrink: 0;
}
.tree-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-action-btn {
  opacity: 0;
  border: none;
  background: none;
  color: #999;
  font-size: 11px;
  padding: 2px 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.tree-item:hover .tree-action-btn {
  opacity: 1;
}
.tree-action-btn:hover {
  color: #337ab7;
}
.tree-children {
  margin-left: 16px;
}
.tree-children.collapsed {
  display: none;
}
.tree-empty {
  padding: 20px 16px;
  text-align: center;
  color: #aaa;
  font-size: 13px;
}

/* ---- Content Area ---- */
.resources-content {
  flex: 1;
  padding: 0;
  overflow-y: auto;
  min-width: 0;
  position: relative;
}
.content-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  color: #bbb;
  text-align: center;
  padding: 40px;
}
.content-empty .glyphicon {
  font-size: 48px;
  margin-bottom: 16px;
}
.content-empty h3 {
  color: #888;
}
.content-empty p {
  color: #aaa;
}

/* Content Header */
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px 0;
  flex-wrap: wrap;
  gap: 8px;
}
.breadcrumb-nav {
  font-size: 12px;
  color: #888;
}
.breadcrumb-nav a {
  color: #337ab7;
  text-decoration: none;
}
.breadcrumb-nav .sep {
  margin: 0 4px;
  color: #ccc;
}
.content-actions {
  display: flex;
  gap: 4px;
}

/* Content Body */
#content-view {
  padding: 0 28px 28px;
}
#content-title {
  margin-top: 8px;
  font-size: 28px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}
.content-meta {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #eee;
  font-size: 12px;
  color: #aaa;
}

/* ---- Markdown Body ---- */
.markdown-body {
  font-size: 15px;
  line-height: 1.7;
  color: #333;
  word-wrap: break-word;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3,
.markdown-body h4, .markdown-body h5, .markdown-body h6 {
  margin-top: 24px;
  margin-bottom: 12px;
  font-weight: 600;
}
.markdown-body h1 { font-size: 24px; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.markdown-body h2 { font-size: 20px; border-bottom: 1px solid #eee; padding-bottom: 6px; }
.markdown-body h3 { font-size: 17px; }
.markdown-body p { margin-bottom: 14px; }
.markdown-body img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 8px 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.markdown-body pre {
  background: #f6f8fa;
  border: 1px solid #e1e4e8;
  border-radius: 4px;
  padding: 12px 16px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
.markdown-body code {
  background: #f0f2f4;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 13px;
}
.markdown-body pre code {
  background: none;
  padding: 0;
}
.markdown-body blockquote {
  border-left: 4px solid #dfe2e5;
  color: #6a737d;
  padding: 4px 16px;
  margin: 12px 0;
}
.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}
.markdown-body table th,
.markdown-body table td {
  border: 1px solid #dfe2e5;
  padding: 8px 12px;
  text-align: left;
}
.markdown-body table th {
  background: #f6f8fa;
  font-weight: 600;
}
.markdown-body table tr:nth-child(even) {
  background: #fafbfc;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 28px;
  margin-bottom: 14px;
}
.markdown-body li {
  margin-bottom: 4px;
}
.markdown-body a {
  color: #337ab7;
}
.markdown-body hr {
  border: none;
  border-top: 1px solid #e1e4e8;
  margin: 20px 0;
}

/* ---- Editor ---- */
#content-editor {
  padding: 16px 28px 28px;
}
.editor-header {
  margin-bottom: 12px;
}
.editor-header input {
  font-size: 18px;
  font-weight: 600;
  padding: 8px 12px;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 6px 8px;
  background: #f6f8fa;
  border: 1px solid #ddd;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  flex-wrap: wrap;
}
.editor-toolbar .btn {
  min-width: 30px;
  font-size: 13px;
}
.toolbar-divider {
  width: 1px;
  height: 20px;
  background: #ddd;
  margin: 0 4px;
}
.editor-body {
  position: relative;
}
.editor-body textarea {
  width: 100%;
  min-height: 400px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  resize: vertical;
  tab-size: 2;
}
.editor-body textarea:focus {
  outline: none;
  border-color: #66afe9;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px rgba(102,175,233,.6);
}
#editor-preview {
  min-height: 400px;
  padding: 16px;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  background: #fff;
  overflow-y: auto;
}
.editor-footer {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.editor-status {
  font-size: 12px;
  color: #888;
  margin-left: 12px;
}
.editor-status.error {
  color: #d9534f;
}
.editor-status.success {
  color: #5cb85c;
}

/* Image upload progress */
.upload-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
  margin-left: 12px;
}
.upload-progress .progress {
  width: 120px;
  height: 8px;
  margin: 0;
}

/* ---- Admin Modal ---- */
.admin-section {
  margin-bottom: 24px;
}
.admin-section h5 {
  font-weight: 600;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}
.admin-section .form-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.admin-section .form-inline .form-control {
  width: auto;
  flex: 1;
  min-width: 160px;
}
.admin-user-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 6px;
  background: #fff;
  gap: 12px;
}
.admin-user-row .user-email {
  flex: 1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-user-row .user-display-name {
  color: #888;
  font-size: 12px;
}
.admin-user-row .form-control {
  width: auto;
  font-size: 12px;
  padding: 2px 8px;
  height: auto;
}
.admin-invite-row {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 13px;
  gap: 12px;
}
.admin-invite-row .invite-email {
  flex: 1;
}

/* ---- Confirm Dialog ---- */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-dialog {
  background: #fff;
  border-radius: 6px;
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}
.confirm-dialog h4 {
  margin: 0 0 12px;
}
.confirm-dialog p {
  color: #666;
  margin-bottom: 20px;
}
.confirm-dialog .confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .resources-sidebar {
    position: fixed;
    left: 0;
    top: 50px;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    width: 260px;
    min-width: 260px;
  }
  .resources-sidebar.collapsed {
    transform: translateX(-100%);
    width: 260px;
    min-width: 260px;
  }
  .mobile-toggle-btn {
    display: block !important;
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #337ab7;
    color: #fff;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    font-size: 18px;
    cursor: pointer;
  }
  .resources-user-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
  #content-view {
    padding: 0 16px 20px;
  }
  #content-editor {
    padding: 12px 16px 20px;
  }
  .content-header {
    padding: 12px 16px 0;
  }
}

/* ---- Utility ---- */
.resources-app .label {
  font-size: 10px;
  vertical-align: middle;
}
.hidden {
  display: none !important;
}
.text-muted-sm {
  font-size: 12px;
  color: #aaa;
}

/* Password change section */
.password-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
}
.password-section .form-inline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
