/* ===================================================================
   Javelinx platforma — bendra dizaino sistema (app + admin)
   Atitinka viešojo puslapio stilių: mėlynas gradientas, Inter/Outfit.
   =================================================================== */

:root {
  --bg: #2f6ed6;
  --bg-2: #3d7fde;
  --bg-dark: #071527;
  --card: rgba(255,255,255,0.06);
  --card-2: rgba(255,255,255,0.10);
  --card-solid: #0e2137;
  --text: #ecf5ff;
  --muted: #b9cde8;
  --muted-2: #8ba6c9;
  --brand: #8fc0ff;
  --brand-2: #3b82e6;
  --brand-3: #cfe4ff;
  --accent: #5ea1ff;
  --border: rgba(255,255,255,0.14);
  --border-strong: rgba(255,255,255,0.24);
  --shadow: 0 20px 60px rgba(0,0,0,0.40);
  --ok: #3dba6e;
  --ok-bg: rgba(61,186,110,0.14);
  --warn: #f0b83d;
  --warn-bg: rgba(240,184,61,0.14);
  --danger: #e05555;
  --danger-bg: rgba(224,85,85,0.14);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-dark);
  background-image: linear-gradient(180deg,
    #071527 0%,
    #2f6ed6 30%,
    #2f6ed6 70%,
    #071527 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1,h2,h3,h4 { font-family: 'Inter', sans-serif; font-weight: 700; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -0.3px; }

/* ---------- Logo ---------- */
.brand-logo { display: flex; align-items: center; gap: 10px; font-family: 'Outfit', sans-serif; font-weight: 200; font-size: 24px; letter-spacing: 1.5px; color: var(--brand); }
.brand-logo img { width: 44px; height: 44px; }
.brand-logo .domain { font-size: 0.55em; letter-spacing: .5px; }
.brand-logo .logo-text { background: linear-gradient(135deg,#f4f8ff,#c5dcf9 50%,#8fb9ec); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ================= AUTH (login/register) ================= */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 440px;
  background: rgba(14,33,55,0.72);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 34px;
}
.auth-card .brand-logo { justify-content: center; margin-bottom: 8px; }
.auth-card h1 { text-align: center; font-size: 26px; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }

/* Segmentinis perjungiklis: Registruotis / Prisijungti */
.auth-tabs {
  display: flex; gap: 4px; padding: 4px; margin-bottom: 22px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.auth-tab {
  flex: 1; text-align: center; padding: 10px 8px; border-radius: 8px;
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 14px;
  color: var(--muted); cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s, box-shadow .15s;
}
.auth-tab:hover { color: var(--text); text-decoration: none; }
.auth-tab.active {
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  color: #fff; box-shadow: 0 4px 14px rgba(59,130,230,0.35);
}
html[data-theme="light"] .auth-tabs { background: #eef3fb; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 15px; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: rgba(255,255,255,0.08);
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field textarea { min-height: 110px; resize: vertical; }
.field select option { background: var(--card-solid); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-hint { font-size: 12px; color: var(--muted-2); margin-top: 5px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border: none; border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: transform .1s, box-shadow .2s, opacity .2s;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  color: #fff; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(59,130,230,0.4); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.full { width: 100%; }
.btn.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text); }
.btn.outline:hover { background: rgba(255,255,255,0.06); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--muted); padding: 8px 12px; }
.btn.ghost:hover { background: rgba(255,255,255,0.06); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, #e05555, #a52020); }
.btn.sm { padding: 7px 13px; font-size: 13px; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 15px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert.error { background: var(--danger-bg); border: 1px solid rgba(224,85,85,0.4); color: #ffc9c9; }
.alert.success { background: var(--ok-bg); border: 1px solid rgba(61,186,110,0.4); color: #bff5d4; }
.alert.info { background: rgba(94,161,255,0.12); border: 1px solid rgba(94,161,255,0.4); color: var(--brand-3); }

/* ================= APP SHELL (dashboard) ================= */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0;
  background: rgba(7,21,39,0.6);
  border-right: 1px solid var(--border);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-logo { padding: 0 8px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14.5px; cursor: pointer;
  transition: background .15s, color .15s; text-decoration: none;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: var(--text); text-decoration: none; }
.nav-link.active { background: linear-gradient(135deg, rgba(59,130,230,0.28), rgba(94,161,255,0.16)); color: #fff; }
.nav-link svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-spacer { flex: 1; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border);
  background: rgba(7,21,39,0.4); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 20px; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }

/* Vartotojo meniu (dropdown viršuje dešinėje) */
.user-menu { position: relative; }
.user-menu .user {
  background: none; border: 1px solid transparent; border-radius: 999px;
  padding: 5px 8px 5px 14px; cursor: pointer; font-family: inherit;
  transition: background .15s, border-color .15s;
}
.user-menu .user:hover { background: rgba(255,255,255,0.06); border-color: var(--border); }
.user-menu .user .chev { width: 16px; height: 16px; transition: transform .2s; margin-left: 2px; }
.user-menu.open .user .chev { transform: rotate(180deg); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 226px;
  background: var(--card-solid); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 6px;
  display: none; z-index: 90;
}
.user-menu.open .user-dropdown { display: block; animation: fade .15s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border-radius: 8px; color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none;
}
.dropdown-item:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.dropdown-item svg { width: 17px; height: 17px; color: var(--muted); flex-shrink: 0; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; border: none; }
html[data-theme="light"] .user-menu .user:hover { background: rgba(47,110,214,0.07); }
html[data-theme="light"] .dropdown-item:hover { background: rgba(47,110,214,0.07); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,var(--brand-2),var(--accent)); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-family: 'Inter',sans-serif; }
.content { padding: 28px; flex: 1; }
.page { display: none; }
.page.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Cards / panels ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; }
.panel h3 { font-size: 17px; margin-bottom: 14px; }
/* Spaudžiamos paslaugų kortelės */
.service-card { cursor: pointer; transition: transform .15s, box-shadow .2s, border-color .15s; }
.service-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 34px rgba(59,130,230,0.28); }
.service-card-cta { margin-top: 14px; color: var(--brand); font-weight: 700; font-size: 14px; }
html[data-theme="light"] .service-card:hover { box-shadow: 0 14px 34px rgba(30,70,130,0.16); }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2,1fr); }
.grid.cols-3 { grid-template-columns: repeat(3,1fr); }
.grid.cols-4 { grid-template-columns: repeat(4,1fr); }

.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.stat .label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat .value { font-family: 'Inter',sans-serif; font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }
.stat .value small { font-size: 15px; color: var(--muted); font-weight: 400; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; padding: 13px 16px; background: rgba(255,255,255,0.04); color: var(--muted); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
tbody td { padding: 13px 16px; border-top: 1px solid var(--border); }
tbody tr:hover { background: rgba(255,255,255,0.03); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.ok { background: var(--ok-bg); color: #7fe0a4; }
.badge.warn { background: var(--warn-bg); color: #f5cf7a; }
.badge.danger { background: var(--danger-bg); color: #f0a0a0; }
.badge.info { background: rgba(94,161,255,0.14); color: var(--brand-3); }
.badge.neutral { background: rgba(255,255,255,0.08); color: var(--muted); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 50px 20px; color: var(--muted-2); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 10px; }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(4,12,24,0.7); backdrop-filter: blur(4px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 24px; }
.modal-backdrop.show { display: flex; }
.modal { width: 100%; max-width: 560px; background: var(--card-solid); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 88vh; overflow-y: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 24px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 26px; cursor: pointer; line-height: 1; }

/* ---------- Utility ---------- */
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.text-right { text-align: right; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* ---------- Mobile ---------- */
.menu-btn { display: none; background: none; border: none; color: var(--text); cursor: pointer; }
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: left .25s; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .menu-btn { display: inline-flex; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .content { padding: 18px; }
}

/* ===================================================================
   TEMOS PERJUNGIKLIS (dark / light)
   =================================================================== */
#themeToggle {
  position: fixed; bottom: 18px; right: 18px; z-index: 300;
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--card-2); color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(10px); box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  transition: transform .15s, background .15s;
}
#themeToggle:hover { transform: translateY(-2px); background: var(--card); }
#themeToggle svg { width: 20px; height: 20px; }

/* ===================================================================
   LIGHT MODE — baltas su mėlynais elementais
   =================================================================== */
html[data-theme="light"] {
  --bg: #dbe8fb;
  --bg-2: #cfe0f5;
  --bg-dark: #f4f8ff;
  --card: #ffffff;
  --card-2: #f2f7ff;
  --card-solid: #ffffff;
  --text: #0e2137;
  --muted: #4b5f7a;
  --muted-2: #7488a3;
  --brand: #2f6ed6;
  --brand-2: #2f6ed6;
  --brand-3: #1f5bb8;
  --accent: #3b82e6;
  --border: rgba(20,50,90,0.14);
  --border-strong: rgba(20,50,90,0.22);
  --shadow: 0 14px 40px rgba(30,70,130,0.14);
  --ok-bg: rgba(61,186,110,0.14);
  --warn-bg: rgba(240,184,61,0.16);
  --danger-bg: rgba(224,85,85,0.12);
}
html[data-theme="light"] body {
  background: #f4f8ff;
  background-image: linear-gradient(180deg, #ffffff 0%, #e8f1fd 45%, #e8f1fd 55%, #ffffff 100%);
}
html[data-theme="light"] .logo-text {
  background: linear-gradient(135deg,#0f3d82,#2f6ed6);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
html[data-theme="light"] .brand-logo { color: #1f5bb8; }
/* Logotipo grafika (PNG) light režime — tamsesnė ir sodresnė, kad matytųsi ant balto */
html[data-theme="light"] .brand-logo img { filter: brightness(0.88) saturate(2) contrast(1.08); }
html[data-theme="light"] .auth-card { background: #ffffff; box-shadow: var(--shadow); }
html[data-theme="light"] .sidebar { background: #ffffff; }
html[data-theme="light"] .topbar { background: rgba(255,255,255,0.85); }
html[data-theme="light"] .panel,
html[data-theme="light"] .stat,
html[data-theme="light"] .modal { background: #ffffff; }
html[data-theme="light"] .field input,
html[data-theme="light"] .field select,
html[data-theme="light"] .field textarea { background: #f6faff; }
html[data-theme="light"] .field input:focus,
html[data-theme="light"] .field select:focus,
html[data-theme="light"] .field textarea:focus { background: #ffffff; }
html[data-theme="light"] .field select option { background: #ffffff; }
html[data-theme="light"] thead th { background: #eaf1fb; color: var(--muted); }
html[data-theme="light"] tbody tr:hover { background: #f4f8ff; }
html[data-theme="light"] .nav-link:hover { background: rgba(47,110,214,0.08); }
html[data-theme="light"] .nav-link.active {
  background: linear-gradient(135deg, rgba(47,110,214,0.16), rgba(94,161,255,0.10));
  color: var(--brand-3);
}
html[data-theme="light"] .btn.outline { border-color: var(--border-strong); color: var(--text); }
html[data-theme="light"] .btn.outline:hover { background: rgba(47,110,214,0.06); }
html[data-theme="light"] .btn.ghost:hover { background: rgba(47,110,214,0.06); }
html[data-theme="light"] .table-wrap { border-color: var(--border); }
html[data-theme="light"] .alert.error { color: #b42318; }
html[data-theme="light"] .alert.success { color: #177245; }
html[data-theme="light"] .alert.info { color: #1f5bb8; }
html[data-theme="light"] .badge.ok { color: #177245; }
html[data-theme="light"] .badge.warn { color: #8a6d1a; }
html[data-theme="light"] .badge.danger { color: #b42318; }
html[data-theme="light"] .badge.info { color: #1f5bb8; }
html[data-theme="light"] .badge.neutral { color: #4b5f7a; }
html[data-theme="light"] #themeToggle { box-shadow: 0 6px 20px rgba(30,70,130,0.18); }
