/* ============================================================
   UHK Grant Manager – app.css
   Typ: Institucionální, čistý, důvěryhodný
   Font: Instrument Serif (display) + DM Sans (UI)
   Paleta: UHK Navy #1C2E5A · Zlato #C8922A · Neutrální šedé
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Barvy */
  --navy:       #1C2E5A;
  --navy-700:   #243670;
  --navy-500:   #2F4A8A;
  --navy-100:   #E8EDF8;
  --navy-50:    #F2F5FC;
  --gold:       #C8922A;
  --gold-light: #FBF3E4;
  --green:      #1E6B45;
  --green-light:#E6F4EE;
  --amber:      #B45309;
  --amber-light:#FEF3C7;
  --red:        #991B1B;
  --red-light:  #FEF2F2;
  --grey-900:   #111827;
  --grey-700:   #374151;
  --grey-500:   #6B7280;
  --grey-300:   #D1D5DB;
  --grey-100:   #F3F4F6;
  --white:      #FFFFFF;

  /* Role barvy */
  --role-admin:     #1C2E5A;
  --role-prorektor: #5B21B6;
  --role-komisar:   #1E6B45;
  --role-tester:    #B45309;
  --role-zadatel:   #1d4ed8;
  --role-readonly:  #6B7280;

  /* Typografie */
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans:  'DM Sans', system-ui, sans-serif;

  /* Spacing & shape */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 4px 16px rgba(28,46,90,.10);
  --shadow-lg: 0 12px 40px rgba(28,46,90,.16);
  --max-w:     1140px;
  --topbar-h:  60px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--grey-900);
  background: var(--grey-100);
  -webkit-font-smoothing: antialiased;
}

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page {
  background: var(--white);
  min-height: 100vh;
}

.login-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}

/* Levý panel */
.login-brand {
  background: #000000;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-brand::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 80%, rgba(200,146,42,.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(47,74,138,.4) 0%, transparent 60%);
}
.login-brand__inner {
  position: relative; z-index: 1;
  padding: 48px;
  max-width: 440px;
}
.login-brand__logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 48px;
}
.logo-uhk {
  font-family: var(--font-serif);
  font-size: 42px;
  color: var(--gold);
  letter-spacing: -1px;
  line-height: 1;
}
.logo-uhk--sm { font-size: 22px; }
.logo-sep {
  width: 1px;
  height: 36px;
  background: rgba(255,255,255,.2);
}
.logo-text {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,.6);
  line-height: 1.4;
  letter-spacing: .3px;
}
.login-brand__tagline {
  font-family: var(--font-serif);
  font-size: 36px;
  line-height: 1.25;
  color: var(--white);
  letter-spacing: -.5px;
}
.login-brand__tagline em {
  font-style: italic;
  color: var(--gold);
}

/* Dekorativní kruhy */
.deco-circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.06);
}
.deco-circle--1 { width: 400px; height: 400px; bottom: -120px; right: -120px; }
.deco-circle--2 { width: 240px; height: 240px; bottom: -40px;  right: -40px;  border-color: rgba(200,146,42,.15); }
.deco-circle--3 { width: 120px; height: 120px; top: 40px;      right: 40px; }

/* Pravý panel */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px;
  background: var(--white);
}
.login-form-wrap {
  width: 100%;
  max-width: 400px;
}
.login-form__header {
  margin-bottom: 32px;
}
.login-form__title {
  font-family: var(--font-serif);
  font-size: 32px;
  color: var(--navy);
  letter-spacing: -.5px;
  margin-bottom: 6px;
}
.login-form__sub {
  font-size: 14px;
  color: var(--grey-500);
}
.login-form__footer {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--grey-300);
  font-size: 13px;
  color: var(--grey-500);
  text-align: center;
}
.login-form__footer a {
  color: var(--navy-500);
  text-decoration: none;
  font-weight: 500;
}
.login-form__footer a:hover { text-decoration: underline; }

/* ── FORM FIELDS ────────────────────────────────────────────── */
.field {
  margin-bottom: 20px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-700);
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.field__input-wrap {
  position: relative;
}
.field__icon {
  position: absolute;
  left: 13px; top: 50%;
  transform: translateY(-50%);
  color: var(--grey-500);
  pointer-events: none;
}
.field__input-wrap input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--grey-300);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--grey-900);
  background: var(--white);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field__input-wrap input:focus {
  border-color: var(--navy-500);
  box-shadow: 0 0 0 3px rgba(47,74,138,.1);
}
.field__input-wrap input.is-error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(153,27,27,.08);
}
.field__toggle {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; color: var(--grey-500);
  padding: 2px;
  transition: color .15s;
}
.field__toggle:hover { color: var(--navy); }
.field__error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  min-height: 16px;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  transition: background .15s, transform .1s;
  margin-top: 8px;
  letter-spacing: .2px;
}
.btn-login:hover:not(:disabled) { background: var(--navy-700); }
.btn-login:active:not(:disabled) { transform: scale(.99); }
.btn-login:disabled { opacity: .7; cursor: not-allowed; }
.btn-login__spinner {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

.btn-logout {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.2);
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.8);
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.btn-logout:hover {
  background: rgba(255,255,255,.1);
  color: var(--white);
}

/* ── ALERT ──────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}
.alert--error  { background: var(--red-light);   color: var(--red);   border: 1px solid #FECACA; }
.alert--info   { background: var(--navy-50);     color: var(--navy);  border: 1px solid var(--navy-100); }
.alert--success{ background: var(--green-light); color: var(--green); border: 1px solid #BBF7D0; }
.alert--warn   { background: var(--amber-light); color: var(--amber); border: 1px solid #FDE68A; }

/* ── TOPBAR ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  background: var(--navy);
  box-shadow: 0 1px 0 rgba(255,255,255,.08);
}
.topbar__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex; align-items: center;
  justify-content: space-between;
}
.topbar__logo {
  display: flex; align-items: center; gap: 12px;
}
.topbar__title {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  letter-spacing: .3px;
}
.topbar__right {
  display: flex; align-items: center; gap: 16px;
}
.topbar__user {
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.user-name {
  font-size: 14px; font-weight: 600;
  color: var(--white);
}
.user-role {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  letter-spacing: .3px;
}

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content {
  min-height: calc(100vh - var(--topbar-h));
  padding: 40px 0 80px;
}
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── DASHBOARD HEADER ───────────────────────────────────────── */
.dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 40px;
  gap: 20px;
}
.dashboard-header__greeting {
  font-size: 14px;
  font-weight: 500;
  color: var(--grey-500);
  margin-bottom: 4px;
  letter-spacing: .3px;
}
.dashboard-header__name {
  font-family: var(--font-serif);
  font-size: 36px;
  color: var(--navy);
  letter-spacing: -.5px;
  line-height: 1.1;
  margin-bottom: 6px;
}
.dashboard-header__sub {
  font-size: 14px;
  color: var(--grey-500);
}
.dashboard-header__badge {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 8px;
}

/* Role badge barvy */
.role-badge--admin     { background: var(--navy-100); color: var(--navy); }
.role-badge--prorektor { background: #EDE9FE; color: #5B21B6; }
.role-badge--komisar   { background: var(--green-light); color: var(--green); }
.role-badge--tester    { background: var(--amber-light); color: var(--amber); }
.role-badge--zadatel   { background: #DBEAFE; color: #1D4ED8; }
.role-badge--readonly  { background: var(--grey-100); color: var(--grey-500); border: 1px solid var(--grey-300); }

/* ── COMPETITION CARDS ──────────────────────────────────────── */
.competitions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.comp-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--grey-300);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow .2s, transform .2s;
}
.comp-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

/* Status-based left border */
.comp-card--open    { border-left: 4px solid var(--green); }
.comp-card--running { border-left: 4px solid var(--gold); }
.comp-card--closed  { border-left: 4px solid var(--grey-300); }
.comp-card--draft   { border-left: 4px solid var(--grey-300); }

/* OP JAK Návraty – speciální typ karty */
.comp-card__type--navraty { color: #5B21B6; }

.comp-card__header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 20px 0;
}
.comp-card__status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--open    { background: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.status-dot--running { background: var(--gold);  box-shadow: 0 0 0 3px var(--gold-light); animation: pulse 2s infinite; }
.status-dot--closed  { background: var(--grey-300); }
.status-dot--draft   { background: var(--grey-300); }
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px var(--gold-light); }
  50%      { box-shadow: 0 0 0 6px rgba(200,146,42,.1); }
}
.comp-card__status-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--grey-500);
}

.comp-card__body {
  padding: 16px 20px 20px;
  flex: 1;
}
.comp-card__type {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.comp-card__name {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--navy);
  line-height: 1.2;
  margin-bottom: 8px;
  letter-spacing: -.3px;
}
.comp-card__desc {
  font-size: 13px;
  color: var(--grey-500);
  line-height: 1.55;
  margin-bottom: 16px;
}
.comp-card__meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--grey-300);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.meta-item {
  background: var(--grey-100);
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 1px;
}
.meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--grey-500);
}
.meta-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--grey-900);
}
.meta-val--warn { color: var(--amber); }

.comp-card__actions {
  padding: 14px 20px;
  border-top: 1px solid var(--grey-100);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.comp-action {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.comp-action--primary   { background: var(--navy); color: var(--white); }
.comp-action--primary:hover { background: var(--navy-700); }
.comp-action--secondary { background: var(--navy-100); color: var(--navy); }
.comp-action--secondary:hover { background: #d5dff0; }
.comp-action--ghost {
  background: transparent; color: var(--grey-700);
  border: 1.5px solid var(--grey-300);
}
.comp-action--ghost:hover { background: var(--grey-100); }

/* ── SKELETON ───────────────────────────────────────────────── */
.skeleton-card {
  height: 280px;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--grey-300);
  position: relative; overflow: hidden;
}
.skeleton-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg,
    transparent 0%, rgba(255,255,255,.6) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── ADMIN TILES ────────────────────────────────────────────── */
.section-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 8px 0 20px;
  font-size: 12px; font-weight: 700;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--grey-500);
}
.section-divider::before,
.section-divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--grey-300);
}

.admin-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.admin-tile {
  background: var(--white);
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  padding: 20px;
  text-decoration: none;
  transition: all .15s;
  display: flex; flex-direction: column; gap: 4px;
}
.admin-tile:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--navy-100);
  transform: translateY(-1px);
}
.admin-tile__icon { font-size: 24px; margin-bottom: 4px; }
.admin-tile__label {
  font-size: 14px; font-weight: 600;
  color: var(--navy);
}
.admin-tile__sub {
  font-size: 12px; color: var(--grey-500);
}

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
}
.empty-state__icon { font-size: 40px; margin-bottom: 12px; }
.empty-state__text { font-size: 16px; color: var(--grey-500); }

/* ── ANIMATION ──────────────────────────────────────────────── */
.fade-in {
  animation: fadeInUp .4s ease both;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand  { display: none; }
  .login-form-panel { padding: 32px 24px; }
  .dashboard-header { flex-direction: column; }
  .competitions-grid { grid-template-columns: 1fr; }
  .comp-card__meta { grid-template-columns: 1fr 1fr; }
  .topbar__user .user-name,
  .topbar__user .user-role { display: none; }
}

/* ── Language (CS / EN) ─────────────────────────────────────── */
.uhk-lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 8px;
  vertical-align: middle;
}
.uhk-lang-switch__btn {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.topbar .uhk-lang-switch__btn {
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.55);
}
.topbar .uhk-lang-switch__btn:hover {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.45);
}
.topbar .uhk-lang-switch__btn--active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.35);
}
.login-form-panel .uhk-lang-switch__btn {
  border-color: var(--grey-300);
  color: var(--grey-500);
}
.login-form-panel .uhk-lang-switch__btn:hover {
  color: var(--navy);
  border-color: var(--navy-500);
}
.login-form-panel .uhk-lang-switch__btn--active {
  background: var(--navy-50);
  color: var(--navy);
  border-color: var(--navy-500);
}
