/* PR351 — Document Engine Core — Documents Hub CSS
 * TradeRail Field Portal
 * Tenant-neutral — no emoji
 */

/* ============================================================
 * Documents Hub Layout
 * ============================================================ */
#documentsHub {
  padding: 0;
  background: #F5F5F7;
  min-height: calc(100vh - 56px);
}

/* Page header follows Fleet-style locked rule */
.doc-hub-header {
  background: #1A1A2E;
  color: #fff;
  padding: 18px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.doc-hub-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.doc-hub-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.doc-hub-subtitle {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
}

.doc-hub-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-hub-upload-btn {
  background: #FF6B00;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.doc-hub-upload-btn:hover { background: #e05e00; }

/* ============================================================
 * Lily Bar (Admin / Owner / Foreman ONLY)
 * ============================================================ */
.doc-hub-lily-bar {
  background: linear-gradient(90deg, #1A1A2E 0%, #2a2a4e 100%);
  border-bottom: 1px solid rgba(255,107,0,0.25);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.doc-hub-lily-icon {
  width: 28px;
  height: 28px;
  background: rgba(255,107,0,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.doc-hub-lily-icon svg {
  width: 16px;
  height: 16px;
}

.doc-hub-lily-input-wrap {
  flex: 1;
  position: relative;
}

.doc-hub-lily-input {
  width: 100%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,107,0,0.2);
  border-radius: 6px;
  color: #fff;
  font-size: 13px;
  padding: 7px 36px 7px 12px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  box-sizing: border-box;
}

.doc-hub-lily-input::placeholder { color: rgba(255,255,255,0.35); }
.doc-hub-lily-input:focus {
  border-color: #FF6B00;
  background: rgba(255,255,255,0.1);
}

.doc-hub-lily-send {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-hub-lily-send svg { width: 14px; height: 14px; opacity: 0.6; }
.doc-hub-lily-send:hover svg { opacity: 1; }

/* ============================================================
 * Search Bar
 * ============================================================ */
.doc-hub-search-row {
  padding: 14px 24px 12px;
  background: #fff;
  border-bottom: 1px solid #E5E5EA;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.doc-hub-search-wrap {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.doc-hub-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  opacity: 0.4;
}

.doc-hub-search-icon svg { width: 15px; height: 15px; }

.doc-hub-search {
  width: 100%;
  border: 1px solid #D1D1D6;
  border-radius: 7px;
  padding: 8px 10px 8px 32px;
  font-size: 13px;
  color: #1A1A2E;
  outline: none;
  background: #FAFAFA;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.doc-hub-search:focus {
  border-color: #FF6B00;
  background: #fff;
}

.doc-hub-filter-select {
  border: 1px solid #D1D1D6;
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 13px;
  color: #1A1A2E;
  background: #FAFAFA;
  outline: none;
  cursor: pointer;
}

.doc-hub-filter-select:focus { border-color: #FF6B00; }

/* ============================================================
 * Tab Bar
 * ============================================================ */
.doc-hub-tabs {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #E5E5EA;
  padding: 0 24px;
  gap: 0;
  overflow-x: auto;
}

.doc-hub-tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: #8E8E93;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.doc-hub-tab:hover { color: #1A1A2E; }

.doc-hub-tab.active {
  color: #FF6B00;
  border-bottom-color: #FF6B00;
  font-weight: 600;
}

/* ============================================================
 * Hub Body
 * ============================================================ */
.doc-hub-body {
  padding: 20px 24px;
}

/* ============================================================
 * Expiring Soon Panel
 * ============================================================ */
.doc-hub-expiry-panel {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #E5E5EA;
  margin-bottom: 20px;
  overflow: hidden;
}

.doc-hub-expiry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #F0F0F5;
  cursor: pointer;
  user-select: none;
}

.doc-hub-expiry-title {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A2E;
  display: flex;
  align-items: center;
  gap: 7px;
}

.doc-hub-expiry-badge {
  background: #FF6B00;
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 700;
}

.doc-hub-expiry-list {
  padding: 4px 0;
}

.doc-expiry-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid #F9F9FA;
  cursor: pointer;
  transition: background 0.12s;
}

.doc-expiry-row:last-child { border-bottom: none; }
.doc-expiry-row:hover { background: #FFF7F2; }

.doc-expiry-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.doc-expiry-dot.red    { background: #FF3B30; }
.doc-expiry-dot.orange { background: #FF6B00; }
.doc-expiry-dot.yellow { background: #FFCC00; }

.doc-expiry-name {
  flex: 1;
  font-size: 12px;
  color: #1A1A2E;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-expiry-type {
  font-size: 11px;
  color: #8E8E93;
  background: #F0F0F5;
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.doc-expiry-date {
  font-size: 11px;
  color: #8E8E93;
  flex-shrink: 0;
  min-width: 72px;
  text-align: right;
}

/* ============================================================
 * Document Cards / List
 * ============================================================ */
.doc-hub-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #8E8E93;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 0 8px;
}

.doc-hub-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 24px;
}

.doc-card {
  background: #fff;
  border: 1px solid #E5E5EA;
  border-radius: 9px;
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  position: relative;
}

.doc-card:hover {
  box-shadow: 0 2px 8px rgba(26,26,46,0.08);
  border-color: #C7C7CC;
}

.doc-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}

.doc-card-icon.financial   { background: #FFF0E0; }
.doc-card-icon.field       { background: #E8F5E9; }
.doc-card-icon.project     { background: #E3F2FD; }
.doc-card-icon.compliance  { background: #FCE4EC; }
.doc-card-icon.communications { background: #F3E5F5; }
.doc-card-icon.vendor      { background: #E8EAF6; }
.doc-card-icon.hr          { background: #E0F7FA; }
.doc-card-icon.lily_generated { background: #FFF3E0; }
.doc-card-icon.lily_alert_log { background: #FBE9E7; }

.doc-card-body {
  flex: 1;
  min-width: 0;
}

.doc-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #1A1A2E;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-type-chip {
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: #1A1A2E;
  border-radius: 4px;
  padding: 2px 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.doc-type-chip.lily_generated,
.doc-type-chip.lily_alert_log {
  background: #FF6B00;
}

.doc-status-chip {
  font-size: 10px;
  font-weight: 600;
  border-radius: 4px;
  padding: 2px 7px;
}

.doc-status-chip.active, .doc-status-chip.approved { background: #E8F5E9; color: #2E7D32; }
.doc-status-chip.draft                              { background: #FFF3E0; color: #E65100; }
.doc-status-chip.submitted                          { background: #E3F2FD; color: #1565C0; }
.doc-status-chip.under_review                       { background: #F3E5F5; color: #6A1B9A; }
.doc-status-chip.expired                            { background: #FFEBEE; color: #B71C1C; }
.doc-status-chip.void                               { background: #F5F5F5; color: #9E9E9E; }

.doc-card-date {
  font-size: 11px;
  color: #8E8E93;
  margin-left: auto;
  flex-shrink: 0;
  padding-left: 8px;
}

.doc-card-summary {
  font-size: 11px;
  color: #6D6D72;
  margin-top: 5px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* ============================================================
 * Project Tree View
 * ============================================================ */
.doc-project-group {
  background: #fff;
  border: 1px solid #E5E5EA;
  border-radius: 9px;
  margin-bottom: 10px;
  overflow: hidden;
}

.doc-project-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  background: #F9F9FB;
  border-bottom: 1px solid #F0F0F5;
  user-select: none;
}

.doc-project-group-header:hover { background: #F3F3F8; }

.doc-project-group-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1A1A2E;
}

.doc-project-group-count {
  font-size: 11px;
  color: #8E8E93;
  background: #EDEDF0;
  border-radius: 10px;
  padding: 1px 8px;
}

.doc-project-group-chevron {
  width: 16px;
  height: 16px;
  opacity: 0.4;
  transition: transform 0.2s;
}

.doc-project-group-chevron.open { transform: rotate(90deg); }

.doc-project-group-body {
  padding: 8px 16px;
  display: none;
}

.doc-project-group-body.open { display: block; }

/* ============================================================
 * Empty State
 * ============================================================ */
.doc-hub-empty {
  text-align: center;
  padding: 48px 24px;
  color: #8E8E93;
}

.doc-hub-empty-icon {
  font-size: 36px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.doc-hub-empty-text {
  font-size: 14px;
  font-weight: 600;
  color: #3C3C43;
  margin-bottom: 4px;
}

.doc-hub-empty-sub {
  font-size: 12px;
  color: #8E8E93;
}

/* ============================================================
 * Upload Modal
 * ============================================================ */
.doc-upload-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.doc-upload-modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(26,26,46,0.18);
}

.doc-upload-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 16px;
}

.doc-upload-field {
  margin-bottom: 14px;
}

.doc-upload-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #3C3C43;
  margin-bottom: 5px;
}

.doc-upload-input,
.doc-upload-select {
  width: 100%;
  border: 1px solid #D1D1D6;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  color: #1A1A2E;
  background: #FAFAFA;
  outline: none;
  box-sizing: border-box;
}

.doc-upload-input:focus,
.doc-upload-select:focus { border-color: #FF6B00; background: #fff; }

.doc-upload-drop {
  border: 2px dashed #D1D1D6;
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: #8E8E93;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.doc-upload-drop:hover,
.doc-upload-drop.dragover {
  border-color: #FF6B00;
  background: #FFF7F2;
  color: #FF6B00;
}

.doc-upload-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

.doc-upload-cancel {
  background: #F2F2F7;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #3C3C43;
  cursor: pointer;
}

.doc-upload-cancel:hover { background: #E5E5EA; }

.doc-upload-save {
  background: #FF6B00;
  border: none;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
}

.doc-upload-save:hover { background: #e05e00; }

/* ============================================================
 * Inline confirm (two-tap pattern)
 * ============================================================ */
.doc-inline-confirm {
  background: #FFF3E0;
  border: 1px solid #FF6B00;
  border-radius: 7px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: #1A1A2E;
}

.doc-inline-confirm-yes {
  background: #FF3B30;
  color: #fff;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.doc-inline-confirm-no {
  background: #F2F2F7;
  color: #3C3C43;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
 * Responsive — sidebar is DESKTOP-ONLY, stays hidden below 768px
 * ============================================================ */
@media (max-width: 767px) {
  .doc-hub-header { padding: 14px 16px 12px; }
  .doc-hub-lily-bar { padding: 10px 16px; }
  .doc-hub-search-row { padding: 10px 16px; }
  .doc-hub-tabs { padding: 0 16px; }
  .doc-hub-body { padding: 14px 16px; }
  .doc-card { padding: 10px 12px; }
  .doc-expiry-row { padding: 9px 12px; }
  .doc-project-group-header { padding: 10px 12px; }
}
