/* Watcher (NOVEXA AGI themed) — scoped so it won't break other pages */
.watcher-page {
  /* Use NOVEXA Blue variables from /css/style.css */
  --watcher-card: rgba(10, 15, 26, 0.95);           /* very dark glass */
  --watcher-card-strong: rgba(10, 15, 26, 0.98);
  --watcher-border: rgba(140, 176, 255, 0.22);
  --watcher-border-strong: rgba(140, 176, 255, 0.35);
  --watcher-muted: #b0bec5;
  --watcher-text: #ffffff;
  --watcher-input-bg: rgba(0, 0, 0, 0.65);

  background: linear-gradient(135deg, #05080f 0%, #0a1628 50%, #05080f 100%);
  color: var(--watcher-text);
  min-height: 100vh;

  /* Override global body:flex from NOVEXA AGI to avoid layout issues in tools */
  display: block;
  height: auto;
}

/* Avoid affecting other pages */
.watcher-page * {
  box-sizing: border-box;
}

.watcher-page .header {
  text-align: center;
  margin: 18px 0 12px;
}

.watcher-page .header .logo-img {
  max-width: 220px;
  height: auto;
  margin-bottom: 10px;
}

.watcher-page .header .app-title {
  font-size: 28px;
  color: #8cb0ff;
  font-weight: 700;
  margin: 0 0 6px;
}

.watcher-page .mini-note {
  color: var(--watcher-muted);
  font-size: 14px;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Settings button */
.watcher-page .settings-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 0 auto 18px auto;
  background: rgba(10, 15, 26, 0.85);
  color: #8cb0ff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  border: 1px solid var(--watcher-border);
  cursor: pointer;
}
.watcher-page .settings-btn:hover {
  border-color: var(--watcher-border-strong);
  box-shadow: 0 6px 18px rgba(140, 176, 255, 0.15);
}

/* Panels / cards inside the tool */
.watcher-page .panel {
  background: rgba(10, 15, 26, 0.90);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--watcher-border);
  border-radius: 16px;
  padding: 18px;
  margin: 14px auto;
  max-width: 1100px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.watcher-page label {
  display: block;
  margin: 12px 0 8px;
  color: #8cb0ff;
  font-weight: 600;
}

/* Inputs - match NOVEXA AGI look */
.watcher-page input,
.watcher-page select,
.watcher-page textarea {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--watcher-input-bg);
  color: var(--watcher-text);
  font-size: 15px;
  margin-bottom: 12px;
  outline: none;
}

.watcher-page input:focus,
.watcher-page select:focus,
.watcher-page textarea:focus {
  border-color: #8cb0ff;
  box-shadow: 0 0 10px rgba(140, 176, 255, 0.22);
}

.watcher-page textarea {
  min-height: 120px;
  resize: vertical;
}

/* Buttons — scoped (don’t override global .btn-primary outside watcher page) */
.watcher-page button {
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

/* In NOVEXA AGI global CSS .btn-primary is width:100%.
   For watcher page we want normal buttons unless inline style sets width:100%. */
.watcher-page .btn-primary {
  width: auto;
  background: linear-gradient(90deg, #5a7ec9, #8cb0ff);
  color: #fff;
  border: 1px solid rgba(140, 176, 255, 0.22);
}
.watcher-page .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(140, 176, 255, 0.25);
}

.watcher-page .btn-secondary {
  width: auto;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
}
.watcher-page .btn-secondary:hover {
  background: rgba(30, 64, 175, 0.45);
}

.watcher-page .btn-custom {
  width: auto;
  background: linear-gradient(135deg, #5a7ec9, #8cb0ff);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Actions row */
.watcher-page .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 10px;
}

.watcher-page .action-btn {
  background: rgba(0, 0, 0, 0.35);
  color: #e5e7eb;
  border: 1px solid rgba(140, 176, 255, 0.25);
  padding: 10px 14px;
  border-radius: 12px;
}
.watcher-page .action-btn:hover {
  border-color: rgba(140, 176, 255, 0.45);
  box-shadow: 0 8px 18px rgba(140, 176, 255, 0.12);
}

.watcher-page .btn-analyze {
  border-color: rgba(140, 176, 255, 0.45);
}

/* Video */
.watcher-page .video-player {
  width: 100%;
  height: 320px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  margin: 12px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

/* Options blocks */
.watcher-page .options {
  background: rgba(140, 176, 255, 0.08);
  border: 1px solid rgba(140, 176, 255, 0.18);
  padding: 14px;
  border-radius: 12px;
  margin: 12px 0;
  display: none;
}

.watcher-page .sep {
  text-align: center;
  color: #9ca3af;
  margin: 10px 0;
}

/* Result area */
.watcher-page .result-area {
  margin-top: 18px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.watcher-page .job-wrap {
  margin-bottom: 10px;
}

.watcher-page .job-status {
  color: #a3c3ff;
  margin-bottom: 8px;
  font-size: 14px;
}

.watcher-page .progress-container {
  width: 100%;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  height: 10px;
  margin-bottom: 6px;
}

.watcher-page .progress-bar {
  height: 10px;
  width: 0%;
  background: linear-gradient(90deg, #8cb0ff, #a3c3ff);
}

.watcher-page .progress-text {
  color: #cbd5e1;
  font-size: 13px;
  margin-bottom: 8px;
}

/* Markdown output */
.watcher-page .markdown {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px;
  border-radius: 12px;
  white-space: normal;
  text-align: right;
  line-height: 1.8;
}

.watcher-page .markdown[dir="ltr"] { text-align: left; }

.watcher-page .markdown h1,
.watcher-page .markdown h2,
.watcher-page .markdown h3 {
  color: #a3c3ff;
  margin: 10px 0 6px;
}

.watcher-page .markdown ul,
.watcher-page .markdown ol {
  padding-inline-start: 22px;
}

.watcher-page .markdown code {
  background: rgba(255,255,255,0.10);
  padding: 2px 6px;
  border-radius: 8px;
}

.watcher-page .markdown pre {
  background: rgba(255,255,255,0.08);
  padding: 10px;
  border-radius: 12px;
  overflow: auto;
}

/* Result actions */
.watcher-page .result-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* Modals */
.watcher-page .modal {
  display: none;
  position: fixed;
  z-index: 1000;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
}

.watcher-page .modal-content {
  background: rgba(10, 15, 26, 0.92);
  padding: 18px;
  border-radius: 16px;
  width: 92%;
  max-width: 520px;
  border: 1px solid rgba(140, 176, 255, 0.22);
}

.watcher-page .modal-content h3 {
  color: #8cb0ff;
  margin: 0 0 10px;
}

.watcher-page .modal-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.watcher-page .footer {
  text-align: center;
  color: #8a96a8;
  font-size: 14px;
  margin: 18px 0 24px;
  padding: 14px;
  border-top: 1px solid rgba(140, 176, 255, 0.12);
}

@media (max-width: 768px) {
  .watcher-page .header .logo-img { max-width: 170px; }
  .watcher-page .header .app-title { font-size: 24px; }
  .watcher-page .video-player { height: 240px; }
}

/* --- New Local Downloader Tabs Styling --- */

.os-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.os-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: #aaa;
    padding: 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.os-tab:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.os-tab.active {
    color: #8cb0ff; /* Blue for active */
    border-bottom: 3px solid #8cb0ff;
    font-weight: bold;
    background: rgba(140, 176, 255, 0.1);
}

.os-content {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 0 0 8px 8px;
    animation: fadeIn 0.3s ease;
}

.guide-steps {
    text-align: right;
    direction: rtl;
    margin-bottom: 20px;
    font-size: 0.9em;
    line-height: 1.8;
    color: #e0e0e0;
}

.guide-steps ol {
    margin: 0;
    padding-right: 20px;
}

.guide-steps li {
    margin-bottom: 8px;
}

.download-btn {
    display: block;
    width: 100%;
    padding: 12px;
    text-align: center;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: transform 0.2s;
}

.download-btn:hover {
    transform: translateY(-2px);
}

.windows-btn {
    background: linear-gradient(45deg, #0078D7, #00bcf2);
    color: white !important;
}

.mac-btn {
    background: linear-gradient(45deg, #333333, #555555);
    color: white !important;
}

.activation-area {
    text-align: center;
}

.action-btn {
    width: 100%;
    margin-bottom: 10px;
    padding: 12px;
    background: linear-gradient(90deg, #5a7ec9, #8cb0ff);
    color: #fff;
    border: 1px solid rgba(140, 176, 255, 0.22);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(140, 176, 255, 0.25);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Guide screenshot styling */
.watcher-page .guide-screenshot {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid rgba(140, 176, 255, 0.3);
    margin-top: 12px;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    display: block;
}

/* Copy button for Terminal commands */
.watcher-page .copy-btn {
    background: #5a7ec9 !important;
    color: #fff !important;
    border: none !important;
    border-radius: 4px !important;
    padding: 4px 10px !important;
    font-size: 0.75em !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.watcher-page .copy-btn:hover {
    background: #8cb0ff !important;
    box-shadow: 0 4px 12px rgba(140, 176, 255, 0.25) !important;
}

/* ═══════════════════════════════════════════════════════
   CHAT HISTORY + RESULT CARDS + CUSTOMIZATION PANEL
   ═══════════════════════════════════════════════════════ */

/* ── Customization Panel ── */
.watcher-page .customization-panel {
  background: rgba(15, 25, 45, 0.85);
  border: 1px solid rgba(100, 150, 255, 0.15);
  border-radius: 10px;
  padding: 15px;
  margin: 12px 0;
  display: none;
}
.watcher-page .customization-panel.open { display: block; }
.watcher-page .customization-panel h4 {
  margin: 0 0 12px; color: #8cb0ff; font-size: 0.95rem;
}
.watcher-page .custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.watcher-page .custom-grid label {
  font-size: 0.82rem; color: #94a3c8; margin-bottom: 2px; display: block;
}
.watcher-page .custom-grid select,
.watcher-page .custom-grid input[type="number"] {
  width: 100%; padding: 7px 10px; border-radius: 6px;
  border: 1px solid rgba(100,150,255,0.2); background: #0d1525; color: #e0e6f0;
  font-size: 0.88rem;
}

/* ── Toggle Customization Button ── */
.watcher-page .btn-customize {
  background: linear-gradient(135deg, #2c3e6d, #1a2744);
  border: 1px solid rgba(100,150,255,0.2); color: #8cb0ff;
  padding: 8px 16px; border-radius: 8px; cursor: pointer;
  font-size: 0.88rem; width: 100%; margin: 8px 0;
  transition: all 0.2s;
}
.watcher-page .btn-customize:hover {
  background: linear-gradient(135deg, #3a4f80, #243358);
  border-color: rgba(100,150,255,0.4);
}

/* ── Chat History Container ── */
.watcher-page .chat-history {
  max-height: 70vh;
  overflow-y: auto;
  padding: 5px 0;
  scroll-behavior: smooth;
}
.watcher-page .chat-history::-webkit-scrollbar { width: 6px; }
.watcher-page .chat-history::-webkit-scrollbar-track { background: transparent; }
.watcher-page .chat-history::-webkit-scrollbar-thumb {
  background: rgba(100,150,255,0.25); border-radius: 3px;
}

/* ── Result Card ── */
.watcher-page .result-card {
  background: rgba(12, 20, 40, 0.9);
  border: 1px solid rgba(100,150,255,0.15);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color 0.3s;
  animation: cardSlideIn 0.35s ease-out;
}
.watcher-page .result-card:hover {
  border-color: rgba(100,150,255,0.35);
}
.watcher-page .result-card.card-error {
  border-color: rgba(255,80,80,0.4);
}

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card Header ── */
.watcher-page .card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 15px;
  background: rgba(20, 35, 65, 0.6);
  cursor: pointer; user-select: none;
  transition: background 0.2s;
}
.watcher-page .card-header:hover {
  background: rgba(25, 42, 78, 0.8);
}
.watcher-page .card-header-left {
  display: flex; align-items: center; gap: 10px;
}
.watcher-page .card-task-badge {
  background: rgba(100,150,255,0.15); color: #8cb0ff;
  padding: 3px 10px; border-radius: 12px; font-size: 0.78rem; font-weight: 600;
  white-space: nowrap;
}
.watcher-page .card-error .card-task-badge {
  background: rgba(255,80,80,0.15); color: #ff6b6b;
}
.watcher-page .card-time {
  font-size: 0.75rem; color: #607090;
}
.watcher-page .card-header-right {
  display: flex; align-items: center; gap: 6px;
}
.watcher-page .card-toggle {
  background: none; border: none; color: #607090; cursor: pointer;
  font-size: 1.1rem; padding: 2px 6px; transition: transform 0.3s;
}
.watcher-page .result-card.collapsed .card-toggle {
  transform: rotate(-90deg);
}

/* ── Card Body ── */
.watcher-page .card-body {
  max-height: 2000px; overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
  padding: 15px;
}
.watcher-page .result-card.collapsed .card-body {
  max-height: 0; padding: 0 15px;
}

/* ── Card Markdown ── */
.watcher-page .card-body .card-markdown {
  color: #d0d8e8; font-size: 0.92rem; line-height: 1.75; direction: rtl;
}
.watcher-page .card-markdown h1,
.watcher-page .card-markdown h2,
.watcher-page .card-markdown h3 { color: #8cb0ff; margin: 14px 0 8px; }
.watcher-page .card-markdown ul,
.watcher-page .card-markdown ol { padding-right: 20px; margin: 8px 0; }
.watcher-page .card-markdown code {
  background: rgba(100,150,255,0.1); padding: 2px 6px; border-radius: 4px;
  font-family: monospace; font-size: 0.85em;
}
.watcher-page .card-markdown pre {
  background: rgba(0,0,0,0.4); padding: 12px; border-radius: 8px;
  overflow-x: auto; direction: ltr;
}

/* ── Card Edit Mode ── */
.watcher-page .card-edit-area {
  width: 100%; min-height: 200px; padding: 12px;
  background: #0d1525; color: #d0d8e8; border: 1px solid rgba(100,150,255,0.2);
  border-radius: 8px; font-size: 0.9rem; line-height: 1.6;
  resize: vertical; direction: rtl; font-family: inherit;
  display: none;
}
.watcher-page .result-card.editing .card-edit-area { display: block; }
.watcher-page .result-card.editing .card-markdown { display: none; }

/* ── Card Actions ── */
.watcher-page .card-actions {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 10px 15px; border-top: 1px solid rgba(100,150,255,0.08);
  background: rgba(15, 25, 45, 0.4);
}
.watcher-page .card-actions button {
  padding: 5px 12px; border-radius: 6px; border: 1px solid rgba(100,150,255,0.15);
  background: rgba(20,35,60,0.6); color: #8cb0ff; cursor: pointer;
  font-size: 0.78rem; transition: all 0.2s; white-space: nowrap;
}
.watcher-page .card-actions button:hover {
  background: rgba(30,50,85,0.8); border-color: rgba(100,150,255,0.35);
}
.watcher-page .card-actions .btn-delete {
  color: #ff6b6b; border-color: rgba(255,80,80,0.2);
}
.watcher-page .card-actions .btn-delete:hover {
  background: rgba(255,60,60,0.15);
}
.watcher-page .card-actions .btn-edit-save {
  color: #2ecc71; border-color: rgba(46,204,113,0.3);
}

/* ── Clear History ── */
.watcher-page .history-controls {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; padding: 0 2px;
}
.watcher-page .history-controls span {
  color: #607090; font-size: 0.82rem;
}
.watcher-page .btn-clear-history {
  background: none; border: 1px solid rgba(255,80,80,0.2); color: #ff6b6b;
  padding: 4px 12px; border-radius: 6px; cursor: pointer; font-size: 0.78rem;
}
.watcher-page .btn-clear-history:hover {
  background: rgba(255,60,60,0.1);
}

/* ── Progress inside card ── */
.watcher-page .card-progress {
  padding: 15px;
}
.watcher-page .card-progress .progress-container {
  display: block !important;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .watcher-page .custom-grid { grid-template-columns: 1fr; }
  .watcher-page .card-actions { gap: 4px; }
  .watcher-page .card-actions button { font-size: 0.72rem; padding: 4px 8px; }
}

/* ── Force customization panel visibility fix ── */
.customization-panel.open,
.watcher-page .customization-panel.open,
#customPanel.open {
  display: block !important;
}

/* ── RTL Bullet & List Fix ── */
.watcher-page .card-markdown ul,
.watcher-page .card-markdown ol {
  padding-right: 30px;
  padding-left: 0;
  margin-right: 0;
  margin-left: 0;
  list-style-position: outside;
  direction: rtl;
  text-align: right;
}
.watcher-page .card-markdown ul li,
.watcher-page .card-markdown ol li {
  direction: rtl;
  text-align: right;
  padding: 4px 0;
  margin-right: 0;
}
.watcher-page .card-markdown ul {
  list-style-type: disc;
}
.watcher-page .card-markdown ol {
  list-style-type: arabic-indic;
}
.watcher-page .card-markdown h1,
.watcher-page .card-markdown h2,
.watcher-page .card-markdown h3,
.watcher-page .card-markdown h4 {
  direction: rtl;
  text-align: right;
}
.watcher-page .card-markdown p {
  direction: rtl;
  text-align: right;
}
/* English content detection - override for LTR */
.watcher-page .card-markdown[dir="ltr"] ul,
.watcher-page .card-markdown[dir="ltr"] ol {
  padding-left: 25px;
  padding-right: 0;
  direction: ltr;
  text-align: left;
}
.watcher-page .card-markdown[dir="ltr"] li,
.watcher-page .card-markdown[dir="ltr"] p,
.watcher-page .card-markdown[dir="ltr"] h1,
.watcher-page .card-markdown[dir="ltr"] h2,
.watcher-page .card-markdown[dir="ltr"] h3 {
  direction: ltr;
  text-align: left;
}
