﻿@font-face {
  font-family: "Inter";
  src: url("https://<your-storage-account>.blob.core.windows.net/fonts/Inter-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --primary-color: #43a047;
  --header-bg-start: #2e7d32;
  --header-bg-end: #43a047;
  --accent-green: #a3d95b;
  --accent-green-hover: #8cc94a;
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  background: linear-gradient(90deg, var(--header-bg-start) 0%, var(--header-bg-end) 100%);
  padding: 1rem 2rem;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  background: #a3d95b;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e3a8a;
}

.settings-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Main Content */
.main-container {
  max-width: 1200px;
  margin: 2rem auto;
  width: 95%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  border: 1px solid var(--border-color);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Form Grid System */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Desktop Grid Columns */
.col-2 {
  grid-column: span 2;
}

.col-3 {
  grid-column: span 3;
}

.col-4 {
  grid-column: span 4;
}

.col-5 {
  grid-column: span 5;
}

.col-6 {
  grid-column: span 6;
}

.col-8 {
  grid-column: span 8;
}

.col-12 {
  grid-column: span 12;
}

/* Ensure inputs fill their grid cells */
.form-group {
  width: 100%;
}

/* Email inputs specific fix */
#email-container input {
  width: 100%;
}

@media (max-width: 768px) {

  /* Prevent horizontal scroll */
  body,
  html {
    overflow-x: hidden;
  }

  /* Grid: Stack everything */
  .col-2,
  .col-3,
  .col-4,
  .col-5,
  .col-6,
  .col-8,
  .col-12 {
    grid-column: span 12 !important;
  }

  /* Container: Remove side margins/padding that cause overflow */
  .main-container {
    width: 100%;
    margin: 0;
    padding: 1rem;
    max-width: 100vw;
  }

  /* Header: Better spacing */
  header {
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    text-align: center;
    padding: 1.5rem 1rem;
  }

  .logo {
    justify-content: center;
    font-size: 1.5rem;
    /* Larger title */
  }

  /* Card: Reduce padding to save space */
  .card {
    padding: 1rem;
    border-radius: 0;
    /* Optional: edge-to-edge look? Or keep radius. Let's keep radius but ensure no overflow */
    border-left: none;
    border-right: none;
    box-shadow: none;
  }

  /* Inputs: Full width and accessible */
  .form-group {
    width: 100%;
  }

  input,
  select,
  textarea {
    width: 100% !important;
    max-width: 100%;
    font-size: 16px;
    /* Prevent iOS zoom */
    padding: 12px;
    /* Large touch target */
    box-sizing: border-box;
    /* Critical for padding */
  }

  /* Date input specific fix for icon visibility */
  input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    min-height: 45px;
    /* Ensure height */
  }

  /* Action Bar: Stack buttons */
  .action-bar {
    flex-direction: column;
    /* Normal column direction: Upload (left in HTML) -> Submit (right in HTML) */
    gap: 1rem;
    align-items: stretch;
  }

  .action-bar>* {
    width: 100%;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }

  /* Toggle/Member Section */
  .toggle-container {
    width: 100%;
    display: flex;
  }

  .toggle-option {
    flex: 1;
    text-align: center;
  }

  /* Fix PLZ/Ort field layout on mobile */
  #mem-zip {
    width: 80px !important;
    flex: 0 0 auto !important;
  }

  #mem-city {
    width: auto !important;
    flex: 1 1 auto !important;
  }

  /* Fix Betrag/Währung field layout on mobile */
  #amount {
    width: auto !important;
    flex: 1 1 auto !important;
  }

  #currency {
    width: 80px !important;
    flex: 0 0 auto !important;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

input,
select {
  width: 100%;
  /* Ensure full width in grid cells */
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
  background: #fff;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--header-bg-end);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Action Bar */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-primary {
  background-color: var(--accent-green);
  color: #1e3a8a;
  font-weight: 600;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: white;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-secondary:hover {
  background-color: #f9fafb;
}

/* Upload Area (Styled as a compact zone or button integration) */
.upload-compact {
  border: 2px dashed var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  background: #f9fafb;
  margin-top: 5px;
}

.upload-compact:hover {
  border-color: var(--header-bg-end);
}

/* Preview */
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.preview-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 80px;
  /* Slightly wider than the 60px image to allow for text */
}

.preview-item {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #eee;
}

.file-name {
  font-size: 10px;
  color: var(--text-muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  width: 18px;
  height: 18px;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
}

/* Toggle Slider */
.toggle-container {
  display: flex;
  align-items: center;
  background: #e5e7eb;
  border-radius: 20px;
  padding: 4px;
  width: fit-content;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.toggle-option {
  padding: 8px 16px;
  border-radius: 16px;
  z-index: 2;
  transition: color 0.3s;
  font-weight: 500;
  color: var(--text-muted);
}

.toggle-option.active {
  color: #1e3a8a;
  /* Primary Blue */
}

/* The sliding white background */
.toggle-switch {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  /* Initial pos for 'Existing' */
  width: 50%;
  /* Approx, js will adjust or css calc? */
  /* Simpler approach: Just style the options */
  display: none;
  /* Removing complex slider animation for stability, utilizing class switching */
}

.toggle-option.active {
  background-color: white;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hidden {
  display: none !important;
}

html.auth-locked #app {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

html.auth-locked #auth-overlay {
  display: flex;
}

#auth-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 9999;
}

.auth-card {
  background: #ffffff;
  width: 90%;
  max-width: 360px;
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  border: 1px solid #e5e7eb;
}

.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.auth-card label {
  margin-top: 0.75rem;
}

.auth-btn {
  margin-top: 1rem;
  width: 100%;
  background-color: var(--accent-green);
  color: #1e3a8a;
  font-weight: 600;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}

.auth-btn:hover {
  opacity: 0.9;
}

.auth-error {
  margin-top: 0.75rem;
  min-height: 1.1rem;
  color: #b91c1c;
  font-size: 0.9rem;
}

/* Switch Toggle UI */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked+.slider {
  background-color: #10b981;
  /* Success Green */
}

input:focus+.slider {
  box-shadow: 0 0 1px #10b981;
}

input:checked+.slider:before {
  transform: translateX(24px);
}

/* Spinner / Loading Animation (External) */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  /* Green if external */
  animation: spin 1s linear infinite;
  display: inline-block;
}

.spinner.hidden {
  display: none !important;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Button Loading State (Just disabled look) */
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
