/* Design system — Prosfores Leon (Laravel + Blade, no build step) */

:root {
  --font-ui: "Fira Sans", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", sans-serif;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 14px;
  --radius-pill: 999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --icon-size: 20px;
  --shadow-1: 0 1px 2px rgb(15 42 68 / .08);
  --shadow-2: 0 4px 16px -4px rgb(15 42 68 / .16);
  --transition: 180ms ease;
}

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg: #eef1f6;
  --bg-accent: radial-gradient(1200px 400px at 80% -100px, rgb(184 134 11 / .12), transparent 60%),
    radial-gradient(900px 380px at 10% -80px, rgb(15 42 68 / .10), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f3f6fa;
  --text: #17233a;
  --text-muted: #5b6b82;
  --border: #d9e0ea;
  --primary: #0f2a44;
  --on-primary: #ffffff;
  --primary-hover: #1a3a5c;
  --gold: #b8860b;
  --gold-text: #7d5f06;
  --gold-soft: #faf3df;
  --info: #1d5fb8;
  --info-soft: #e7f0fd;
  --success: #1c7a3d;
  --success-soft: #e4f4e9;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --neutral-soft: #edf1f6;
  --ring: #2f6fed;
  --topbar-bg: rgb(15 42 68 / .92);
  --topbar-text: #ffffff;
  --input-bg: #ffffff;
  --row-hover: #f4f7fb;
  --header-row-bg: #0f2a44;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --bg-accent: radial-gradient(1200px 400px at 80% -100px, rgb(184 134 11 / .10), transparent 60%),
    radial-gradient(900px 380px at 10% -80px, rgb(80 120 180 / .12), transparent 60%);
  --surface: #141d31;
  --surface-2: #1a2540;
  --text: #e9eef6;
  --text-muted: #9aa8c0;
  --border: #2b3a55;
  --primary: #4f7ab5;
  --on-primary: #0b1220;
  --primary-hover: #6b93c9;
  --gold: #d9a91f;
  --gold-text: #e3b83c;
  --gold-soft: rgb(217 169 31 / .14);
  --info: #7aa8ec;
  --info-soft: rgb(122 168 236 / .14);
  --success: #5fce8a;
  --success-soft: rgb(95 206 138 / .13);
  --danger: #f08a83;
  --danger-soft: rgb(240 138 131 / .13);
  --neutral-soft: #202c46;
  --ring: #8ab4ff;
  --topbar-bg: rgb(10 17 30 / .85);
  --topbar-text: #eef2f9;
  --input-bg: #101a2e;
  --row-hover: #1a2540;
  --header-row-bg: #1c2946;
}

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  background-image: var(--bg-accent);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
}
h1 { font-size: 1.45rem; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: var(--space-5) 0 var(--space-2); }
h3 { font-size: 1rem; margin: var(--space-4) 0 var(--space-2); }
a { color: var(--primary); }
::selection { background: var(--gold); color: #1a1a1a; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: var(--radius-s);
}

.skip-link {
  position: absolute; left: var(--space-3); top: -48px;
  background: var(--primary); color: var(--on-primary);
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-s);
  transition: top var(--transition); z-index: 100;
}
.skip-link:focus { top: var(--space-2); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap;
  padding: 10px var(--space-5);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgb(255 255 255 / .14);
  color: var(--topbar-text);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.02rem; }
.brand img { width: 34px; height: 34px; object-fit: contain; background: #fff; border-radius: 50%; padding: 2px; }
.brand small { font-weight: 400; opacity: .72; font-size: .82rem; }
.topbar nav { display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
.topbar nav a {
  color: var(--topbar-text); text-decoration: none; opacity: .78;
  padding: 7px 13px; border-radius: var(--radius-pill);
  font-size: .92rem; transition: opacity var(--transition), background var(--transition);
}
.topbar nav a:hover { opacity: 1; background: rgb(255 255 255 / .12); }
.topbar nav a.active { opacity: 1; background: rgb(255 255 255 / .18); font-weight: 600; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 40px; min-height: 40px; padding: 6px;
  background: transparent; border: 1px solid rgb(255 255 255 / .25);
  border-radius: var(--radius-pill); color: var(--topbar-text); cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.icon-btn:hover { background: rgb(255 255 255 / .14); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .icon { width: 19px; height: 19px; }

/* ---------- Video βοήθεια (?) στο header ---------- */
.help-spin-btn {
  margin-left: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: 0 0 auto;
  background: transparent; color: var(--topbar-text);
  border: 2px solid var(--topbar-text); border-radius: 50%;
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1;
  cursor: pointer; opacity: .9;
  animation: help-spin 5s ease-in-out infinite;
}
.help-spin-btn:hover { background: rgb(255 255 255 / .14); opacity: 1; }
.help-spin-btn span { display: inline-block; }
@keyframes help-spin {
  0%, 70% { transform: perspective(120px) rotateY(0deg); }
  95%, 100% { transform: perspective(120px) rotateY(360deg); }
}
.modal-card.video-card { max-width: 860px; text-align: left; }
.modal-card.video-card h2 { text-align: center; }
.modal-card.video-card video {
  display: block; width: 100%; height: auto; max-height: 55vh;
  background: #000; border-radius: var(--radius-m);
}
#video-help-modal { overflow-y: auto; }
#video-help-modal .modal-card { margin: auto; }
/* Fullscreen προβολή του modal βίντεο */
#video-help-modal { padding: 0; }
#video-help-modal .modal-card.video-card {
  width: 100vw; max-width: 100vw;
  height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh;
  border: 0; border-radius: 0;
  display: flex; flex-direction: column;
}
#video-help-modal .video-layout { flex: 1 1 auto; min-height: 0; }
#video-help-modal .video-chapters { max-height: none; }
#video-help-modal .video-main { display: flex; min-height: 0; }
#video-help-modal .video-main video { flex: 1 1 auto; min-width: 0; height: 100%; max-height: none; object-fit: contain; }
.video-layout { display: flex; gap: var(--space-4); align-items: stretch; }
.video-chapters {
  flex: 0 0 232px; min-width: 0;
  border-right: 1px solid var(--border); padding-right: var(--space-3);
  max-height: 62vh; overflow-y: auto;
}
.video-chapters-title { margin: 0 0 var(--space-2); font-weight: 700; font-size: .9rem; }
.video-chapters ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.video-chapters li button {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 6px 8px; cursor: pointer; font: inherit; font-size: .84rem; color: var(--text); text-align: left;
}
.video-chapters li button:hover { background: var(--surface-2); }
.video-chapters li button.active { border-color: var(--primary); background: var(--surface-2); font-weight: 600; }
.video-chapters .ch-num {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700;
  transform: translateY(3px);
}
.video-chapters .ch-title { flex: 1 1 auto; min-width: 0; }
.video-chapters .ch-time { flex: 0 0 auto; opacity: .6; font-size: .76rem; }
.video-main { flex: 1 1 auto; min-width: 0; }
@media (max-width: 720px) {
  .video-layout { flex-direction: column; }
  .video-chapters { flex: none; border-right: 0; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: var(--space-2); max-height: 28vh; }
}
.logo-row { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.logo-row p { flex: 1 1 220px; margin: 0; }
img.logo-preview {
  max-height: 72px; max-width: 220px; object-fit: contain;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-m); padding: 6px;
}
.user-chip {
  display: inline-flex; align-items: center;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--topbar-text); opacity: .85; font-size: .86rem;
  border: 1px solid rgb(255 255 255 / .25); border-radius: var(--radius-pill);
  padding: 6px 12px;
}
.nav-logout {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: none; cursor: pointer;
  color: var(--topbar-text); opacity: .78; font: inherit; font-size: .92rem;
  padding: 7px 13px; border-radius: var(--radius-pill);
  transition: opacity var(--transition), background var(--transition);
}
.nav-logout:hover { opacity: 1; background: rgb(255 255 255 / .12); }
.nav-logout .icon { width: 17px; height: 17px; }

/* Auth pages */
.auth-wrap { max-width: 440px; margin: var(--space-6) auto; }
.auth-card { padding: var(--space-6); }
.auth-head { text-align: center; margin-bottom: var(--space-4); }
.auth-head img { width: 56px; height: 56px; object-fit: contain; }
.auth-head h1 { margin: var(--space-2) 0 0; }
.auth-head p { margin: var(--space-1) 0 0; }
.form.bare { border: none; box-shadow: none; padding: 0; background: transparent; }
.btn.block { width: 100%; }
label.check {
  display: flex; flex-direction: row; align-items: center; gap: var(--space-2);
  font-weight: 400; cursor: pointer;
}
label.check input { width: auto; min-height: auto; accent-color: var(--primary); }
.center { text-align: center; }

/* Layout */
main { max-width: 1100px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-7); }
footer.app-footer { text-align: center; color: var(--text-muted); font-size: .82rem; padding: var(--space-4); }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4);
}
.page-head h1 { display: flex; align-items: center; gap: 10px; }
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-1);
  padding: var(--space-4) var(--space-5);
  margin: var(--space-3) 0;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 8px 15px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-m);
  font: inherit; font-size: .92rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: border-color var(--transition), background var(--transition),
    transform var(--transition), box-shadow var(--transition);
}
.btn:hover { border-color: var(--primary); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--border); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.small { min-height: 34px; padding: 5px 11px; font-size: .85rem; border-radius: var(--radius-s); }
.btn.icon-only { min-width: 40px; padding: 8px; }
.btn.icon-only.btn.small { min-width: 34px; min-height: 34px; padding: 5px; }
.btn .icon { width: 17px; height: 17px; flex: none; }
.icon { width: var(--icon-size); height: var(--icon-size); flex: none; }

/* Flash */
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 11px var(--space-4); border-radius: var(--radius-m);
  margin-bottom: var(--space-3); font-size: .94rem;
  border: 1px solid transparent;
}
.flash.ok { background: var(--success-soft); border-color: var(--success); color: var(--text); }
.flash.error { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }
.flash .icon { width: 18px; height: 18px; }

/* Tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface); box-shadow: var(--shadow-1); }
.tbl { width: 100%; border-collapse: collapse; font-size: .93rem; }
.tbl th {
  background: var(--header-row-bg); color: #fff;
  text-align: left; padding: 11px 12px; font-size: .83rem;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.tbl td { border-top: 1px solid var(--border); padding: 10px 12px; vertical-align: middle; }
.tbl tbody tr { transition: background var(--transition); }
.tbl tbody tr:hover { background: var(--row-hover); }
.tbl .num, .tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .nowrap { white-space: nowrap; }
.tbl .ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-pill); padding: 3px 12px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--text);
  border: 1px solid var(--border);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentcolor; }
.badge.info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.badge.success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.badge.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.muted { color: var(--text-muted); }
.empty {
  text-align: center; color: var(--text-muted);
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius-l); padding: var(--space-6) var(--space-4);
}

/* Filters */
.filters {
  display: flex; gap: var(--space-2); margin-bottom: var(--space-4); flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); padding: var(--space-3); box-shadow: var(--shadow-1);
}
.filters input[type="search"] { flex: 1 1 220px; min-width: 200px; width: auto; }
.filters select { flex: 0 1 230px; width: auto; }

/* Forms */
.form {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); padding: var(--space-5);
  box-shadow: var(--shadow-1);
  display: grid; gap: var(--space-3);
}
.grid2 { grid-template-columns: 1fr 1fr; }
.grid4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.span2 { grid-column: span 2; }
.span4 { grid-column: span 4; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: .86rem; font-weight: 600; color: var(--text); }
input, select, textarea {
  width: 100%; padding: 10px 12px; min-height: 42px;
  border: 1px solid var(--border); border-radius: var(--radius-m);
  font: inherit; font-size: .94rem; background: var(--input-bg); color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { min-height: auto; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--ring); outline-offset: 0; border-color: var(--ring);
}
.inline { display: flex; gap: var(--space-2); }
.inline select { flex: 1; }
.inlineform { display: inline; }
.form .row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* Totals */
.totals {
  max-width: 400px; margin: var(--space-3) 0 0 auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow-1);
}
.totals div { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px var(--space-4); }
.totals div + div { border-top: 1px solid var(--border); }
.totals strong { font-variant-numeric: tabular-nums; }
.totals .grand { background: var(--primary); color: var(--on-primary); font-size: 1.05rem; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: var(--space-1); margin-top: var(--space-4); flex-wrap: wrap; }
.pagination .page-info { color: var(--text-muted); font-size: .86rem; margin-right: var(--space-2); }

/* Definition rows (detail header) */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2) var(--space-4); }
.kv .wide { grid-column: span 2; }

/* Footer note under tables */
.table-note { color: var(--text-muted); font-size: .85rem; margin-top: var(--space-2); }

/* ---------- Responsive: tablet ---------- */
@media (max-width: 1024px) {
  main { max-width: 100%; padding-left: var(--space-5); padding-right: var(--space-5); }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .grid4 > .span4 { grid-column: span 2; }
  .tbl .ellipsis { max-width: 200px; }
}

/* ---------- Responsive: mobile — tables become cards ---------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  main { padding: var(--space-4) var(--space-3) var(--space-6); }
  .brand small { display: none; }
  .brand { font-size: .95rem; }
  .topbar { padding: 8px var(--space-3); }
  .topbar nav { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
  .topbar nav a { white-space: nowrap; }
  .grid2, .grid4, .kv { grid-template-columns: 1fr; }
  .span2, .span4, .kv .wide, .grid4 > .span4 { grid-column: span 1; }
  .totals { max-width: none; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .filters .btn { flex: 1 1 auto; }

  .table-wrap { border: none; background: transparent; box-shadow: none; overflow: visible; }
  .tbl-responsive thead {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0;
  }
  .tbl-responsive, .tbl-responsive tbody, .tbl-responsive tr, .tbl-responsive td { display: block; width: 100%; }
  .tbl-responsive tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    margin-bottom: var(--space-2);
    box-shadow: var(--shadow-1);
  }
  .tbl-responsive td {
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--space-3); text-align: right;
    border-top: none; border-bottom: 1px solid var(--border);
    padding: 9px 12px;
  }
  .tbl-responsive td:last-child { border-bottom: none; }
  .tbl-responsive td::before {
    content: attr(data-label);
    font-size: .76rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted);
    text-align: left; flex: none;
  }
  .tbl-responsive td.no-label::before { content: none; }
  .tbl-responsive td.no-label { justify-content: flex-end; }
  .tbl-responsive .row-actions { width: 100%; }
  .tbl-responsive .ellipsis { max-width: none; white-space: normal; }
}

/* ---------- Coarse pointers: larger touch targets ---------- */
@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn.small { min-height: 40px; }
  .icon-btn { min-width: 44px; min-height: 44px; }
  input, select, textarea { min-height: 46px; }
  .topbar nav a { padding-top: 10px; padding-bottom: 10px; }
}

/* ---------- Confirm modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
  background: rgb(9 16 29 / .58);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  width: 100%; max-width: 420px; padding: var(--space-5);
  text-align: center;
  animation: modal-in 180ms ease;
}
.modal-card h2 { margin: var(--space-2) 0 var(--space-1); font-size: 1.15rem; }
.modal-card p { margin: 0 0 var(--space-4); color: var(--text-muted); }
.modal-card p:empty { display: none; }
.modal-card p:empty + .modal-actions { margin-top: var(--space-3); }
.modal-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--danger-soft); color: var(--danger);
}
.modal-icon .icon { width: 24px; height: 24px; }
.modal-actions { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
.modal-card.large { max-width: 660px; text-align: left; max-height: 85vh; overflow-y: auto; }
.modal-card.large h2 { text-align: center; }
.help-content h3 { font-size: .98rem; margin: var(--space-4) 0 var(--space-1); color: var(--primary); }
.help-content h3:first-child { margin-top: 0; }
.help-content p, .help-content li { font-size: .92rem; }
.help-content ol, .help-content ul { margin: var(--space-1) 0; padding-left: var(--space-5); }
.help-content li { margin-bottom: var(--space-1); }
.help-content code {
  font-family: ui-monospace, Consolas, monospace; font-size: .85em;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 1px 6px; white-space: nowrap;
}
.help-content p code { white-space: normal; overflow-wrap: anywhere; }
body.modal-open { overflow: hidden; }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- Desktop: comfortable measure ---------- */
@media (min-width: 1025px) {
  main { padding-left: var(--space-4); padding-right: var(--space-4); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
