/* Modern Dark & Indigo Premium Theme for Klinv */
:root {
  --bg-main: #0b0f19;
  --bg-card: rgba(22, 28, 45, 0.7);
  --bg-surface: #121824;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --primary-hover: #4f46e5;
  
  --accent-ok: #10b981;
  --accent-ok-glow: rgba(16, 185, 129, 0.15);
  
  --accent-warn: #f59e0b;
  --accent-warn-glow: rgba(245, 158, 11, 0.15);
  
  --accent-danger: #f43f5e;
  --accent-danger-glow: rgba(244, 63, 94, 0.15);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-serif: 'Source Serif 4', Georgia, serif;
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Top Navigation Bar */
.topbar {
  background: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar .stamp {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.topbar .stamp span {
  color: var(--primary);
  margin: 0 3px;
}

.topbar .tagline {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

/* Base Wrapper */
.wrap {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 24px 80px 24px;
}

/* Flash Messages */
.flash {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-weight: 500;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease-out;
  border: 1px solid transparent;
}

.flash.success {
  background-color: var(--accent-ok-glow);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.25);
}

.flash.error {
  background-color: var(--accent-danger-glow);
  color: #fb7185;
  border-color: rgba(244, 63, 94, 0.25);
}

/* Cards & Containers */
.upload-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  margin-bottom: 40px;
  transition: var(--transition);
}

.upload-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.upload-card h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.upload-card .hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Drag & Drop Zone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: var(--transition);
  margin-bottom: 20px;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.04);
}

.dropzone input[type="file"] {
  display: none;
}

.dropzone .icon {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 12px;
  transition: transform 0.2s ease;
}

.dropzone:hover .icon {
  transform: translateY(-4px);
}

.dropzone .main-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
}

.dropzone .sub-text {
  font-size: 13px;
  color: var(--text-soft);
}

/* File items list */
#file-list {
  margin-bottom: 20px;
}

.file-item {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-right: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.amber {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn.amber:not(:disabled):hover {
  background: var(--primary-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn.danger {
  background: var(--accent-danger-glow);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.btn.danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.3);
  transform: translateY(-1px);
}

.upload-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Lists and Tables Header */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 48px;
  margin-bottom: 20px;
}

.list-header h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
}

.export-links {
  display: flex;
  gap: 16px;
}

.export-links a {
  color: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.export-links a:hover {
  color: #818cf8;
  text-decoration: underline;
}

/* Table Container (for horizontal scroll on mobile) */
.table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}

/* Responsive Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

th {
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-weight: 600;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  transition: var(--transition);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr {
  cursor: pointer;
}

tbody tr:not(.processing-row):hover td {
  background: rgba(255, 255, 255, 0.02);
  color: #ffffff;
}

.num {
  text-align: right;
  font-family: var(--font-mono);
}

.issuer {
  font-weight: 600;
  color: #ffffff;
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.badge.ok {
  background-color: var(--accent-ok-glow);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.2);
}

.badge.review {
  background-color: var(--accent-warn-glow);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.2);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
}

.empty-state .icon {
  font-size: 48px;
  color: var(--text-soft);
  margin-bottom: 16px;
}

.empty-state p {
  color: var(--text-muted);
  font-size: 15px;
}

/* Back Link styling */
.back-link {
  display: inline-flex;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 24px;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--primary);
  transform: translateX(-3px);
}

/* Detail view header */
.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 32px;
}

.detail-header h1 {
  font-family: var(--font-serif);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.detail-header .sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-soft);
}

/* Warnings Box */
.warnings-box {
  background-color: var(--accent-warn-glow);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 32px;
  animation: pulseGlow 2s infinite alternate;
}

.warnings-box .title {
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 10px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.warnings-box ul {
  padding-left: 20px;
}

.warnings-box li {
  color: #fde68a;
  font-size: 14px;
  margin-bottom: 6px;
}

/* Grid of Editable Fields */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 28px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.field input {
  background: rgba(11, 15, 25, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 14px;
  transition: var(--transition);
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  background: rgba(11, 15, 25, 0.8);
}

/* Specific styling for total amounts input fields */
.field.totals input {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #38bdf8;
}

/* Save Indicator Badge */
.save-indicator {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: #10b981;
  color: #ffffff;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.4);
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  pointer-events: none;
}

.save-indicator.show {
  opacity: 1;
  transform: translateY(0);
}

/* Items Section */
.items-section {
  margin-bottom: 40px;
}

.items-section h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  margin-bottom: 16px;
}

.items-table th {
  padding: 12px 16px;
}

.items-table td {
  padding: 12px 16px;
}

.ean {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-size: 13px;
}

/* Detail action elements */
.detail-actions {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--border-color);
  padding-top: 32px;
}

/* Keyframes animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  from {
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.05);
  }
  to {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.15);
  }
}

/* Responsive fixes */
@media (max-width: 768px) {
  .topbar {
    padding: 16px 20px;
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .export-links {
    flex-direction: column;
    gap: 8px;
  }
  
  .detail-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
}

/* PDF megtekintése gombok */
.btn-pdf-view {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-pdf-view:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-reprocess {
  background: rgba(99, 102, 241, 0.1);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.2);
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
}

.btn-reprocess:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: rotate(180deg);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-pdf-view-large {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
  transition: var(--transition);
}

.btn-pdf-view-large:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

/* Feldolgozási és Hiba státusz badge-ek */
.badge.processing {
  background-color: var(--primary-glow);
  color: #818cf8;
  border-color: rgba(99, 102, 241, 0.3);
  animation: pulseOpacity 1.5s infinite alternate;
}

.badge.failed {
  background-color: var(--accent-danger-glow);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
  cursor: help;
}

/* Jelszó láthatóság kapcsoló szem-ikon stílus */
.password-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-container input {
  padding-right: 42px !important;
  width: 100%;
}

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.toggle-password:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

/* További animációk a prémium érzetért */
@keyframes pulseOpacity {
  from {
    opacity: 0.55;
  }
  to {
    opacity: 1;
  }
}

/* Finom beúszás a táblázat sorainak */
tbody tr {
  animation: fadeInRow 0.3s ease-out both;
}

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

/* Megszakítás (X) gomb stílus */
.btn-cancel {
  background: rgba(244, 63, 94, 0.1);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
  padding: 0;
  margin-left: 4px;
}

.btn-cancel:hover {
  background: var(--accent-danger);
  color: #ffffff;
  border-color: var(--accent-danger);
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}

/* Suffix (Ft) formázás beviteli mezőkhöz */
.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-suffix input {
  padding-right: 42px !important;
  width: 100%;
}

.input-with-suffix .suffix {
  position: absolute;
  right: 14px;
  color: #38bdf8;
  font-weight: 700;
  font-size: 13px;
  pointer-events: none;
  font-family: var(--font-sans);
}

/* Gemini pulsing shimmer loading animation for rows */
tr.processing-row {
  pointer-events: none !important;
  cursor: wait;
}

tr.processing-row td {
  background: linear-gradient(
    90deg,
    rgba(18, 24, 36, 0.85) 0%,
    rgba(99, 102, 241, 0.08) 25%,
    rgba(168, 85, 247, 0.08) 50%,
    rgba(99, 102, 241, 0.08) 75%,
    rgba(18, 24, 36, 0.85) 100%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 2.5s infinite linear, gemini-pulse-bg 2s infinite alternate ease-in-out;
  border-top: 1px solid rgba(99, 102, 241, 0.2) !important;
  border-bottom: 1px solid rgba(99, 102, 241, 0.2) !important;
  color: var(--text-soft) !important;
}

tr.processing-row td.issuer {
  color: #a5b4fc !important;
  text-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

tr.processing-row .btn-cancel {
  pointer-events: auto !important;
}

@keyframes shimmer-sweep {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes gemini-pulse-bg {
  0% {
    background-color: rgba(99, 102, 241, 0.02);
  }
  100% {
    background-color: rgba(99, 102, 241, 0.07);
  }
}

/* Split Layout Container */
.detail-split-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: start;
}

@media (min-width: 1024px) {
  .detail-split-container {
    grid-template-columns: 1fr 1fr; /* 50% / 50% arányú tökéletes felosztás */
  }
}

/* Sticky PDF column on desktop */
.pdf-viewer-column {
  position: relative;
}

@media (min-width: 1024px) {
  .pdf-viewer-column {
    position: sticky;
    top: 90px;
    height: calc(100vh - 130px);
  }
}

/* Sci-fi Glassmorphism Card for PDF */
.pdf-viewer-card {
  background: rgba(11, 15, 25, 0.45);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 35px rgba(99, 102, 241, 0.15);
  display: flex;
  flex-direction: column;
  height: 550px; /* Stacking height on mobile */
  overflow: hidden;
  position: relative;
  transition: var(--transition);
}

.pdf-viewer-card:hover {
  border-color: rgba(56, 189, 248, 0.4);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(56, 189, 248, 0.15);
}

@media (min-width: 1024px) {
  .pdf-viewer-card {
    height: 100%; /* Fills the sticky column on desktop */
  }
}

/* Lézer letapogató effekt a kártya felső élén */
.pdf-viewer-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #6366f1, #38bdf8, transparent);
  animation: laserScan 4s linear infinite;
  z-index: 10;
}

@keyframes laserScan {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Sci-Fi PDF Header */
.pdf-viewer-header {
  padding: 14px 20px;
  background: rgba(11, 15, 25, 0.7);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}

.pdf-viewer-header .panel-title {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  color: #38bdf8;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.8px;
}

.pdf-viewer-header .neon-dot {
  width: 6px;
  height: 6px;
  background-color: #38bdf8;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #38bdf8, 0 0 15px #38bdf8;
  animation: blinkFast 1.5s infinite alternate;
}

@keyframes blinkFast {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

.pdf-viewer-header .file-name {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 180px;
}

/* Body and viewer containers */
.pdf-viewer-body {
  flex: 1;
  padding: 10px;
  background: #060913;
  display: flex;
  flex-direction: column;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: var(--radius-sm);
  background: #060913;
}

.image-viewer-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  background: #060913;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px;
}

.view-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: contrast(1.02) brightness(0.98);
}



