/* =========================
   SIME ühtne teema (hele + tume)
   Kasutus: html[data-theme="light"|"dark"]
   ========================= */

:root,
html[data-theme="light"]{
  color-scheme: light;

  --bg:#f3f4f6;           /* hele hall */
  --text:#1f2328;
  --muted:#5b616b;

  --card-bg:#ffffff;
  --border:#d0d7de;

  --accent:#ff9800;
  --link:#b34700;

  --header-bg:#ff9800;
  --header-text:#ffffff;
  --header-link:#ffe6b8;

  --th-bg:#ff9800;
  --th-text:#ffffff;

  --row-hover-bg:#eef2f7;
  --row-selected-bg:#fde7c8;
  --row-selected-outline:#ff980066;
  --ok:#2ea043;
  --danger:#d1242f;
}

html[data-theme="dark"]{
  color-scheme: dark;

  /* slate-tumedus (mitte must/pruun) */
  --bg:#0f172a;           /* slate-900 */
  --text:#e5e7eb;         /* slate-200 */
  --muted:#94a3b8;        /* slate-400 */

  --card-bg:#111827;      /* slate-900/800 */
  --border:#334155;       /* slate-700 */

  --accent:#ff9800;
  --link:#ffcf8a;

  --header-bg:#ff9800;
  --header-text:#ffffff;
  --header-link:#ffe6b8;

  --th-bg:#ff9800;
  --th-text:#ffffff;

  --row-hover-bg:#162033;       /* veidi heledam slate */
  --row-selected-bg:#22324f;    /* valitud rida */
  --row-selected-outline:#ff980080;
  --ok:#3fb950;
  --danger:#ff6b6b;
}

/* Baasvärvid */
html, body{
  background: var(--bg);
  color: var(--text);
}
a{ color: var(--link); }
.muted{ color: var(--muted); }

/* kaartide/boxide taust/äär */
.card, .header, .results-container, .splits-container, .table-scroll{
  background: var(--card-bg);
  border-color: var(--border);
}

/* ===========================
   SIME-style.css
   =========================== */

/* --- Teema muutujad --- */
/* Üldine */
html, body { overflow-x:auto; }
body { font-family:Arial, sans-serif; background:var(--bg); color:var(--text); margin:20px; }
a { color:var(--link); }
a.upArrow { font-weight:bold; text-decoration:none; color:var(--link); }

/* Päis – oranž mõlemas teemas */
.header{
  background:var(--header-bg); color:var(--header-text);
  padding:15px; border-radius:10px; box-shadow:10px 10px 30px rgba(0,0,0,.25);
  display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;
}
.header-left{ display:flex; flex-direction:column; }
.header-left h1{ margin:0; font-size:28px; color:var(--header-text); }
.event-date{ margin:5px 0; font-size:16px; color:var(--header-text); opacity:.95; }
.header-info{ display:flex; gap:20px; font-size:14px; }
.header-info span{ white-space:nowrap; }
.header-right{ flex-shrink:0; display:flex; align-items:center; gap:8px; }
.header-right img.logo{ max-height:100px; }

/* Päise ristlingid */
.header a, h4 a { color:var(--header-link) !important; text-decoration:underline; font-weight:700; }

h1, h4 { color:#fff; background:var(--accent); margin:10px 0; }
h2, h3 { color:var(--accent); margin:10px 0; }

/* Sisu konteinerid */
.results-container, .splits-container { width:100%; max-width:100%; overflow:visible; margin:0; }

/* Flash / kustutamise teade */
.alert{border:1px solid var(--border);background:var(--card-bg);border-radius:12px;padding:10px 12px;box-shadow:0 6px 18px rgba(0,0,0,.06);}
.alert-ok{border-color:#2e7d3233;}
.del-list{margin-top:8px;display:flex;flex-direction:column;gap:6px;}
.del-item{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap;}
.del-item .mono{font-size:12px;}

/* Üleslaadimise kaardid */
.container{max-width:100%;width:calc(100% - 32px);margin:20px auto;}
.card{border:1px solid var(--border);border-radius:10px;padding:16px;background:var(--card-bg);
      box-shadow:0 3px 18px rgba(0,0,0,.08);margin:16px 0;color:var(--text);}
.muted{color:var(--muted);font-size:90%}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;}
.btn{display:inline-block;padding:8px 14px;border-radius:6px;border:0;background:var(--accent);color:#fff;
     text-decoration:none;font-weight:bold;cursor:pointer}
.btn.secondary{background:#777}
label strong{font-weight:bold}
input[type=file]{padding:8px;border:1px solid var(--accent);border-radius:6px;color:var(--text);background:var(--card-bg)}

/* Tume teema – upload/kinnitus/õnnestus plokid (inline-hele taust → tume) */
html[data-theme="dark"] #previewBox,
html[data-theme="dark"] .card[style*="#fff9f0"],
html[data-theme="dark"] .card[style*="#f7fff7"]{
  background:var(--card-bg) !important;
  color:var(--text) !important;
  border-color:var(--border) !important;
}

/* Tabelid */
table{
  width:max-content; border-collapse:collapse; margin:0 0 20px 0;
  table-layout:auto; white-space:nowrap; font-size:12px; color:var(--text);
}
table, th, td{ border:1px solid var(--border); }
th, td{ padding:4px 6px; text-align:left; }
th{ background:var(--th-bg); color:var(--th-text); }
.right{ text-align:right; }
small{ font-size:90%; color:var(--muted); }
strong{ font-weight:bold; color:var(--text); }

/* Hover/kliki valik */
table tbody tr{ cursor:pointer; }
table tr:hover{ background:var(--row-hover-bg); color:var(--text); }
table tr.clicked{ background:var(--row-selected-bg) !important; outline:1px solid var(--row-selected-outline); color:var(--text); }

/* Ainult alumine kerimisriba */
.table-scroll{ overflow-x:auto; overflow-y:visible; width:100%; -webkit-overflow-scrolling:touch; }
.table-scroll > table{ width:max-content; }

/* Vaheajad ekraanil kompaktsem */
body.page-splits table{ font-size:11px; }
body.page-splits th, body.page-splits td{ padding:3px 5px; }

/* Blooke mitte murda */
.page-keep{ break-inside:avoid-page; page-break-inside:avoid; margin-bottom:12px; }

/* Teemanupp */
.theme-toggle{
  position:fixed; right:12px; top:12px; z-index:1000;
  width:38px; height:38px; border-radius:999px; border:1px solid var(--border);
  background:var(--card-bg); color:var(--text);
  display:inline-flex; align-items:center; justify-content:center;
  box-shadow:0 2px 10px rgba(0,0,0,.15);
}
.theme-toggle svg{ width:20px; height:20px; fill:currentColor; }
.theme-toggle .icon-sun{ display:inline; } .theme-toggle .icon-moon{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-sun{ display:none; }
html[data-theme="dark"] .theme-toggle .icon-moon{ display:inline; }

/* --- PRINT --- */
@page results { size:A4 portrait;  margin:10mm; }
@page splits  { size:A4 landscape; margin:10mm; }

@media print{
  html{ color-scheme:light; }
  html, body{ height:auto !important; overflow:visible !important; }

  .theme-toggle{ display:none !important; }

  body.page-results{ page:results; }
  body.page-splits{ page:splits; }

  body, .results-container, .splits-container, .header{
    background:none !important; box-shadow:none !important; margin:0 !important; padding:0 !important;
  }
  .class-links, a.upArrow{ display:none !important; }

  .header, .header *{ color:#000 !important; -webkit-text-fill-color:#000 !important; }
  a{ color:#000 !important; text-decoration:none !important; }

  /* Hover/kliki neutraliseerimine (read jäävad alles) */
  table tr.clicked, table tr:hover{ background:none !important; outline:none !important; color:#000 !important; }

  /* Pealkirjad kompaktseks; klassi/rada nimi väiksem */
  h1, h4, h2{ background:none !important; color:#000 !important; margin:0 0 6px 0 !important; padding:0 !important; }
  h3{ background:none !important; color:#000 !important; margin:4px 0 4px 0 !important; padding:0 !important; font-size:12px !important; }

  /* Kerimisribad peitu; tabelid mitte venitada */
  *{ scrollbar-width:none !important; -webkit-print-color-adjust:exact !important; print-color-adjust:exact !important; }
  *::-webkit-scrollbar{ display:none !important; width:0 !important; height:0 !important; }
  .table-scroll{ overflow:visible !important; margin:0 0 6px 0 !important; }

  table{
    border-collapse:collapse !important;
    width:max-content !important;
    table-layout:fixed !important;   /* tulemuste lehel colgroup määrab veerud */
    white-space:nowrap !important;
    color:#000 !important; -webkit-text-fill-color:#000 !important;
    margin:0 0 6px 0 !important;
  }

  /* Õhemad, heledamad jooned */
  table, th, td{ border:0.35pt solid #999 !important; }
  th, td, strong, small{ color:#000 !important; -webkit-text-fill-color:#000 !important; }

  /* Tulemused: font */
  body.page-results table{ font-size:10px !important; }

  /* Vaheajad: teised klassid jäävad 11px; ainult Valik vähendab vajadusel */
  body.page-splits table{ font-size:11px !important; }
  body.page-splits table.is-selection{ font-size:var(--fs, 9px) !important; }
}
/* Header force orange (mõlemas režiimis) */
.header{
  background: var(--header-bg) !important;
  color: var(--header-text) !important;
}
.header a{ color: var(--header-link) !important; }


/* ===========================
   Admin tabel (XML haldus)
   =========================== */
.table-wrap{overflow-x:auto; -webkit-overflow-scrolling:touch;}
.admin-table{width:100%; border-collapse:collapse; font-size:14px; table-layout:auto;}
.admin-table th, .admin-table td{border-bottom:1px solid var(--border); padding:10px 10px; vertical-align:top; white-space:nowrap;}
.admin-table thead th{background:rgba(0,0,0,.03); color:var(--text); font-weight:800;}
html[data-theme="dark"] .admin-table thead th{background:rgba(255,255,255,.06);}
.admin-table tr:hover td{background:rgba(255,152,0,.06);}
.xml-col .xml-line{display:flex; align-items:center; gap:10px;}
.pills{display:flex; flex-wrap:nowrap; gap:8px; margin-top:6px;}
.pill{display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:800; border:1px solid transparent;}
.pill-ok{background:rgba(46,160,67,.12); color:var(--ok); border-color:rgba(46,160,67,.25);}
.pill-missing{background:rgba(125,133,144,.12); color:var(--muted); border-color:rgba(125,133,144,.25);}
.btn-row{display:flex; flex-wrap:nowrap; gap:8px; align-items:center;}
.inline-form{display:inline-block; margin:0;}
.btn.success{background:var(--ok);}
.btn.danger{background:var(--danger);}
.btn.danger:hover{filter:brightness(0.95);}
.btn[disabled]{opacity:.55; cursor:not-allowed;}


/* Failivaate paanid (renderdatud + RAW) */
.view-split{display:flex;flex-direction:column;gap:14px;min-width:0;}
.view-pane{flex:1 1 0;min-width:0;}

/* Püüa hoida renderdatud ja RAW ekraanil pooleks */
@media (min-height: 700px){
  .view-split{height: calc(100vh - 280px);}
  .view-pane{min-height: 0;}
}

.file-iframe{
  display:block;
  width:100%;
  height:100%;
  min-height:320px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--bg);
}

.file-pre{
  display:block;
  width:100%;
  height:100%;
  min-height:320px;
  overflow:auto;
  white-space:pre;
  padding:12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--bg);
  color:var(--text);
  font-size:12px;
  line-height:1.35;
}

