/*
 * Styles for MarkItDown Web.
 * Tokens 1:1 from the Nagarro Tenant brand (mirrors the rfp-ppt/webapp
 * style system so the two apps feel like siblings).
 *
 * Falls sich der zugrundeliegende Style-Guide ändert, diese Datei danach abgleichen.
 */

/* === Tokens (Nagarro Tenant Brand) ====================================== */
:root {
  /* Brand */
  --brand:         #06041F;  /* Nagarro Petrol */
  --brand-dark:    #13294B;  /* Nightfall Blue */
  --brand-hover:   #1a1838;
  --brand-soft:    #e8e7f0;
  --brand-soft-mint: #e3f5f1;
  --accent:        #47D7AC;  /* Nagarro Mint */
  --accent-d:      #ff5a3c;  /* Coral */
  --accent-soft:   #e4f7f0;

  /* Status */
  --success:       #19875f;  --success-soft: #e4f6ee;
  --warning:       #a96d10;  --warning-soft: #fff3dc;
  --danger:        #c13c4a;  --danger-soft:  #fcedef;

  /* Neutral */
  --bg:            #f5f7f8;
  --surface:       #ffffff;
  --surface-soft:  #f8fafb;
  --surface-hover: #f2f6f5;
  --text:          #16212b;
  --text-muted:    #68757e;
  --text-soft:     #929da5;
  --border:        #e1e7ea;
  --border-strong: #cdd7db;

  /* Geometry */
  --radius-md: 13px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 3px 10px rgba(15,23,42,.04);
  --shadow-md: 0 12px 30px rgba(15,23,42,.08), 0 2px 8px rgba(15,23,42,.04);
  --shadow-login: 0 20px 60px rgba(6,4,31,.35);

  /* Type */
  --font-ui:  Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* === Base =============================================================== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

input, select, textarea {
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input, select { height: 42px; padding: 0 12px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(71,215,172,.18);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* === Layout ============================================================= */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Header (Nagarro Petrol gradient) ==================================== */
header.app-header {
  height: 96px;
  display: flex;
  align-items: center;
  background: linear-gradient(115deg, #06041F 0%, #091d3b 55%, #13294B 100%);
  border-bottom: 2px solid var(--accent);
  color: #fff;
}
header.app-header .page {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand-block {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  transition: background .15s ease, opacity .15s ease;
}
.brand-block:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.brand-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Tagline-Logo auf dem dunklen Header (Mint-grün + weiß) */
header.app-header .brand-logo {
  background: transparent;
  border-radius: 0;
  width: auto; height: 80px;
  display: block; object-fit: contain;
}
.brand-name { font-size: 17px; font-weight: 760; letter-spacing: -.01em; }
.brand-badge {
  text-transform: uppercase; letter-spacing: .06em; font-weight: 800;
  font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #fff;
}

/* Top-bar Tabs (z.B. "Upload" auf der rechten Seite) */
.topbar-tabs {
  display: flex; gap: 4px;
  margin: 0 16px;
}
.topbar-tab {
  padding: 6px 14px;
  color: rgba(255,255,255,.7);
  font-size: 13px; font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
  display: inline-block;
}
.topbar-tab:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.topbar-tab.active {
  background: var(--accent); color: #073d2f;
}
.topbar-tab-button {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.7);
  font: inherit;
  font-size: 13px; font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
.topbar-tab-button:hover { background: rgba(255,255,255,.08); color: #fff; }

/* User-Info rechts oben im Header */
.header-user {
  display: flex; align-items: center; gap: 10px; margin-left: 16px;
}
.header-user-name {
  font-size: 12.5px; color: rgba(255,255,255,.7); white-space: nowrap;
}
.header-user-role {
  font-size: 10.5px; font-weight: 760;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #fff;
  letter-spacing: .04em; text-transform: uppercase;
}

/* === Buttons (§2.1) ====================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: .55rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .05s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--brand);  color: #fff; border-color: var(--brand); }
.btn-primary:hover  { background: var(--brand-hover); }
.btn-primary:disabled { background: var(--border-strong); border-color: var(--border-strong); cursor: not-allowed; }
.btn-accent   { background: var(--accent); color: #073d2f; border-color: var(--accent); }
.btn-accent:hover { filter: brightness(1.04); }
.btn-secondary {
  background: var(--surface);
  color: var(--brand);
  border-color: var(--brand);
}
.btn-secondary:hover { background: var(--surface-soft); }
.btn-ghost    {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-soft); color: var(--text); }
.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-danger-ghost:hover { color: var(--danger); background: var(--danger-soft); }

/* === Login-Page ========================================================== */
body.login-page {
  margin: 0; min-height: 100vh;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-login);
  padding: 36px 32px 28px;
  animation: rise .35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--brand); color: var(--accent);
  display: grid; place-items: center;
  font-weight: 800; font-size: 22px;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-text { line-height: 1.2; }
.brand-title { font-weight: 700; font-size: 15px; color: var(--brand); }
.brand-sub { font-size: 12px; color: var(--text-muted); }
.brand-tagline { margin: 14px 0 22px; height: 24px; }
.brand-tagline img { height: 100%; width: auto; display: block; }

.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card .lead { margin: 0 0 22px; color: var(--text-muted); font-size: 13.5px; }
.login-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.login-card .field { margin-bottom: 16px; }
.login-card input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; background: #fbfdfd;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(71,215,172,.25);
}
.login-card .btn-primary-block {
  width: 100%; padding: 12px;
  border: 0; border-radius: 9px;
  background: var(--accent); color: #073d2f;
  font-weight: 700; font-size: 14.5px;
  cursor: pointer; margin-top: 4px;
  transition: filter .15s, transform .05s;
}
.login-card .btn-primary-block:hover { filter: brightness(1.04); }
.login-card .btn-primary-block:active { transform: translateY(1px); }
.login-card .btn-primary-block:disabled { opacity: .6; cursor: progress; }
.login-card .sso-btn {
  width: 100%; padding: 12px;
  border: 1px solid var(--brand); border-radius: 9px;
  background: var(--surface); color: var(--brand);
  font-weight: 700; font-size: 14.5px;
  cursor: pointer; margin-top: 4px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, transform .05s;
  text-decoration: none;
}
.login-card .sso-btn:hover { background: #f0f3f5; text-decoration: none; }
.login-card .sso-btn:active { transform: translateY(1px); }
.login-card .sso-btn .sso-mark {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--brand); color: #fff;
  font-size: 12px; font-weight: 800;
}
.login-card .divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
}
.login-card .divider::before, .login-card .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.login-card .error {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 9px;
  background: var(--danger-soft); color: var(--danger); font-size: 13px;
}
.login-card .pending { display: none; text-align: center; padding: 8px 0; color: var(--text-muted); font-size: 13px; }
.login-card .pending.show { display: block; }
.login-card .warn {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 9px;
  background: var(--warning-soft); color: var(--warning); font-size: 13px;
}
.login-card .foot {
  margin-top: 20px; font-size: 11.5px; color: var(--text-muted); text-align: center;
}

/* === Main-Bereich ======================================================== */
main.app-main {
  flex: 1;
  padding: 32px 0 48px;
}
.page-title {
  font-size: 22px; font-weight: 760; color: var(--text);
  margin: 0 0 4px; letter-spacing: -.01em;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 13.5px;
  margin: 0 0 16px;
}
.page-info-pill {
  display: inline-block;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--text-muted);
  margin: 0 0 24px;
}

/* === Dropzone ============================================================ */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  background: var(--surface-soft);
  color: var(--text-muted);
  transition: border-color .15s ease, background .15s ease, color .15s ease;
  cursor: pointer;
  margin-bottom: 16px;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--brand);
}
.dropzone-icon {
  font-size: 32px; line-height: 1; margin-bottom: 8px;
  color: var(--text-soft);
}
.dropzone-title { font-weight: 700; font-size: 14px; color: var(--text); }
.dropzone-sub   { font-size: 12px; margin-top: 4px; }

/* === File-List (Pre-Convert) ============================================= */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13.5px;
}
.file-row-icon { color: var(--text-muted); }
.file-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-size { color: var(--text-soft); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.file-row-remove {
  background: transparent; border: none;
  color: var(--text-soft); font-size: 14px; line-height: 1;
  padding: 2px 6px; cursor: pointer;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
}
.file-row-remove:hover { color: var(--danger); background: var(--danger-soft); }

/* === Action-Bar ========================================================== */
.action-bar {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0;
  font-size: 13px;
  flex-wrap: wrap;
}
.action-bar .status { margin-left: auto; color: var(--text-muted); font-size: 12.5px; }

/* === Errors display ====================================================== */
.errors { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.error-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--danger-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--danger);
}
.error-row-filename { font-weight: 700; }
.error-row-msg { font-size: 12.5px; color: var(--danger); opacity: .85; }

/* === History ============================================================= */
.history-section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 32px;
}
.history-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.history-title {
  font-size: 11.5px; font-weight: 760; color: var(--text);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 0;
}
.history-count { font-size: 11.5px; color: var(--text-soft); margin-left: 6px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-empty {
  font-size: 13px; color: var(--text-soft); font-style: italic;
  padding: 10px 4px;
}
.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}
.history-card-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.history-card-count {
  font-size: 12px; font-weight: 760; color: var(--text);
}
.history-card-sep { color: var(--text-soft); font-size: 11px; }
.history-card-meta { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.history-card-size {
  margin-left: auto; font-size: 11.5px; color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.history-files {
  list-style: none; padding: 0; margin: 0 0 8px;
  display: flex; flex-direction: column; gap: 2px;
}
.history-file {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0;
  font-size: 13px;
}
.history-file-icon { color: var(--text-soft); font-size: 14px; }
.history-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-file-size { font-size: 11.5px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.history-card-actions {
  display: flex; align-items: center; gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* === Footer ============================================================== */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.app-footer-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  font-size: 12px;
  color: var(--text-muted);
  max-width: 1100px; margin: 0 auto;
}

/* === Screen-reader-only ================================================== */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* === Responsive ========================================================= */
@media (max-width: 700px) {
  header.app-header { height: auto; padding: 12px 0; }
  header.app-header .page { flex-wrap: wrap; gap: 12px; }
  .topbar-tabs { margin: 0; }
  header.app-header .brand-logo { height: 48px; }
  .brand-name { font-size: 15px; }
  .app-footer-inner { flex-direction: column; gap: 4px; text-align: center; }
}
