/* NFT SharePoint Viewer - Matches NFT Site Theme */

.nft-sp-viewer {
  font-family: 'Roboto', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: #000000;
  border: 1px solid #CDDFE2;
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #FFFFFF;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 24px;
  margin-left: auto;
  margin-right: auto;
}

/* Header / Toolbar */
.nft-sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: #1C2252;
  color: #FFFFFF;
  flex-shrink: 0;
  gap: 12px;
  flex-wrap: wrap;
}

/* Breadcrumb */
.nft-sp-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1;
}

.nft-sp-breadcrumb-home {
  color: #FFFFFF;
  text-decoration: none;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 3px;
  transition: background-color 0.15s;
}

.nft-sp-breadcrumb-home:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}

/* Back button (locked mode) - JS toggles display between 'none' and 'inline-flex' */
.nft-sp-breadcrumb-back {
  align-items: center;
  padding: 6px 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.nft-sp-breadcrumb-back:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

/* Width matching for site content blocks */
.entry-content .nft-sp-viewer {
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 10px;
  padding-right: 10px;
  border: none;
  background: transparent;
}
.entry-content .nft-sp-viewer .nft-sp-header,
.entry-content .nft-sp-viewer .nft-sp-content {
  border: 1px solid #CDDFE2;
}
.entry-content .nft-sp-viewer .nft-sp-content {
  border-top: none;
}

.nft-sp-breadcrumb-sep {
  color: rgba(255, 255, 255, 0.5);
  margin: 0 2px;
}

.nft-sp-breadcrumb-link {
  color: #FFFFFF;
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.nft-sp-breadcrumb-link:hover {
  opacity: 1;
  text-decoration: underline;
  color: #FFFFFF;
}

.nft-sp-breadcrumb-current {
  color: #FFFFFF;
  opacity: 1;
}

/* Tree Toggle Button */
.nft-sp-tree-toggle-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  color: #FFFFFF;
  cursor: pointer;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: 'Roboto', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  opacity: 0.8;
  transition: all 0.15s;
  flex-shrink: 0;
}

.nft-sp-tree-toggle-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.15);
}

.nft-sp-tree-open .nft-sp-tree-toggle-btn {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
}

/* Folder Tree Sidebar */
.nft-sp-tree-panel {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid #CDDFE2;
  background: #f5f7f8;
  overflow-y: auto;
  display: none;
  flex-shrink: 0;
}

.nft-sp-tree-open .nft-sp-tree-panel {
  display: block;
}

.nft-sp-tree-panel-header {
  padding: 10px 12px;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: #506B75;
  border-bottom: 1px solid #CDDFE2;
}

.nft-sp-tree-root {
  padding: 4px 0;
}

.nft-sp-tree-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  cursor: pointer;
  color: #000000;
  font-size: 13px;
  transition: background-color 0.1s;
  border-radius: 0;
  text-decoration: none;
  user-select: none;
}

.nft-sp-tree-item:hover {
  background-color: #e8eef0;
}

.nft-sp-tree-item.nft-sp-tree-active {
  background-color: #d0e8ee;
  font-weight: 700;
  color: #1C2252;
}

.nft-sp-tree-arrow {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #81839D;
  font-size: 10px;
  transition: transform 0.15s;
}

.nft-sp-tree-arrow.expanded {
  transform: rotate(90deg);
}

.nft-sp-tree-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.nft-sp-tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.nft-sp-tree-children {
  padding-left: 16px;
  display: none;
}

.nft-sp-tree-children.expanded {
  display: block;
}

.nft-sp-tree-loading {
  padding: 6px 10px 6px 26px;
  color: #81839D;
  font-size: 12px;
  font-style: italic;
}

/* Search */
.nft-sp-search {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}

.nft-sp-search-input {
  background: transparent;
  border: none;
  color: #FFFFFF;
  padding: 6px 10px;
  font-size: 13px;
  font-family: 'Roboto', sans-serif;
  width: 180px;
  outline: none;
}

.nft-sp-search-input::placeholder {
  color: rgba(255, 255, 255, 0.6);
}

.nft-sp-search-input:focus {
  background: rgba(255, 255, 255, 0.1);
}

.nft-sp-search-btn,
.nft-sp-search-clear {
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.nft-sp-search-btn:hover,
.nft-sp-search-clear:hover {
  opacity: 1;
}

/* Content Area */
.nft-sp-content {
  flex: 1;
  overflow: auto;
  display: flex;
  min-height: 0;
}

.nft-sp-file-list {
  flex: 1;
  overflow-y: auto;
}

/* Table */
.nft-sp-table {
  width: 100%;
  border-collapse: collapse;
}

.nft-sp-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

.nft-sp-table th {
  background-color: #f5f7f8;
  color: #506B75;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 2px solid #CDDFE2;
  white-space: nowrap;
}

.nft-sp-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #CDDFE2;
  vertical-align: middle;
}

.nft-sp-table tbody tr {
  transition: background-color 0.1s;
}

.nft-sp-table tbody tr:hover {
  background-color: #f5f9fa;
}

/* Columns */
.nft-sp-col-name {
  width: auto;
}

.nft-sp-col-modified {
  width: 140px;
  color: #506B75;
  font-size: 12px;
}

.nft-sp-col-size {
  width: 80px;
  color: #506B75;
  font-size: 12px;
  text-align: right;
}

.nft-sp-col-actions {
  width: 90px;
  text-align: right;
  white-space: nowrap;
}

.nft-sp-col-actions {
  display: table-cell;
}

/* Item styles */
.nft-sp-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #177EAB;
  text-decoration: none;
  font-weight: 700;
  transition: color 0.15s;
}

.nft-sp-item-link:hover {
  color: #1C2252;
  text-decoration: none;
}

.nft-sp-item-label {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #000000;
  font-weight: 400;
}

.nft-sp-file-link {
  color: #000000 !important;
  font-weight: 400;
}
.nft-sp-file-link:hover {
  color: #177EAB !important;
  text-decoration: underline !important;
}

/* Whole-row hover state for file rows */
tr.nft-sp-file:hover {
  background-color: #F0F4F6;
}
tr.nft-sp-file:hover .nft-sp-file-link {
  color: #177EAB !important;
}

/* Whole-row interactive state for folder rows */
tr.nft-sp-folder {
  user-select: none;
}
tr.nft-sp-folder:hover {
  background-color: #F0F4F6;
}
tr.nft-sp-folder:hover .nft-sp-item-link {
  color: #1C2252;
}

.nft-sp-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Expand chevron for folders */
.nft-sp-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nft-sp-expand {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #506B75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 3px;
  transition: background-color 0.15s, transform 0.15s;
}
.nft-sp-expand:hover {
  background-color: #E8F0F2;
  color: #177EAB;
}
.nft-sp-expand.nft-sp-expanded svg {
  transform: rotate(90deg);
}
.nft-sp-expand svg {
  transition: transform 0.15s;
}
.nft-sp-expand-spacer {
  display: inline-block;
  width: 24px;
  flex-shrink: 0;
}
.nft-sp-nested {
  background-color: #FAFBFC;
}
.nft-sp-nested:hover {
  background-color: #F0F4F6;
}

/* "Found in" path on search results */
.nft-sp-found-in {
  font-size: 11px;
  color: #595B75;
  font-style: italic;
  margin-top: 2px;
  padding-left: 30px;
}

.nft-sp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nft-sp-count {
  color: #81839D;
  font-weight: 400;
  font-size: 12px;
  margin-left: 4px;
}

/* Action buttons - circular, horizontal */
.nft-sp-btn-action {
  background: #FFFFFF;
  border: 1px solid #CDDFE2;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  cursor: pointer;
  color: #506B75;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-left: 6px;
  vertical-align: middle;
}

.nft-sp-btn-action:first-child {
  margin-left: 0;
}

.nft-sp-btn-action:hover {
  background-color: #177EAB;
  border-color: #177EAB;
  color: #FFFFFF;
}

.nft-sp-btn-action svg {
  stroke: currentColor;
  width: 14px;
  height: 14px;
}

/* Preview Panel */
.nft-sp-preview-panel {
  width: 50%;
  max-width: 600px;
  border-left: 2px solid #CDDFE2;
  display: flex;
  flex-direction: column;
  background: #f5f7f8;
  flex-shrink: 0;
}

.nft-sp-preview-open .nft-sp-file-list {
  width: 50%;
  min-width: 300px;
}

.nft-sp-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #1C2252;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.nft-sp-preview-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.nft-sp-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nft-sp-preview-close,
.nft-sp-preview-download {
  background: none;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  opacity: 0.7;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.nft-sp-preview-close:hover,
.nft-sp-preview-download:hover {
  opacity: 1;
}

.nft-sp-preview-content {
  flex: 1;
  min-height: 0;
}

.nft-sp-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #FFFFFF;
}

/* Loading */
.nft-sp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: #506B75;
  font-size: 14px;
}

.nft-sp-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #CDDFE2;
  border-top-color: #177EAB;
  border-radius: 50%;
  animation: nft-sp-spin 0.8s linear infinite;
}

@keyframes nft-sp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Empty state */
.nft-sp-empty {
  padding: 60px 20px;
  text-align: center;
  color: #595B75;
  font-size: 14px;
}

/* Error */
.nft-sp-error {
  padding: 30px 20px;
  text-align: center;
  background: #fff5f5;
  border-top: 1px solid #CDDFE2;
}

.nft-sp-error-message {
  color: #E7131A;
  margin-bottom: 12px;
  font-size: 13px;
}

.nft-sp-retry {
  background-color: #C15415;
  color: #FFFFFF;
  border: none;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
  cursor: pointer;
  transition: background-color 0.15s;
}

.nft-sp-retry:hover {
  background-color: #000000;
}

/* Responsive */
@media (max-width: 768px) {
  .nft-sp-header {
    flex-direction: column;
    align-items: stretch;
  }

  .nft-sp-search-input {
    width: 100%;
  }

  .nft-sp-col-modified,
  .nft-sp-col-size {
    display: none;
  }

  .nft-sp-col-actions {
    width: 70px;
  }

  /* Stack preview below on mobile */
  .nft-sp-content {
    flex-direction: column;
    position: relative;
  }

  .nft-sp-tree-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 10;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  }

  .nft-sp-preview-panel {
    width: 100%;
    max-width: none;
    border-left: none;
    border-top: 2px solid #CDDFE2;
    height: 400px;
  }

  .nft-sp-preview-open .nft-sp-file-list {
    width: 100%;
    min-width: 0;
  }

  .nft-sp-table th,
  .nft-sp-table td {
    padding: 8px 12px;
  }
}

@media (max-width: 480px) {
  .nft-sp-breadcrumb {
    font-size: 11px;
  }

  .nft-sp-col-actions {
    width: 40px;
  }

  .nft-sp-btn-action {
    padding: 4px 5px;
    margin-left: 2px;
  }
}

/* Focus styles for accessibility */
.nft-sp-item-link:focus,
.nft-sp-btn-action:focus,
.nft-sp-breadcrumb-link:focus,
.nft-sp-breadcrumb-home:focus,
.nft-sp-search-input:focus,
.nft-sp-search-btn:focus,
.nft-sp-preview-close:focus,
.nft-sp-retry:focus {
  outline: 2px solid #177EAB;
  outline-offset: 2px;
}

/* High contrast for screen readers */
.nft-sp-viewer *:focus-visible {
  outline: 3px solid #177EAB;
  outline-offset: 2px;
}
