:root {
  --black: #000000;
  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --orange-50: #fff7ed;
  --orange-100: #ffedd5;
  --orange-200: #fed7aa;
  --orange-500: #f97316;
  --orange-600: #ea580c;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body,
html {
  margin: 0;
  padding: 0;
  height: 100%;
  background-color: var(--white);
  color: var(--black);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* MAIN CONTAINER - Normal flow layout */
.main-container {
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

/* Explizite Layout-Regeln für alle Hauptelemente */
.header,
.instructions-card,
.upload-section,
.button,
#message {
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* Sicherstellen, dass Flexbox korrekt funktioniert */
.main-container > * {
  margin-left: 0;
  margin-right: 0;
}

/* LOGIN SCREEN - Fixed overlay */
.login-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--white);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* LOGIN FOOTER - Unter der Login-Card */
.login-footer {
  margin-top: 24px;
  text-align: center;
}

/* APP FOOTER - Unter dem Main Content */
.app-footer {
  margin-top: 32px;
  padding: 20px 0;
  text-align: center;
  border-top: 1px solid var(--gray-200);
}

.footer-link {
  display: inline-block;
  text-decoration: none;
  color: var(--gray-700);
  font-weight: 500;
  transition: color var(--transition-normal);
  font-size: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  pointer-events: auto;
}

.footer-link:hover {
  color: var(--black);
  background-color: var(--gray-100);
}

.footer-link:active {
  background-color: var(--gray-200);
}

/* All other styles remain the same */
.header {
  margin-bottom: 20px;
  text-align: center;
  padding-bottom: 12px;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--black);
  margin-bottom: 4px;
}

.header-subtitle {
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 400;
}

.instructions-card {
  background-color: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.instructions-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--black);
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step {
  display: flex;
  align-items: center;
  padding: 8px 0;
}

.step-number {
  width: 28px;
  height: 28px;
  background-color: var(--gray-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--gray-700);
  margin-right: 16px;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--black);
  margin-bottom: 4px;
}

.step-description {
  color: var(--gray-600);
  font-size: 12px;
  line-height: 1.4;
}

.upload-section {
  margin-bottom: 20px;
}

.upload-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--black);
  display: flex;
  align-items: center;
}

.upload-box {
  background-color: var(--white);
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.upload-box:hover {
  border-color: var(--black);
  background-color: var(--gray-50);
}

.upload-box:active {
  transform: scale(0.99);
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 12px;
  opacity: 0.8;
}

.upload-text {
  font-weight: 500;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--gray-800);
}

.upload-subtext {
  color: var(--gray-500);
  font-size: 13px;
}

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

/* NEUE UPLOAD STATUS CARD */
.upload-status-card {
  margin-top: 16px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--orange-50) 0%, var(--orange-100) 100%);
  border: 2px solid var(--orange-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: none; /* Initially hidden */
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  animation: slideInUp 0.3s ease-out;
  position: relative;
  z-index: 10;
}

/* Debug styles */
.upload-status-card.debug {
  border: 3px solid red !important;
  background: yellow !important;
}

.upload-status-card * {
  pointer-events: none; /* Prevent interference */
}

.upload-status-card.success {
  background: linear-gradient(135deg, var(--green-50) 0%, var(--green-100) 100%);
  border-color: var(--green-500);
}

.upload-status-card.error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #ef4444;
}

.upload-status-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background-color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  position: relative;
  flex-shrink: 0;
}

.upload-status-card.success .upload-status-icon {
  background-color: var(--green-500);
}

.upload-status-card.error .upload-status-icon {
  background-color: #ef4444;
}

.file-type-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upload-status-card.success .file-type-badge {
  display: none;
}

.upload-status-card.error .file-type-badge {
  color: var(--white);
}

.upload-status-content {
  flex: 1;
  min-width: 0;
}

.upload-status-filename {
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-900);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.upload-status-progress {
  font-size: 13px;
  font-weight: 500;
  color: var(--orange-600);
}

.upload-status-card.success .upload-status-progress {
  color: var(--green-600);
}

.upload-status-card.error .upload-status-progress {
  color: #dc2626;
}

.upload-status-indicator {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.progress-ring {
  width: 24px;
  height: 24px;
  transform: rotate(-90deg);
}

.progress-ring-svg {
  width: 24px;
  height: 24px;
}

.progress-ring-circle-bg {
  fill: none;
  stroke: rgba(0, 0, 0, 0.1);
  stroke-width: 2;
}

.progress-ring-circle {
  fill: none;
  stroke: var(--orange-500);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 62.83;
  stroke-dashoffset: 62.83;
  transition: stroke-dashoffset 0.3s ease;
}

.upload-status-card.success .progress-ring-circle {
  stroke: var(--green-500);
  stroke-dashoffset: 0;
}

.upload-status-card.error .progress-ring-circle {
  stroke: #ef4444;
}

/* Success checkmark */
.upload-status-card.success .upload-status-icon::after {
  content: "✓";
  color: var(--white);
  font-size: 24px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Error X mark */
.upload-status-card.error .upload-status-icon::after {
  content: "✕";
  color: var(--white);
  font-size: 20px;
  font-weight: bold;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

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

.file-list-container {
  margin-top: 16px;
  background-color: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--transition-normal), margin var(--transition-normal);
}

.file-list-container.has-files {
  max-height: 250px;
  margin-bottom: 20px;
}

.file-list-header {
  background-color: var(--gray-100);
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-800);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-count {
  font-size: 14px;
  color: var(--gray-600);
}

.file-list {
  list-style: none;
  padding: 8px 0;
  max-height: 200px;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
  transition: background-color var(--transition-fast);
}

.file-item:last-child {
  border-bottom: none;
}

.file-item:hover {
  background-color: var(--gray-50);
}

.file-icon {
  width: 32px;
  height: 32px;
  background-color: var(--gray-100);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 16px;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-weight: 500;
  color: var(--gray-900);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
}

.file-meta {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--gray-500);
}

.file-size {
  margin-right: 16px;
}

.file-type {
  text-transform: uppercase;
  letter-spacing: .5px;
}

.file-remove {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--gray-200);
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all var(--transition-fast);
}

.file-remove:hover {
  background-color: #fee2e2;
  color: #b91c1c;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px 24px;
  background-color: var(--black);
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-top: 8px;
}

.button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  background-color: var(--gray-400);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-icon {
  margin-right: 8px;
  font-size: 18px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--white);
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin .8s linear infinite;
  margin-right: 10px;
}

@keyframes progress {
  0% {
    width: 0%;
  }
  100% {
    width: 100%;
  }
}

.loading-bar-container {
  width: 280px;
  height: 8px;
  background-color: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.loading-bar {
  height: 100%;
  background-color: var(--black);
  border-radius: 4px;
  animation: progress 2s ease-in-out;
}

.loading-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--gray-800);
  text-align: center;
}

#message {
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius-md);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--transition-normal), transform var(--transition-normal);
  position: relative;
}

#message.visible {
  opacity: 1;
  transform: translateY(0);
}

#message.success {
  background-color: #f0fdf4;
  color: #166534;
  border-left: 4px solid #22c55e;
}

#message.error {
  background-color: #fef2f2;
  color: #991b1b;
  border-left: 4px solid #ef4444;
}

.message-content {
  display: flex;
  align-items: center;
  flex: 1;
}

.message-content::before {
  margin-right: 10px;
  font-size: 18px;
}

#message.success .message-content::before {
  content: "✓";
}

/* Entferne das ✕ Symbol für error messages */
#message.error .message-content::before {
  content: "";
  margin-right: 0;
}

.message-close {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.1);
  color: currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: background-color var(--transition-fast);
  margin-left: 12px;
  flex-shrink: 0;
}

.message-close:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

.login-card {
  background-color: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--gray-200);
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-brand {
  font-family: "League Spartan", sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 20px;
  text-align: center;
}

.login-instruction {
  font-size: 15px;
  color: var(--gray-600);
  text-align: center;
  line-height: 1.5;
  margin-bottom: 8px;
}

.login-instruction a {
  color: var(--gray-700);
  text-decoration: underline;
  font-weight: 500;
}

.form-group {
  margin-bottom: 32px;
}

.form-label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--gray-800);
  font-size: 15px;
}

.form-input {
  width: 100%;
  padding: 16px 20px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 16px;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
  background-color: var(--white);
}

.form-input:focus {
  outline: 0;
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.form-input::placeholder {
  color: var(--gray-400);
}

#loginMessage {
  margin-top: 20px;
  color: #ef4444;
  font-size: 14px;
  text-align: center;
  font-weight: 500;
  min-height: 20px;
}

/* File type icons */
.file-icon[data-type="pdf"]::before {
  content: "PDF";
  font-size: 10px;
  font-weight: 700;
  color: #ef4444;
}

.file-icon[data-type="doc"]::before,
.file-icon[data-type="docx"]::before {
  content: "DOC";
  font-size: 10px;
  font-weight: 700;
  color: #2563eb;
}

.file-icon[data-type="xls"]::before,
.file-icon[data-type="xlsx"]::before {
  content: "XLS";
  font-size: 10px;
  font-weight: 700;
  color: #16a34a;
}

.file-icon[data-type="ppt"]::before,
.file-icon[data-type="pptx"]::before {
  content: "PPT";
  font-size: 10px;
  font-weight: 700;
  color: #ea580c;
}

.file-icon[data-type="gif"]::before,
.file-icon[data-type="jpeg"]::before,
.file-icon[data-type="jpg"]::before,
.file-icon[data-type="png"]::before {
  content: "IMG";
  font-size: 10px;
  font-weight: 700;
  color: #8b5cf6;
}

.file-icon[data-type="rar"]::before,
.file-icon[data-type="zip"]::before {
  content: "ZIP";
  font-size: 10px;
  font-weight: 700;
  color: #ca8a04;
}

.file-icon[data-type="txt"]::before {
  content: "TXT";
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
}

.floating-icon {
  font-size: 48px;
  margin-bottom: 24px;
  animation: floatY 1.8s ease-in-out infinite;
  user-select: none;
}

/* Debug panel styles */
#debug-output {
  font-size: 10px !important;
  line-height: 1.2 !important;
}

#debug-output div {
  margin-bottom: 2px;
  padding: 2px;
  border-bottom: 1px solid #ddd;
}

/* Responsive adjustments for small screens */
@media (max-height: 600px) {
  .login-card {
    padding: 24px;
    margin: 12px;
  }
  .login-brand {
    font-size: 24px;
    margin-bottom: 16px;
  }
  .login-header {
    margin-bottom: 24px;
  }
  .form-group {
    margin-bottom: 20px;
  }
}
