@import url('https://fonts.googleapis.com/css2?family=Readex+Pro:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
  --bg-color: #242424; /* Dark grey */
  --text-primary: #ffffff;
  --text-secondary: #aaaaaa;
  --border-color: #3f3f3f;
  
  /* Highlight Colors */
  --hl-word: #fef08a; /* yellow */
  --hl-para: rgb(0, 251, 255);
  --hl-math: rgb(0, 255, 30);
  
  --ui-font: 'Readex Pro', system-ui, -apple-system, sans-serif;
  --article-font: 'Inter', sans-serif;
}

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

body.landing-wrapper {
  font-family: var(--ui-font);
  background-color: var(--bg-color);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
  z-index: 10;
}

.header-email {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--ui-font);
  transition: color 0.2s;
}

.header-email:hover {
  color: var(--text-primary);
}

.app-footer {
  display: none;
  text-align: center;
  padding: 24px;
  background: var(--bg-color);
  border-top: 1px solid var(--border-color);
}

.app-footer .footer-email {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-family: var(--ui-font);
}

.brand {
  font-weight: 600;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-primary);
}

.header-links a {
  margin-left: 24px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color 0.2s;
  white-space: nowrap;
}

.header-links a:hover {
  color: var(--text-primary);
}

.install-btn {
  background: #ffffff;
  color: #000;
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--ui-font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 24px;
  text-decoration: none;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.install-btn:hover {
  opacity: 0.8;
}

/* Main Layout */
.app-main {
  display: flex;
  flex: 1;
  height: calc(100vh - 60px);
  overflow: hidden;
  position: relative;
}

/* Article Area */
.article-container {
  flex: 1;
  height: 100%;
  padding: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  scroll-behavior: smooth;
  overflow: hidden; 
}

.article-content {
  max-width: 600px;
  width: 100%;
  font-family: var(--article-font);
  font-size: 1.15rem;
  line-height: 1.8;
  color: #eeeeee;
}

.article-content h1 {
  font-family: var(--ui-font);
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.article-content p {
  margin-bottom: 20px;
}

/* Highlights */
.tc-highlight {
  color: #000 !important;
  border-radius: 3px;
  padding: 0 1px;
  cursor: pointer;
  box-decoration-break: clone;
}

/* Specific colors for demo */
.hl-word { background-color: var(--hl-word) !important; }
.hl-para { background-color: var(--hl-para) !important; display: inline; }
.hl-math { background-color: var(--hl-math) !important; }

/* 1:1 Overlays Copied from content_script.js */
.tc-panel {
  position: absolute;
  max-width: min(320px, calc(100vw - 24px));
  padding: 6px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: #f5f5f5;
  font: 600 12px/1.4 Arial, sans-serif;
  box-shadow: none;
  z-index: 100;
}
.tc-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.tc-collector {
  border: 1px solid #2a2a2a;
  background: #000;
  color: var(--collector-color, #f5f5f5);
  padding: 2px 6px;
  border-radius: 6px;
  font: 600 12px/1.2 Arial, sans-serif;
  cursor: pointer;
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.tc-collector svg {
  width: 14px;
  height: 14px;
}

.tc-inline-editor {
  position: absolute;
  z-index: 100;
}
.tc-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tc-inline-delete {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255, 77, 79, 0.6);
  background: #000;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.tc-inline-delete svg {
  width: 14px;
  height: 14px;
}
.tc-inline-mirror {
  background: #000;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font: 500 13px/1.4 Arial, sans-serif;
  white-space: pre-wrap;
  word-break: break-word;
  min-width: 60px;
  min-height: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tc-inline-mirror svg {
  width: 16px;
  height: 16px;
}

/* Sidebars (Right Side) */
.sidebars-container {
  display: flex;
  width: 824px;
  min-width: 824px;
  height: 100%;
  border-left: 1px solid var(--border-color);
  background: #fdfdfd; 
}

.sidebar {
  height: 100%;
  overflow-y: hidden;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: relative;
}

.sidebar:nth-child(1) {
  flex: 0 0 380px;
}

.sidebar:nth-child(2) {
  flex: 1;
}

.sidebar:last-child {
  border-right: none;
}

/* Fix tree toolbar actions to stretch evenly */
.sidebars-container .tree-toolbar-actions {
  justify-content: stretch !important;
}
.sidebars-container .tree-toolbar-actions .icon-button,
.sidebars-container .tree-toolbar-actions .tree-more-wrap {
  flex: 1 !important;
  width: auto !important;
}
.sidebars-container .tree-toolbar-actions .tree-more-wrap .icon-button {
  width: 100% !important;
}

/* Overriding sidepanel body class just for containment */
.sidebar .sidepanel-wrapper {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}

/* Mobile UI Showcase - Vertical stacking to show all UI */
@media (max-width: 1100px) {
  body.landing-wrapper {
    height: auto;
    overflow-y: auto;
  }
  .app-main {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .article-container {
    padding: 40px 20px;
    height: auto;
    min-height: 60vh;
  }
  .sidebars-container {
    width: 100%;
    min-width: 100%;
    height: 600px;
    border-left: none;
    border-top: 1px solid var(--border-color);
  }
}

@media (max-width: 650px) {
  .header-email {
    display: none;
  }
  .app-footer {
    display: block;
  }
  .app-header {
    padding: 0 12px;
  }
  .brand {
    font-size: 1rem;
    gap: 6px;
  }
  .header-links a {
    margin-left: 12px;
    font-size: 0.85rem;
  }
  .header-links a:not(#open-detailed-guide-web) {
    display: none;
  }
  .install-btn {
    margin-left: 12px;
    padding: 6px 14px;
    font-size: 0.85rem;
  }
  .sidebars-container {
    flex-direction: column;
    height: auto; /* Để nó tự co giãn theo nội dung thay vì cố định 1200px */
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    height: auto; /* Bỏ height 100% của sidebar */
  }
  .sidebar:nth-child(1) {
    flex: none;
    height: 500px; /* Giữ cố định 500px cho Tree để release notes cuộn bên trong */
  }
  .sidebar:nth-child(2) {
    flex: none;
    height: auto; /* Để phần editor tự bung chiều cao theo thẻ div raw-editor */
  }
  .sidebar:last-child {
    border-bottom: none;
  }
  /* Bỏ lock height cho phần editor bên trong sidebar thứ 2 */
  .sidebar:nth-child(2) .shell-main,
  .sidebar:nth-child(2) .state-editor,
  .sidebar:nth-child(2) .editor-card,
  .sidebar:nth-child(2) .editor-wrap {
    height: auto !important;
    overflow: visible !important;
    min-height: 0;
  }
  .sidebar:nth-child(2) .editor-scroll-area {
    position: relative !important; /* Đổi sang relative để đẩy chiều cao div bên ngoài */
    overflow: visible !important;
  }
}

/* Privacy Page specific */
.privacy-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

.privacy-content {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 40px;
}

.privacy-content h1 {
  font-size: 2rem;
  margin-bottom: 16px;
}

.privacy-content h2 {
  font-size: 1.25rem;
  margin-top: 32px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.privacy-content p, .privacy-content li {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

.privacy-content ul {
  padding-left: 20px;
  margin-bottom: 20px;
}

/* Mobile Gallery Section */
.mobile-gallery-section {
    display: none;
    padding: 30px 20px 50px;
    background: transparent;
    text-align: center;
}
.mobile-gallery-section h2 {
    font-family: var(--ui-font);
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-weight: 500;
}
.mobile-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}
.mobile-gallery-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    cursor: pointer;
    border: 1px solid rgba(255,255,255,0.05);
}

@media (max-width: 849px) {
    .mobile-gallery-section {
        display: block;
    }
}
