/*
 * Trade Els - Project Management Resources Executive CSS Theme (styles.css)
 */

:root, :root[data-theme="dark"] {
  --bg-dark: #0B0E14;
  --bg-card: #121620;
  --bg-card-hover: #1E2433;
  --bg-input: #0D1117;
  --bg-toolbar: #141824;
  --border-color: #1E2433;
  --border-accent: #D97706;
  --text-main: #E5E7EB;
  --text-muted: #9CA3AF;
  --text-bright: #FFFFFF;
  --accent-gold: #D97706;
  --accent-blue: #2979FF;
  --accent-green: #00E676;
  --accent-cyan: #00E5FF;
  --accent-red: #FF1744;
  --accent-purple: #A855F7;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

:root[data-theme="light"] {
  --bg-dark: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --bg-input: #F8FAFC;
  --bg-toolbar: #FFFFFF;
  --border-color: #E2E8F0;
  --border-accent: #D97706;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --text-bright: #000000;
  --accent-gold: #D97706;
  --accent-blue: #2563EB;
  --accent-green: #16A34A;
  --accent-cyan: #0284C7;
  --accent-red: #DC2626;
  --accent-purple: #9333EA;
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;
}

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

body, html {
  width: 100%; height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
}

#app-container {
  display: grid;
  grid-template-rows: 48px 1fr 28px;
  width: 100vw;
  height: 100vh;
}

/* Header */
header.tv-header {
  background-color: var(--bg-toolbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 16px;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
}

.brand-logo .logo-box {
  width: 28px;
  height: 28px;
  background: var(--accent-gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #000;
  font-weight: 900;
}

.action-btn {
  background: #238636;
  color: white;
  border: 1px solid #2ea043;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.action-btn:hover { background: #2ea043; }
.action-btn.secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-main);
}
.action-btn.secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
}

.action-btn.gold {
  background: var(--accent-gold);
  color: #000;
  border-color: var(--accent-gold);
}
.action-btn.gold:hover { opacity: 0.9; }

/* Dashboard Projects View */
.dashboard-view {
  padding: 32px;
  overflow-y: auto;
  height: 100%;
}

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

.dashboard-title h2 {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-bright);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.project-tile {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 170px;
}

.project-tile:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.project-tile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.project-code-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: rgba(217, 119, 6, 0.15);
  color: var(--accent-gold);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--accent-gold);
}

.project-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 8px;
}

.project-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  margin-top: 10px;
}

/* 3-Column Project Workspace */
main.project-workspace {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  height: 100%;
  overflow: hidden;
}

/* Left Phase Tree Sidebar */
aside.tree-sidebar {
  background: var(--bg-toolbar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

.back-to-dashboard-btn {
  background: transparent;
  border: none;
  color: var(--accent-gold);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tree-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.phase-node {
  margin-bottom: 10px;
}

.phase-title {
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-bright);
}

.phase-title:hover {
  border-color: var(--accent-gold);
}

.phase-title.initiation { border-left: 3px solid var(--accent-blue); }
.phase-title.planning { border-left: 3px solid var(--accent-cyan); }
.phase-title.implementation { border-left: 3px solid var(--accent-green); }
.phase-title.monitoring { border-left: 3px solid var(--accent-gold); }
.phase-title.closure { border-left: 3px solid var(--accent-purple); }

.folder-tree {
  padding-left: 14px;
  margin-top: 6px;
}

.folder-node {
  margin-bottom: 6px;
}

.folder-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.doc-item {
  font-size: 12px;
  padding: 6px 10px;
  margin-left: 10px;
  margin-top: 2px;
  border-radius: 4px;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s ease;
}

.doc-item:hover {
  background: var(--bg-card-hover);
  color: var(--accent-gold);
}

.doc-item.active {
  background: rgba(217, 119, 6, 0.15);
  color: var(--accent-gold);
  font-weight: 700;
}

/* Central Working Area */
.canvas-working-area {
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.canvas-toolbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mode-switcher {
  display: flex;
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--accent-gold);
  color: #000;
}

.document-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* Edit Mode Layout */
.edit-section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.section-title-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

.section-textarea {
  width: 100%;
  height: 120px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 13.5px;
  resize: vertical;
}

/* Executive Display View Layout */
.display-document-view {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  max-width: 900px;
  margin: 0 auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.display-header {
  border-bottom: 2px solid var(--accent-gold);
  padding-bottom: 20px;
  margin-bottom: 30px;
}

.display-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-bright);
}

.display-meta-row {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.display-section {
  margin-bottom: 30px;
}

.display-section-heading {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-cyan);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.display-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.display-table th, .display-table td {
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  font-size: 13px;
}

.display-table th {
  background: var(--bg-input);
  color: var(--accent-gold);
  font-weight: 700;
}

/* Right Metadata & Comments Sidebar */
aside.metadata-sidebar {
  background: var(--bg-toolbar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.meta-panel {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.meta-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  margin-bottom: 10px;
}

.meta-label { color: var(--text-muted); }
.meta-value { font-weight: 600; color: var(--text-main); }

.status-pill-select {
  background: var(--bg-dark);
  border: 1px solid var(--border-color);
  color: var(--accent-cyan);
  padding: 4px 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}

.comments-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 16px;
  overflow: hidden;
}

.comments-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.comment-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent-gold);
  font-weight: 700;
  margin-bottom: 4px;
}

.comment-body {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.4;
}

.comment-input-box {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text-main);
  font-size: 12px;
  margin-bottom: 8px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  width: 480px;
  padding: 24px;
}

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

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-gold);
}

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

.input-box {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text-main);
  font-size: 13px;
  margin-bottom: 14px;
}

/* Status Bar */
footer.tv-statusbar {
  background: var(--bg-toolbar);
  border-top: 1px solid var(--border-color);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Print Styles for PDF Export */
@media print {
  body, html {
    overflow: visible !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  #app-container, #main-content-area, #projectWorkspace, .canvas-working-area, .document-canvas {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: #FFFFFF !important;
  }
  header, aside, .canvas-toolbar, footer, .modal-overlay, .dashboard-view {
    display: none !important;
  }
  .display-document-view {
    border: none !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #FFFFFF !important;
    color: #000000 !important;
  }
  .display-title {
    color: #000000 !important;
    font-size: 22pt !important;
  }
  .display-header {
    border-bottom: 2pt solid #000000 !important;
  }
  .display-section-heading {
    color: #000000 !important;
    border-bottom: 1.5pt solid #000000 !important;
    page-break-after: avoid;
  }
  .display-table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-top: 10pt;
    page-break-inside: avoid;
  }
  .display-table th, .display-table td {
    border: 1pt solid #444444 !important;
    padding: 6pt 10pt !important;
    color: #000000 !important;
    font-size: 10pt !important;
  }
  .display-table th {
    background: #F3F4F6 !important;
    font-weight: 700 !important;
  }
  .edit-section-card {
    border: none !important;
    padding: 0 !important;
    margin-bottom: 15pt !important;
  }
}
