/* 
 * Maad Tracker Styles
 * A respectful, warm design for memorial records
 */

:root {
  /* Warm, earthy palette inspired by Jerusalem stone and parchment */
  --color-bg: #1a1612;
  --color-bg-card: #252019;
  --color-bg-card-hover: #2d271f;
  --color-text: #e8e0d4;
  --color-text-muted: #a69b8a;
  --color-text-hint: #7a6f60;
  --color-accent: #d4a853;
  --color-accent-soft: #c9973d;
  --color-accent-glow: rgba(212, 168, 83, 0.15);
  --color-border: #3d352a;
  --color-border-focus: #d4a853;
  --color-success: #6b9a5d;
  --color-error: #c45c5c;
  
  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Frank Ruhl Libre', Georgia, serif;
  
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Border radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(212, 168, 83, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 90, 43, 0.05) 0%, transparent 40%),
    radial-gradient(ellipse at 20% 90%, rgba(139, 90, 43, 0.05) 0%, transparent 40%);
  pointer-events: none;
  z-index: -1;
}

/* Ornamental corners */
.ornament {
  position: fixed;
  width: 120px;
  height: 120px;
  opacity: 0.15;
  pointer-events: none;
  z-index: 0;
}

.ornament.top-left {
  top: 0;
  left: 0;
  background: linear-gradient(135deg, var(--color-accent) 0%, transparent 60%);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.ornament.top-right {
  top: 0;
  right: 0;
  background: linear-gradient(-135deg, var(--color-accent) 0%, transparent 60%);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}

/* Container */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
  position: relative;
  z-index: 1;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: var(--space-3xl);
  padding-top: var(--space-xl);
}

.candle-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-lg);
}

.candle {
  width: 20px;
  height: 60px;
  background: linear-gradient(180deg, #f5e6d3 0%, #e8d4b8 100%);
  border-radius: 3px 3px 0 0;
  position: relative;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.candle::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 8px;
  background: linear-gradient(180deg, #8b7355 0%, #5c4a3a 100%);
  border-radius: 0 0 4px 4px;
}

.flame {
  position: absolute;
  top: -35px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 30px;
  background: linear-gradient(180deg, 
    rgba(255, 200, 100, 0) 0%, 
    rgba(255, 180, 80, 0.8) 30%, 
    rgba(255, 140, 50, 1) 60%, 
    rgba(200, 80, 30, 1) 100%
  );
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker 1.5s ease-in-out infinite alternate;
}

.flame-inner {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 12px;
  background: linear-gradient(180deg, #fff8e0 0%, #ffe4a0 100%);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flicker-inner 1s ease-in-out infinite alternate;
}

@keyframes flicker {
  0%, 100% { transform: translateX(-50%) scale(1) rotate(-1deg); }
  25% { transform: translateX(-50%) scale(1.02) rotate(1deg); }
  50% { transform: translateX(-50%) scale(0.98) rotate(-0.5deg); }
  75% { transform: translateX(-50%) scale(1.01) rotate(0.5deg); }
}

@keyframes flicker-inner {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.title {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--color-accent);
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
  text-shadow: 0 2px 20px var(--color-accent-glow);
}

.subtitle {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.tagline {
  font-style: italic;
  color: var(--color-text-hint);
  font-size: 0.95rem;
}

/* Cards */
.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.card h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  text-align: center;
}

.helper-text {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-xl);
}

/* Steps */
.step {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

.step.active {
  display: block;
}

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

/* Form Elements */
.form-section {
  border: none;
  margin-bottom: var(--space-xl);
}

.form-section legend {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--color-accent);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
  width: 100%;
}

.form-group {
  margin-bottom: var(--space-lg);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}

@media (max-width: 500px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

label {
  display: block;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="email"],
select {
  width: 100%;
  padding: var(--space-md);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

input::placeholder {
  color: var(--color-text-hint);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a69b8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-md) center;
  padding-right: var(--space-2xl);
}

.hint {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-hint);
  margin-top: var(--space-xs);
  font-style: italic;
}

/* Contact entries */
.contact-entry {
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  position: relative;
}

.contact-entry:first-child::before {
  content: 'Primary Contact';
  position: absolute;
  top: calc(-1 * var(--space-xs));
  right: var(--space-sm);
  font-size: 0.7rem;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-remove-contact {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  background: none;
  border: none;
  color: var(--color-text-hint);
  cursor: pointer;
  font-size: 1.2rem;
  padding: var(--space-xs);
  transition: color 0.2s;
}

.btn-remove-contact:hover {
  color: var(--color-error);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(180deg, var(--color-accent) 0%, var(--color-accent-soft) 100%);
  color: var(--color-bg);
  box-shadow: 0 2px 10px rgba(212, 168, 83, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(212, 168, 83, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-text-hint);
}

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  padding: var(--space-sm) var(--space-md);
  font-size: 0.9rem;
}

.btn-ghost:hover {
  background: var(--color-accent-glow);
}

.actions {
  display: flex;
  gap: var(--space-md);
  justify-content: space-between;
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* Existing records list */
.records-list {
  margin-bottom: var(--space-xl);
}

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.record-item:hover {
  background: var(--color-bg-card-hover);
  border-color: var(--color-accent);
}

.record-item .record-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.record-item .name {
  font-weight: 500;
  color: var(--color-text);
}

.record-item .hebrew-name {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.record-item .record-date {
  color: var(--color-accent);
  font-size: 0.85rem;
  white-space: nowrap;
}

.no-records {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
  font-style: italic;
}

/* Success state */
.success-card {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}

.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-xl);
  background: linear-gradient(180deg, var(--color-success) 0%, #4a7a3d 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: white;
  box-shadow: 0 4px 20px rgba(107, 154, 93, 0.4);
}

.success-card h2 {
  font-size: 2rem;
  color: var(--color-accent);
  margin-bottom: var(--space-md);
}

.success-message {
  font-size: 1.1rem;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.success-submessage {
  font-style: italic;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

/* Hebrew date preview */
.hebrew-date-preview {
  background: var(--color-accent-glow);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  text-align: center;
}

.hebrew-date-preview .label {
  color: var(--color-text-muted);
  margin-right: var(--space-sm);
}

.hebrew-date-preview .value {
  color: var(--color-accent);
  font-weight: 500;
  font-size: 1.1rem;
}

.existing-hebrew-date {
  text-align: center;
  background: var(--color-accent-glow);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  color: var(--color-accent);
  font-weight: 500;
}

.success-hebrew-date {
  color: var(--color-accent);
  font-weight: 500;
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

/* Footer */
.footer {
  text-align: center;
  padding: var(--space-3xl) var(--space-md) var(--space-xl);
  color: var(--color-text-hint);
  font-size: 0.85rem;
}

.footer .hebrew {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  letter-spacing: 0.1em;
}

.footer .org-info {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.footer .org-name {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--color-accent);
  font-weight: 500;
  margin-bottom: var(--space-xs);
}

.footer .org-address {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer .admin-link {
  margin-top: var(--space-lg);
}

.footer .admin-link a {
  color: var(--color-text-hint);
  text-decoration: none;
  font-size: 0.8rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.footer .admin-link a:hover {
  opacity: 1;
  color: var(--color-accent);
}

/* Loading state */
.btn.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.btn-primary.loading::after {
  border-top-color: var(--color-bg);
}

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

/* Responsive */
@media (max-width: 600px) {
  .container {
    padding: var(--space-lg) var(--space-sm);
  }
  
  .card {
    padding: var(--space-lg);
  }
  
  .title {
    font-size: 2.5rem;
  }
  
  .actions {
    flex-direction: column-reverse;
  }
  
  .actions .btn {
    width: 100%;
  }
}

