@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ============================================
   ITALPULT - Fő stíluslap
   Modern, világos UI
   ============================================ */

:root {
  --primary:       #1a6cff;
  --primary-dark:  #0f50cc;
  --primary-light: #e8f0ff;
  --accent:        #ff6b35;
  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --info:          #3b82f6;

  --bg:            #f4f6fb;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --border-focus:  #1a6cff;

  --text:          #0f172a;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  --sidebar-w:     260px;
  --header-h:      64px;
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-md:     0 4px 24px rgba(0,0,0,.10);
  --transition:    all .2s ease;

  --font:          'Plus Jakarta Sans', 'DM Sans', -apple-system, sans-serif;
  --font-mono:     ui-monospace, 'SF Mono', monospace;
}

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

html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================
   LAYOUT
   ============================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
  box-shadow: 2px 0 12px rgba(0,0,0,.04);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-logo .logo-icon { font-size: 1.6rem; }
.sidebar-logo .logo-text { font-weight: 700; font-size: 1.1rem; color: var(--primary); letter-spacing: -.3px; }
.sidebar-logo .logo-sub  { font-size: .7rem; color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 8px 16px 4px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-light);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: .88rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  margin: 1px 8px;
  transition: var(--transition);
}
.nav-item:hover { background: var(--primary-light); color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .nav-icon { font-size: 1rem; width: 20px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; font-weight: 700; color: var(--primary);
  flex-shrink: 0;
}
.user-name  { font-size: .85rem; font-weight: 600; }
.user-role  { font-size: .72rem; color: var(--text-muted); }
.btn-logout {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 8px 12px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: .82rem; cursor: pointer; transition: var(--transition);
  text-decoration: none;
}
.btn-logout:hover { background: #fee2e2; color: var(--danger); border-color: var(--danger); }

/* ---- Main content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: hidden;
}

.topbar {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0; z-index: 50;
}
.topbar-title { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-content {
  padding: 24px 28px;
  flex: 1;
  min-width: 0;
}

/* Mobile hamburger */
.hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  padding: 8px; font-size: 1.4rem; color: var(--text);
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99;
}

/* ============================================
   CARDS & COMPONENTS
   ============================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 0;
  margin-bottom: 16px;
}
.card-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 0 22px 22px; }
.card-full  { padding: 22px; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.stat-value { font-size: 1.3rem; font-weight: 700; color: var(--text); font-family: var(--font-mono); line-height: 1.2; }
.stat-sub   { font-size: .75rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.primary { background: var(--primary); border-color: var(--primary); }
.stat-card.primary .stat-label,
.stat-card.primary .stat-value,
.stat-card.primary .stat-sub { color: #fff; }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }
.stat-card.danger  { border-left: 4px solid var(--danger); }

/* ============================================
   FORMS
   ============================================ */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group label .required { color: var(--danger); margin-left: 3px; }

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.input-wrapper .input-icon {
  position: absolute; left: 12px;
  font-size: .9rem; color: var(--text-muted); pointer-events: none;
}
.input-wrapper input { padding-left: 38px !important; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font);
  font-size: .88rem;
  transition: var(--transition);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26,108,255,.12);
}
input[readonly] { background: var(--surface-2); color: var(--text-muted); }
input.computed { background: var(--primary-light); color: var(--primary); font-weight: 600; font-family: var(--font-mono); }
input.computed-success { background: #d1fae5; color: var(--success); font-weight: 600; font-family: var(--font-mono); }

.form-row {
  display: grid;
  gap: 16px;
}
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.cols-4 { grid-template-columns: repeat(4, 1fr); }

.toggle-pw {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  font-size: .9rem; color: var(--text-muted);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: .85rem;
  font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: .78rem; }
.btn-lg { padding: 12px 24px; font-size: .95rem; }
.btn-full { width: 100%; justify-content: center; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost   { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ============================================
   TABLES
   ============================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--surface-2);
  padding: 11px 14px;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
tfoot td {
  padding: 12px 14px;
  font-weight: 700;
  font-size: .85rem;
  background: var(--primary-light);
  color: var(--primary);
  border-top: 2px solid var(--border);
}

.mono { font-family: var(--font-mono); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

/* ============================================
   BADGES & PILLS
   ============================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-muted   { background: var(--surface-2); color: var(--text-muted); }

/* ============================================
   ALERTS
   ============================================ */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 500;
  margin-bottom: 18px;
}
.alert-icon { font-size: 1rem; flex-shrink: 0; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--primary-light); color: var(--primary); border: 1px solid #93c5fd; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.login-bg {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: linear-gradient(135deg, #1a6cff11 0%, #f4f6fb 50%, #ff6b3511 100%);
}
.login-bg-pattern {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 2px 2px, var(--border) 1px, transparent 0);
  background-size: 32px 32px;
  opacity: .6;
}

.login-container {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 36px;
  box-shadow: var(--shadow-md);
}

.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo .logo-icon { font-size: 2.5rem; display: block; margin-bottom: 10px; }
.login-logo h1 { font-size: 1.6rem; font-weight: 700; color: var(--primary); letter-spacing: -.5px; }
.login-logo p  { font-size: .82rem; color: var(--text-muted); margin-top: 4px; }

.login-form .btn-primary { margin-top: 6px; font-size: .92rem; padding: 12px; }
.login-note { text-align: center; font-size: .76rem; color: var(--text-light); margin-top: 20px; }

/* ============================================
   MODAL
   ============================================ */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 200; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
  animation: slideUp .25s ease;
}
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1000px; }

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.3rem; color: var(--text-muted); padding: 4px;
  border-radius: 6px; transition: var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body   { padding: 24px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ============================================
   STOCK TABLE (Készlet)
   ============================================ */
.stock-table input[type=number] {
  width: 90px; padding: 7px 10px;
  text-align: right; font-family: var(--font-mono);
}
.stock-table .col-name   { min-width: 160px; }
.stock-table .col-number { width: 110px; text-align: right; }
.stock-table .col-action { width: 100px; text-align: center; }

/* ============================================
   EVENT STATUS
   ============================================ */
.event-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
}
.event-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.event-card.closed { opacity: .7; }
.event-info .event-name { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.event-info .event-meta { font-size: .78rem; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.event-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ============================================
   TAB NAVIGATION
   ============================================ */
.tab-nav {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px;
  background: none; border: none;
  font-family: var(--font);
  font-size: .85rem; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================
   FINANSZÍROZÁSI ÖSSZEFOGLALÁS
   ============================================ */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.finance-item .fi-label { font-size: .72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.finance-item .fi-value { font-size: 1.1rem; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.finance-item .fi-value.positive { color: var(--success); }
.finance-item .fi-value.negative { color: var(--danger); }

/* ============================================
   TOASTS / NOTIFICATIONS
   ============================================ */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; font-weight: 500;
  animation: toastIn .3s ease;
  max-width: 340px;
}
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.info    { border-left: 4px solid var(--info); }

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.page-header-left .page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.page-header-left .page-sub   { font-size: .82rem; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center; padding: 60px 20px;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state .empty-title { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.empty-state .empty-sub   { font-size: .82rem; color: var(--text-muted); margin-bottom: 20px; }

/* ============================================
   UTILITY
   ============================================ */
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100  { width: 100%; }
.mb-0   { margin-bottom: 0; }
.mb-8   { margin-bottom: 8px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.p-0    { padding: 0 !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }

  .form-row.cols-2,
  .form-row.cols-3,
  .form-row.cols-4 { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .modal { max-width: calc(100vw - 32px); }
  .modal-xl, .modal-lg { max-width: calc(100vw - 32px); }

  .event-card { flex-direction: column; align-items: flex-start; }

  thead th:nth-child(n+5),
  tbody td:nth-child(n+5) { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
}

/* ============================================
   PRINT
   ============================================ */
@media print {
  .sidebar, .topbar, .btn, .tab-nav, .modal-backdrop { display: none !important; }
  .main-content { margin-left: 0; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
