/* tisza.vote Design System — Light theme only */

/* ============================================
   1. CSS Custom Properties
   ============================================ */
:root {
  /* Brand */
  --color-primary: #253BA3;
  --color-primary-dark: #0E163D;
  --color-accent: #88E8FF;

  /* Backgrounds */
  --color-bg: #f0f2f5;
  --color-bg-alt: #EDEDED;
  --color-surface: #ffffff;
  --color-surface-hover: #f8f9ff;
  --color-surface-subtle: #fafafa;
  --color-surface-muted: #f8f9fa;

  /* Text */
  --color-text: #0E163D;
  --color-text-secondary: #333333;
  --color-text-muted: #64748b;
  --color-text-faint: #999999;

  /* Borders */
  --color-border: #D7D6D4;
  --color-border-light: #e5e7eb;
  --color-border-lighter: #f0f0f0;

  /* Semantic */
  --color-success: #24B573;
  --color-success-light: #d1fae5;
  --color-success-text: #059669;
  --color-error: #ED4551;
  --color-error-light: #fdedef;
  --color-error-text: #dc2626;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-warning-text: #d97706;
  --color-info: #2563eb;
  --color-info-light: #dbeafe;
  --color-info-text: #2563eb;

  /* Focus */
  --color-focus-ring: rgba(37, 59, 163, 0.1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 60px rgba(14, 22, 61, 0.3);
  --shadow-header: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-button-hover: 0 4px 12px rgba(37, 59, 163, 0.3);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 40px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-base: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;
  --radius-2xl: 20px;
  --radius-full: 50%;
  --radius-pill: 50px;
}

/* ============================================
   2. Base / Reset
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'FAIRE Luma Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
* {
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) transparent;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary-dark); }

/* Focus */
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--color-focus-ring);
}

/* ============================================
   3. Typography
   ============================================ */
h1 { font-size: 26px; font-weight: 700; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; }

.text-muted { color: var(--color-text-muted); }
.text-faint { color: var(--color-text-faint); }
.text-small { font-size: 12px; }
.text-label { font-size: 13px; font-weight: 600; }

/* ============================================
   4. Header
   ============================================ */
.header {
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  box-shadow: var(--shadow-header);
  color: #ffffff;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.header-logo {
  height: 28px;
  width: auto;
  max-width: 28px;
  object-fit: contain;
}

.header-title {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

@media (max-width: 360px) {
  .header-title { display: none; }
}

/* ============================================
   5. Buttons
   ============================================ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-base);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-button-hover);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  background: #8b9dc3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-base);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover { background: #f0f4ff; }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-error);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-base);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-danger:hover { background: #dc2626; }

.btn-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-warning);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-base);
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-warning:hover { background: #d97706; }

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
  border-radius: var(--radius-md);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-primary);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-base);
  padding: 6px 14px 6px 8px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-back:hover {
  background: #f0f4ff;
  border-color: var(--color-primary);
}

.btn-header {
  color: #ffffff;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-header:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #ffffff;
  border: none;
  border-radius: var(--radius-base);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-cta:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-button-hover);
}

.btn-loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-icon { width: 15px; height: 15px; flex-shrink: 0; }
.btn-sm .btn-icon { width: 13px; height: 13px; }

/* HTMX loading state */
.htmx-request .idle-state { display: none; }
.htmx-request .loading-state { display: inline !important; }
.loading-state { display: none; }

/* ============================================
   6. Form Inputs
   ============================================ */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-base);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface-subtle);
  color: var(--color-text);
  transition: all 0.2s ease;
}
.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 4px var(--color-focus-ring);
}

.form-input-lg {
  padding: 14px 16px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.form-select {
  padding: 8px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-base);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface-subtle);
  color: var(--color-text);
  max-width: 100%;
  transition: all 0.2s ease;
}
.form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-base);
  font-size: 14px;
  font-family: inherit;
  background: var(--color-surface-subtle);
  resize: vertical;
  transition: all 0.2s ease;
}
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-focus-ring);
}

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-border-lighter);
}
.form-section:last-child { border-bottom: none; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* OTP Input */
.otp-inputs {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.otp-input {
  width: 48px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-subtle);
  font-family: inherit;
  transition: all 0.2s ease;
}
.otp-input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 4px var(--color-focus-ring);
}

@media (max-width: 480px) {
  .otp-input { width: 38px; height: 46px; font-size: 20px; }
}

/* ============================================
   7. Cards
   ============================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-bordered {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: box-shadow 0.15s ease;
}
.card-bordered:hover { box-shadow: var(--shadow-md); }

.card-animated { animation: card-fade-in 0.3s ease both; }

/* ============================================
   8. Tables
   ============================================ */
.table {
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border-collapse: collapse;
  table-layout: fixed;
}
.table th {
  background: var(--color-surface-muted);
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--color-border-light);
}
.table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border-lighter);
}
.table tbody tr:hover { background: var(--color-surface-hover); }
.table .clickable-row { cursor: pointer; }
.table .clickable-row td:first-child { color: var(--color-primary); font-weight: 500; }

/* ============================================
   9. Badges
   ============================================ */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-pending   { background: #f3f4f6; color: #6b7280; }
.badge-running   { background: #fef3c7; color: #d97706; }
.badge-completed { background: #d1fae5; color: #059669; }
.badge-failed    { background: #fdedef; color: #ED4551; }
.badge-scheduled { background: #ede9fe; color: #7c3aed; }
.badge-info      { background: #dbeafe; color: #2563eb; }

.badge-count {
  background: #e5e7eb;
  color: #666666;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.badge-area {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  background: #f3f4f6;
  color: #6b7280;
}

/* ============================================
   10. Modals
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 22, 61, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: 420px;
  max-width: 90vw;
  box-shadow: var(--shadow-xl);
  animation: modal-in 0.15s ease-out;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-body { padding: 20px 24px 24px; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: var(--color-text-secondary); }

.modal-frosted {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-2xl);
  padding: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 400px;
}

/* ============================================
   11. Notices / Alerts
   ============================================ */
.notice {
  padding: 12px 16px;
  border-radius: var(--radius-base);
  font-size: 13px;
}
.notice-error   { background: var(--color-error-light);   color: var(--color-error-text); }
.notice-info    { background: #e8fbff;                    color: var(--color-info-text); }
.notice-success { background: var(--color-success-light); color: var(--color-success-text); }
.notice-warning { background: var(--color-warning-light); color: var(--color-warning-text); }

/* ============================================
   12. Progress Bar
   ============================================ */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: 4px;
  overflow: hidden;
}
.progress-bar-lg { height: 16px; border-radius: 8px; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), #4f73e3);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ============================================
   13. Toggle Switch
   ============================================ */
.toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s ease;
}
.toggle input:checked + .toggle-slider { background: var(--color-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ============================================
   14. Sidebar (koordinátor desktop layout)
   ============================================ */
.sidebar-section-title {
  font-size: 12px;
  font-weight: 700;
  color: #999999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 20px 4px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.sidebar-nav-item:hover { background: var(--color-surface-hover); }
.sidebar-nav-item.active {
  background: #f0f4ff;
  border-left-color: var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* ============================================
   15. Login / Centered Page
   ============================================ */
.logo-block {
  text-align: center;
  margin-bottom: 30px;
}
.login-logo { max-width: 140px; height: auto; }
.logo-block h1 {
  color: var(--color-primary-dark);
  font-size: 24px;
  font-weight: 700;
  margin-top: 12px;
}
.logo-block p {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ============================================
   16. Layout Helpers
   ============================================ */
.page-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl);
}

/* Koordinátor desktop layout */
.page-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}
.page-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-light);
  overflow-y: auto;
  padding: 20px 0;
}
.page-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-xl);
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .page-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 320px;
    height: 100vh;
    z-index: 150;
    transition: left 0.3s ease;
    box-shadow: none;
  }
  .page-sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
  }
}

/* Info grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ============================================
   17. Animations
   ============================================ */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

/* ============================================
   18. Utility
   ============================================ */
.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;
}

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-base { gap: var(--space-base); }
.gap-lg { gap: var(--space-lg); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-base { margin-top: var(--space-base); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-base { margin-bottom: var(--space-base); }
.mb-lg { margin-bottom: var(--space-lg); }
.text-center { text-align: center; }
.w-full { width: 100%; }
