/* ==========================================================================
   Urodziny Kamy – Minimalist & Mature Design System
   Estetyka: Editorial / Scandinavian Minimal / Warm Monochrome & Stone
   ========================================================================== */

/* Hide uninitialized Alpine elements */
[x-cloak] {
  display: none !important;
}

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;

  /* Paleta neutralna (Warm Stone / Alabaster) */
  --bg-page: #faf9f6;
  --bg-card: #ffffff;
  --bg-card-alt: #f5f4f0;
  --bg-modal-backdrop: rgba(12, 10, 9, 0.45);

  /* Typografia */
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-muted: #78716c;
  --text-light: #a8a29e;

  /* Akcenty (Monochromatyczny / Dark Slate / Muted Moss) */
  --primary: #1c1917;
  --primary-hover: #292524;
  --primary-light: #f5f4f0;
  --primary-border: #e7e5e4;

  --success: #28724f;
  --success-hover: #1e5a3e;
  --success-bg: #edf7f2;
  --success-border: #bde5d2;

  --chat-me: #28724f;
  --chat-me-hover: #1e5a3e;

  --danger: #991b1b;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;

  /* Obramowania i cienie */
  --border-subtle: #e7e5e4;
  --border-medium: #d6d3d1;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 12px 32px -4px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  color: var(--text-primary);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.serif-heading {
  font-family: var(--font-serif);
  font-weight: 500;
}

p {
  margin-bottom: 0.8rem;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

a:hover {
  opacity: 0.8;
}

/* Kontenery */
.container {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  max-width: 520px;
}

/* Minimalistyczny Nagłówek */
.site-header {
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  font-family: var(--font-main);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-weight: 600;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-buttons-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-badge {
  font-size: 0.825rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
}

/* Przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-main);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success);
  color: #ffffff !important;
  border-color: var(--success);
}

.btn-success:hover {
  background-color: var(--success-hover);
  border-color: var(--success-hover);
}

.btn-outline {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.btn-outline:hover {
  background-color: var(--bg-card-alt);
  border-color: var(--text-muted);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Ikony SVG w przyciskach i nagłówkach */
.icon-svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  display: inline-block;
  vertical-align: middle;
}

.icon-svg-lg {
  width: 24px;
  height: 24px;
}

/* Sekcja Nagłówkowa / Hero */
.hero-welcome {
  text-align: center;
  padding: 36px 0 24px;
}

.hero-subtitle-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
  display: block;
}

.hero-welcome h1 {
  font-size: 2.1rem;
  margin-bottom: 8px;
  font-weight: 500;
}

.hero-welcome p {
  color: var(--text-secondary);
  font-size: 0.975rem;
  max-width: 520px;
  margin: 0 auto;
}

/* Podsumowanie: Mój wkład (Minimalist ledger style) */
.my-contribution-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.my-contribution-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.my-contribution-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
}

.my-contribution-stats {
  display: flex;
  gap: 32px;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.725rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

/* Sekcje Prezentów */
.section-header {
  margin-bottom: 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Grid Prezentów */
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 20px;
  margin-bottom: 48px;
}

.gift-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gift-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

.gift-card-media {
  position: relative;
  width: 100%;
  height: 200px;
  background-color: var(--bg-card-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gift-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gift-placeholder-icon {
  color: var(--text-light);
}

.gift-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  backdrop-filter: blur(8px);
}

.badge-open {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.badge-funded {
  background: var(--success);
  color: #ffffff;
}

.badge-closed {
  background: var(--danger);
  color: #ffffff;
}

.badge-my-pledge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(28, 25, 23, 0.92);
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.3px;
}

.gift-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.gift-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.35;
}

.gift-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
  flex: 1;
}

.gift-shop-link {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border-medium);
  width: fit-content;
}

.gift-shop-link:hover {
  color: var(--text-primary);
  border-bottom-style: solid;
}

/* Minimalistyczny Pasek Postępu */
.progress-container {
  margin: 12px 0 16px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.progress-collected {
  font-weight: 600;
  color: var(--text-primary);
}

.progress-total {
  color: var(--text-muted);
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background-color: var(--bg-card-alt);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-pill);
  transition: width 0.4s ease;
}

.progress-bar-fill.funded {
  background: var(--success);
}

.gift-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

/* Sekcja Sugestii Drobiazgów */
.suggestions-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px 28px;
  margin-bottom: 48px;
}

.suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-top: 16px;
}

.suggestion-card {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.suggestion-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-sm);
}

.suggestion-card-media {
  width: 100%;
  height: 140px;
  background-color: #f0eee9;
  overflow: hidden;
}

.suggestion-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.suggestion-card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.suggestion-card h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.suggestion-card p {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-bottom: 8px;
}

/* Modale */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--bg-modal-backdrop);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-content {
  background: #ffffff;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  margin: auto;
  padding: 28px;
  position: relative;
  animation: modalIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.quick-amount-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.chip-btn {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 9px 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  background: #ffffff;
  border-color: var(--text-primary);
}

.chip-btn.chip-full {
  grid-column: span 3;
  background: #ffffff;
  border-color: var(--border-medium);
  color: var(--text-primary);
}

.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.input-field {
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: var(--font-main);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  background: #ffffff;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s ease;
}

.input-field:focus {
  border-color: var(--text-primary);
}

/* Welcome Card & RODO notice */
.welcome-card {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 36px 32px;
  box-shadow: var(--shadow-sm);
  margin-top: 24px;
}

.rodo-notice {
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 14px 16px;
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 20px;
}

.rodo-notice strong {
  color: var(--text-primary);
}

/* Chat */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  min-height: 520px;
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-header {
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-tip-bar {
  background: var(--bg-card-alt);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #faf9f6;
}

.message-item {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.message-item.me {
  align-self: flex-end;
  align-items: flex-end;
}

.message-item.other {
  align-self: flex-start;
  align-items: flex-start;
}

.message-meta {
  font-size: 0.725rem;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.message-bubble {
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
}

.message-item.me .message-bubble {
  background-color: var(--chat-me);
  color: #ffffff;
  border-bottom-right-radius: 2px;
}

.message-item.other .message-bubble {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 2px;
}

/* Pasek wskaźnika pisania */
.chat-typing-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  background: #faf9f6;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.775rem;
  color: var(--text-muted);
  min-height: 28px;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.typing-dots span {
  width: 4px;
  height: 4px;
  background-color: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
  animation-delay: 0s;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-3.5px);
    opacity: 1;
  }
}

.chat-input-bar {
  padding: 14px 18px;
  background: #ffffff;
  border-top: 1px solid var(--border-subtle);
}

.chat-form {
  display: flex;
  gap: 8px;
}

.chat-form .btn {
  background-color: var(--chat-me);
  border-color: var(--chat-me);
  color: #ffffff !important;
}

.chat-form .btn:hover:not(:disabled) {
  background-color: var(--chat-me-hover);
  border-color: var(--chat-me-hover);
}

.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  outline: none;
}

.chat-input:focus {
  border-color: var(--text-primary);
}

/* Alerty */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* Stopka */
.site-footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 0.775rem;
  color: var(--text-muted);
}

/* Responsywność */
@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  /* Uporządkowany, dwuliniowy nagłówek na telefonach */
  .site-header-inner {
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 10px 0 8px 0;
    gap: 8px;
  }

  .brand-logo {
    font-size: 1.15rem;
    justify-content: flex-start;
  }

  .brand-badge {
    font-size: 0.6rem;
    padding: 2px 5px;
  }

  .nav-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
  }

  .user-badge {
    padding: 4px 8px;
    font-size: 0.775rem;
    gap: 5px;
    max-width: 140px;
    background: #ffffff;
    border-radius: var(--radius-xs);
  }

  .user-badge .user-name {
    display: inline-block;
    max-width: 95px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
  }

  .nav-buttons-group {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .nav-buttons-group .btn-sm {
    padding: 5px 9px;
    font-size: 0.775rem;
    gap: 4px;
  }

  .hero-welcome {
    margin-bottom: 24px;
  }

  .hero-welcome h1 {
    font-size: 1.6rem;
  }

  .hero-welcome p {
    font-size: 0.9rem;
  }

  .gifts-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .my-contribution-stats {
    gap: 16px;
    flex-wrap: wrap;
  }

  .welcome-card {
    padding: 20px 16px;
  }

  .modal-content {
    margin: 16px;
    max-height: 90vh;
    padding: 22px 18px;
  }
}
