/* =============================================
   JULA Ausgaben – style.css
   Dark Mode · Glassmorphismus · Dynamic Island
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── CSS Variables ─────────────────────────── */
:root {
  --bg:            hsl(225, 20%, 8%);
  --bg-secondary:  hsl(225, 18%, 12%);
  --surface:       hsl(225, 16%, 16%);
  --surface-glass: hsla(225, 20%, 20%, 0.6);
  --border:        hsla(225, 20%, 40%, 0.25);
  --border-focus:  hsla(245, 60%, 70%, 0.5);

  --accent:        hsl(245, 65%, 65%);    /* Indigo */
  --accent-dark:   hsl(245, 65%, 55%);
  --success:       hsl(158, 64%, 52%);    /* Emerald */
  --success-dark:  hsl(158, 64%, 42%);
  --warning:       hsl(38, 92%, 60%);
  --danger:        hsl(0, 72%, 60%);

  --text:          hsl(225, 15%, 92%);
  --text-muted:    hsl(225, 10%, 55%);
  --text-subtle:   hsl(225, 10%, 38%);

  --radius-sm:   8px;
  --radius:      14px;
  --radius-lg:   20px;
  --radius-full: 999px;

  --shadow-card: 0 8px 32px hsla(0,0%,0%,0.35);
  --shadow-glow: 0 0 40px hsla(245,65%,65%,0.15);
  --shadow-success-glow: 0 0 40px hsla(158,64%,52%,0.2);

  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ──────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Background Gradient Blobs ─────────────── */
body::before,
body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: blob-float 12s ease-in-out infinite;
}
body::before {
  width: 500px; height: 500px;
  background: radial-gradient(circle, hsla(245,65%,65%,0.10), transparent 70%);
  top: -100px; left: -150px;
}
body::after {
  width: 600px; height: 600px;
  background: radial-gradient(circle, hsla(158,64%,52%,0.07), transparent 70%);
  bottom: -150px; right: -200px;
  animation-delay: -6s;
}
@keyframes blob-float {
  0%,100% { transform: translate(0,0); }
  33%      { transform: translate(40px,-30px); }
  66%      { transform: translate(-30px,20px); }
}

/* ─── Dynamic Island ─────────────────────────── */
#dynamic-island {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) scaleX(1);
  z-index: 1000;
  background: hsl(225, 20%, 5%);
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: default;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 24px hsla(0,0%,0%,0.5), inset 0 1px 0 hsla(255,100%,100%,0.05);
  width: 120px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#dynamic-island.idle {
  width: 120px; height: 34px;
}
#dynamic-island.loading {
  width: 240px; height: 44px;
}
#dynamic-island.success {
  width: 260px; height: 48px;
  background: linear-gradient(135deg, hsl(225,20%,5%), hsla(158,64%,52%,0.2));
  box-shadow: 0 4px 24px hsla(0,0%,0%,0.5), 0 0 30px hsla(158,64%,52%,0.3);
}
#dynamic-island.error {
  width: 280px; height: 48px;
  background: linear-gradient(135deg, hsl(225,20%,5%), hsla(0,72%,60%,0.15));
  box-shadow: 0 4px 24px hsla(0,0%,0%,0.5), 0 0 30px hsla(0,72%,60%,0.25);
}
#dynamic-island-content {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  white-space: nowrap;
  overflow: hidden;
}
#dynamic-island .di-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: hsl(225, 15%, 35%);
  flex-shrink: 0;
}
#dynamic-island.loading .di-dot { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
#dynamic-island.success .di-dot { background: var(--success); }
#dynamic-island.error   .di-dot { background: var(--danger); }

#dynamic-island .di-text {
  font-size: 13px; font-weight: 600; letter-spacing: 0.01em;
  color: var(--text-muted);
  transition: opacity 0.3s;
}
#dynamic-island.loading .di-text { color: var(--text); }
#dynamic-island.success .di-text { color: var(--success); }
#dynamic-island.error   .di-text { color: var(--danger); }

#dynamic-island .di-progress {
  height: 3px; border-radius: 2px;
  background: var(--border);
  overflow: hidden;
  width: 80px;
  flex-shrink: 0;
}
#dynamic-island .di-progress-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), hsl(280, 65%, 70%));
  border-radius: 2px;
  transition: width 0.3s ease;
}
#dynamic-island.idle .di-progress { display: none; }

@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Navigation / Header ────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: hsla(225, 20%, 8%, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none;
}
.nav-logo .logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), hsl(280, 65%, 65%));
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px hsla(245,65%,65%,0.35);
}
.nav-logo .logo-text {
  font-weight: 700; font-size: 17px;
  background: linear-gradient(135deg, var(--text), var(--text-muted));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-logo .logo-sub { font-size: 11px; color: var(--text-subtle); font-weight: 400; }

.nav-tabs {
  display: flex; gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 4px;
}
.nav-tab {
  padding: 7px 16px;
  border-radius: 10px;
  border: none; cursor: pointer;
  font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.nav-tab:hover { color: var(--text); background: var(--surface-glass); }
.nav-tab.active {
  background: linear-gradient(135deg, var(--accent), hsl(280, 65%, 65%));
  color: #fff;
  box-shadow: 0 4px 12px hsla(245,65%,65%,0.4);
}

/* ─── Hamburger Menu (Mobile) ────────────────── */
.hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  background: var(--surface);
  gap: 5px;
  transition: all var(--transition);
}
.hamburger span {
  width: 20px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all var(--transition);
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: hsla(225, 20%, 5%, 0.95);
  backdrop-filter: blur(20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}
.mobile-menu .mobile-tab {
  width: 260px; padding: 16px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-glass);
  color: var(--text);
  font-size: 16px; font-weight: 600;
  cursor: pointer;
  text-align: left;
  display: flex; align-items: center; gap: 14px;
  transition: all var(--transition);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.mobile-menu .mobile-tab:hover,
.mobile-menu .mobile-tab.active {
  border-color: var(--accent);
  background: hsla(245,65%,65%,0.15);
  color: #fff;
}
.mobile-menu .mobile-tab-icon { font-size: 22px; }

/* ─── Main Layout ─────────────────────────────── */
main {
  position: relative; z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.page { display: none; }
.page.active { display: block; }

/* Centered layout for form */
.form-layout {
  max-width: 680px;
  margin: 0 auto;
}

/* ─── Cards / Glass Panels ───────────────────── */
.card {
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-card), var(--shadow-glow); }

.card-title {
  font-size: 20px; font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text), var(--text-muted));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.card-subtitle { font-size: 13px; color: var(--text-subtle); margin-bottom: 24px; }

/* ─── Form Elements ───────────────────────────── */
.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 7px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
label .required {
  color: var(--accent);
  margin-left: 3px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  -webkit-appearance: none;
}
select {
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='hsl(225, 10%, 55%)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 40px;
  cursor: pointer;
}
select option {
  background: var(--bg-secondary);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px hsla(245,65%,65%,0.12), 0 0 20px hsla(245,65%,65%,0.08);
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

.input-prefix-wrap {
  position: relative;
}
.input-prefix {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 15px; font-weight: 600; color: var(--text-muted);
  pointer-events: none;
}
.input-prefix-wrap input { padding-left: 30px; }

/* ─── Image Upload ────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: hsla(245,65%,65%,0.05);
}
.upload-area input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-label { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.upload-hint { font-size: 12px; color: var(--text-subtle); margin-top: 4px; }
.upload-camera-btn {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 9px 18px;
  background: linear-gradient(135deg, var(--accent), hsl(280,65%,65%));
  color: #fff; border: none; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 600; cursor: pointer;
  position: relative; z-index: 2;
  box-shadow: 0 4px 12px hsla(245,65%,65%,0.35);
  transition: all var(--transition);
}
.upload-camera-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px hsla(245,65%,65%,0.45); }

.preview-container {
  position: relative; margin-top: 16px;
  border-radius: var(--radius);
  overflow: hidden;
  display: none;
}
.preview-container.visible { display: block; }
.preview-img {
  width: 100%; max-height: 260px;
  object-fit: cover; border-radius: var(--radius);
  display: block;
}
.preview-remove {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: hsla(0,72%,60%,0.85);
  border: none; cursor: pointer; color: #fff;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.preview-remove:hover { background: var(--danger); transform: scale(1.1); }
.preview-info {
  padding: 8px 0 0;
  font-size: 12px; color: var(--text-subtle);
}

/* ─── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius);
  border: none; cursor: pointer;
  font-size: 15px; font-weight: 600;
  font-family: inherit;
  transition: all var(--transition);
  position: relative; overflow: hidden;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: hsla(255,100%,100%,0);
  transition: background var(--transition);
}
.btn:hover::after { background: hsla(255,100%,100%,0.07); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent), hsl(280, 65%, 65%));
  color: #fff;
  box-shadow: 0 4px 16px hsla(245,65%,65%,0.4);
  font-size: 16px;
}
.btn-primary:hover { box-shadow: 0 6px 24px hsla(245,65%,65%,0.5); transform: translateY(-1px); }
.btn-primary:disabled {
  opacity: 0.5; cursor: not-allowed;
  transform: none; box-shadow: none;
}
.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-focus); }

.btn-icon { font-size: 18px; }
.btn-spinner {
  width: 18px; height: 18px;
  border: 2.5px solid hsla(255,100%,100%,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-label { opacity: 0.6; }

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

/* ─── Iban hint ───────────────────────────────── */
.iban-saved-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  color: var(--success);
  background: hsla(158,64%,52%,0.12);
  border: 1px solid hsla(158,64%,52%,0.25);
  border-radius: var(--radius-full);
  padding: 2px 8px; margin-left: 8px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity var(--transition);
}
.iban-saved-badge.visible { opacity: 1; }

/* ─── History Panel ───────────────────────────── */
.history-card { position: sticky; top: 80px; }
.history-empty {
  text-align: center; padding: 32px 16px;
  color: var(--text-subtle); font-size: 14px;
}
.history-empty-icon { font-size: 40px; margin-bottom: 8px; }

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: all var(--transition);
  cursor: default;
}
.history-item:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
}
.history-item-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 4px;
}
.history-item-grund { font-size: 14px; font-weight: 600; color: var(--text); }
.history-item-betrag {
  font-size: 15px; font-weight: 700;
  color: var(--success);
  flex-shrink: 0; margin-left: 8px;
}
.history-item-meta { font-size: 12px; color: var(--text-subtle); }
.history-item-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  color: var(--success);
  background: hsla(158,64%,52%,0.12);
  border-radius: var(--radius-full);
  padding: 2px 7px;
  margin-top: 6px;
}

/* ─── Help Page ───────────────────────────────── */
.help-section { margin-bottom: 28px; }
.help-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; color: var(--text); }
.help-steps { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.help-step {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface-glass);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  backdrop-filter: blur(8px);
}
.help-step-num {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), hsl(280,65%,65%));
  color: #fff; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.help-step-text { font-size: 14px; color: var(--text-muted); padding-top: 4px; }

/* ─── Footer ──────────────────────────────────── */
footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  color: var(--text-subtle);
  font-size: 12px;
}
.footer-inner { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.footer-link {
  color: var(--text-subtle); text-decoration: none;
  transition: color var(--transition);
}
.footer-link:hover { color: var(--text-muted); }
.admin-link {
  font-size: 11px;
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  opacity: 1 !important;
  pointer-events: all !important;
}
.admin-link:hover {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
  background: hsla(245, 65%, 65%, 0.1);
  transform: translateY(-1px);
}

/* ─── Success Screen ──────────────────────────── */
.success-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: hsla(225,20%,5%,0.85);
  backdrop-filter: blur(8px);
  align-items: center; justify-content: center;
}
.success-overlay.visible { display: flex; }
.success-card {
  background: var(--surface-glass);
  border: 1px solid hsla(158,64%,52%,0.3);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  max-width: 400px; width: 90%;
  box-shadow: var(--shadow-card), var(--shadow-success-glow);
  backdrop-filter: blur(20px);
  animation: success-pop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes success-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.success-icon { font-size: 64px; margin-bottom: 16px; animation: icon-bounce 0.6s 0.3s cubic-bezier(0.34,1.56,0.64,1) both; }
@keyframes icon-bounce {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}
.success-title { font-size: 24px; font-weight: 800; color: var(--success); margin-bottom: 8px; }
.success-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.success-id {
  background: var(--bg-secondary); border-radius: var(--radius-sm); padding: 8px 14px;
  font-size: 12px; font-family: monospace; color: var(--text-subtle); margin-bottom: 24px;
}

/* ─── Validation Feedback ─────────────────────── */
.field-error {
  font-size: 12px; color: var(--danger);
  margin-top: 5px; display: none;
  animation: fade-in 0.2s ease;
}
.form-group.invalid .field-error { display: block; }
.form-group.invalid input,
.form-group.invalid textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px hsla(0,72%,60%,0.10);
}
.form-group.valid input,
.form-group.valid textarea {
  border-color: hsla(158,64%,52%,0.5);
}

@keyframes fade-in { from { opacity:0; transform: translateY(-4px); } to { opacity:1; transform: none; } }

/* ─── Responsive ──────────────────────────────── */

@media (max-width: 640px) {
  .nav-tabs { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: flex; }
  main { padding: 24px 16px 80px; }
  .card { padding: 20px 16px; }
  .nav { padding: 0 16px; }
  #dynamic-island { top: 12px; }
}
