/* AGS-Stellantriebe GmbH - ZUGFeRD 2.2 / Factur-X Converter Styling */
:root {
  --ags-yellow: #FFDE00;
  --ags-yellow-hover: #E6C800;
  --ags-yellow-glow: rgba(255, 222, 0, 0.25);
  --ags-blue: #004488;
  --ags-blue-dark: #002D62;
  --ags-blue-light: #1A65B8;
  
  --bg-dark: #0a0f1d;
  --bg-card: rgba(16, 24, 44, 0.85);
  --bg-card-hover: rgba(22, 33, 60, 0.95);
  --bg-input: #0e172a;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 222, 0, 0.35);

  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.25);
  --success-bg: rgba(16, 185, 129, 0.12);
  
  --warning: #F59E0B;
  --info: #38BDF8;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(0, 45, 98, 0.3);
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 68, 136, 0.18) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(255, 222, 0, 0.08) 0%, transparent 40%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Header */
.app-header {
  background: rgba(10, 15, 29, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.9rem 2rem;
}

.header-container {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Corporate Logo */
.ags-logo-badge {
  background: var(--ags-yellow);
  color: var(--ags-blue-dark);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px var(--ags-yellow-glow);
  line-height: 1;
  text-decoration: none;
}

.ags-logo-text {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 2px;
}

.ags-logo-sub {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: lowercase;
  letter-spacing: 0.5px;
}

.header-titles h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.header-titles p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.badge-pill {
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pill.yellow {
  background: rgba(255, 222, 0, 0.15);
  color: var(--ags-yellow);
  border: 1px solid rgba(255, 222, 0, 0.3);
}

.badge-pill.green {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-pill.blue {
  background: rgba(56, 189, 248, 0.12);
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.company-pill-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.company-pill-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  color: var(--text-primary);
  border-color: var(--border-highlight);
}

/* Main Container */
.main-content {
  max-width: 1320px;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Hero Section */
.hero-card {
  background: linear-gradient(135deg, rgba(0, 45, 98, 0.35) 0%, rgba(16, 24, 44, 0.6) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

.hero-text h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #fff;
}

.hero-text p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  max-width: 680px;
}

.profile-selector-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.25);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.profile-selector-box label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.profile-selector-box select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.profile-selector-box select:focus {
  border-color: var(--ags-yellow);
}

/* Upload Dropzone */
.dropzone {
  background: var(--bg-card);
  border: 2px dashed rgba(255, 222, 0, 0.35);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--ags-yellow);
  background: var(--bg-card-hover);
  box-shadow: 0 0 35px var(--ags-yellow-glow);
  transform: translateY(-2px);
}

.dropzone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  pointer-events: none;
}

.dropzone-inner * {
  pointer-events: auto;
}

.drop-icon-wrapper {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(255, 222, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ags-yellow);
  margin-bottom: 0.25rem;
  transition: var(--transition);
}

.dropzone:hover .drop-icon-wrapper {
  transform: scale(1.08);
  background: rgba(255, 222, 0, 0.18);
}

.dropzone h3 {
  font-size: 1.25rem;
  font-weight: 700;
}

.dropzone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.btn-group-upload {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.65rem 1.35rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: var(--ags-yellow);
  color: var(--ags-blue-dark);
  font-weight: 700;
  box-shadow: 0 4px 15px var(--ags-yellow-glow);
}

.btn-primary:hover {
  background: var(--ags-yellow-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--ags-yellow-glow);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 15px var(--success-glow);
}

.btn-success:hover {
  background: #0d9668;
  transform: translateY(-1px);
}

.btn-outline-info {
  background: transparent;
  color: var(--info);
  border: 1px solid rgba(56, 189, 248, 0.4);
}

.btn-outline-info:hover {
  background: rgba(56, 189, 248, 0.1);
}

/* SUCCESS BANNER & CHECKMARK SECTION ("son Haken ob alles geklappt hat") */
.success-card {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 24, 44, 0.95) 100%);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.15);
  animation: slideDown 0.4s ease;
  position: relative;
  overflow: hidden;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-15px); }
  to { opacity: 1; transform: translateY(0); }
}

.success-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.big-check-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  box-shadow: 0 0 25px var(--success-glow);
  flex-shrink: 0;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.3); opacity: 0; }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.success-header-text h3 {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.success-header-text p {
  color: #A7F3D0;
  font-size: 0.9rem;
}

.validation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.8rem;
  margin: 1.25rem 0 1.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-md);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.val-item {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.val-item .tick {
  color: var(--success);
  font-weight: 900;
  font-size: 1rem;
  line-height: 1.2;
}

.val-item strong {
  color: #fff;
}

/* Action Downloads Bar */
.action-download-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.download-buttons {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

/* Data & Mapping Overview Section */
.overview-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.tabs-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
  padding: 0.4rem 1rem 0;
  gap: 0.5rem;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--ags-yellow);
  border-bottom-color: var(--ags-yellow);
}

.tab-content {
  padding: 2rem;
  display: none;
}

.tab-content.active {
  display: block;
}

/* Layout Grid for Tab 1 */
.data-grid-two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.sub-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.sub-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.sub-card-header h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ags-yellow);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.field-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  margin-bottom: 0.6rem;
  font-size: 0.86rem;
}

.field-label {
  color: var(--text-muted);
  font-weight: 500;
}

.field-value {
  color: var(--text-primary);
  font-weight: 500;
}

.editable-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: 100%;
  font-family: inherit;
  transition: var(--transition);
}

.editable-input:focus {
  border-color: var(--ags-yellow);
  outline: none;
  background: #131e38;
}

/* Line Items Table */
.table-responsive {
  overflow-x: auto;
  margin-top: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.4);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: top;
}

.data-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.item-desc-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: pre-line;
  margin-top: 0.25rem;
}

.art-numbers {
  display: flex;
  gap: 0.8rem;
  font-size: 0.75rem;
  margin-top: 0.3rem;
}

.art-badge {
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}

.art-badge span {
  color: var(--text-primary);
  font-weight: 600;
}

/* Totals Summary Box */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.total-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.total-card.highlight {
  background: linear-gradient(135deg, rgba(255, 222, 0, 0.12) 0%, rgba(0, 45, 98, 0.25) 100%);
  border-color: rgba(255, 222, 0, 0.4);
}

.total-card .lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.total-card .val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.total-card.highlight .val {
  color: var(--ags-yellow);
  font-size: 1.45rem;
}

/* Mapping Matrix Table */
.mapping-badge {
  font-family: monospace;
  font-size: 0.78rem;
  background: rgba(0, 68, 136, 0.25);
  color: #60A5FA;
  border: 1px solid rgba(0, 68, 136, 0.4);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.zugferd-path {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Code Inspector & PDF Canvas */
.code-container {
  position: relative;
  background: #070c18;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.code-pre {
  margin: 0;
  padding: 1.25rem;
  color: #E2E8F0;
  font-family: "Fira Code", Consolas, Monaco, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  max-height: 520px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* PDF Preview Frame */
.pdf-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #1e293b;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

#pdf-canvas {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover {
  color: #fff;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.8rem 1.4rem;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.88rem;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
  }
  .data-grid-two-col {
    grid-template-columns: 1fr;
  }
  .action-download-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .download-buttons {
    flex-direction: column;
  }
}
