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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8fafc;
  color: #334155;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  background-color: white;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 30px;
}

.header-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
  min-width: 250px;
}

.header-text {
  flex: 1;
  min-width: 0;
}

.header-text h1 {
  color: #1e293b;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
}

.header-text p {
  color: #64748b;
  font-size: 14px;
  line-height: 1.3;
}

.section-buttons {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.section-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  color: #64748b;
  font-size: 14px;
}

.section-btn.active {
  background: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

.section-btn.completed {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.section-btn:hover:not(.active) {
  background: #f1f5f9;
}

/* Form Container */
.form-wrapper {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
}

.form-section {
  display: none;
  animation: fadeIn 0.5s ease-out;
}

.form-section.active {
  display: block;
}

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

.section-title {
  color: #1e293b;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f1f5f9;
  position: relative;
}

.section-title::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 60px;
  height: 2px;
  background: #3b82f6;
}

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.grid.full {
  grid-template-columns: 1fr;
}

.grid.two {
  grid-template-columns: repeat(2, 1fr);
}

/* Form Group */
.form-group {
  position: relative;
}

.form-group label {
  display: block;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  text-transform: capitalize;
}

.form-group label::after {
  content: ' *';
  color: #dc2626;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  font-size: 16px;
  transition: all 0.3s ease;
  font-family: inherit;
  -webkit-appearance: none;
}

.form-group input::placeholder,
.form-group select::placeholder,
.form-group textarea::placeholder {
  color: #94a3b8;
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
  border-color: #94a3b8;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group select {
  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='%233b82f6' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 48px;
}

/* Form validation styles */
.form-group input:invalid,
.form-group select:invalid,
.form-group textarea:invalid {
  border-color: #fecaca;
}

.form-group input:valid,
.form-group select:valid,
.form-group textarea:valid {
  border-color: #bbf7d0;
}

/* Sub Section */
.sub-section {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #e2e8f0;
}

.sub-title {
  color: #1e293b;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sub-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 20px;
  background: #3b82f6;
  border-radius: 2px;
}

/* Navigation */
.form-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 30px;
  border-top: 1px solid #e2e8f0;
}

.nav-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

button {
  padding: 14px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  min-height: 48px;
}

.btn-prev {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #cbd5e1;
  order: 1;
  max-width: 120px;
}

.btn-prev:hover:not(:disabled) {
  background: #f1f5f9;
  color: #475569;
}

.btn-prev:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-next {
  background: #3b82f6;
  color: white;
  order: 3;
  max-width: 120px;
}

.btn-next:hover {
  background: #2563eb;
}

.btn-submit {
  background: #10b981;
  color: white;
  order: 3;
  max-width: 120px;
}

.btn-submit:hover {
  background: #059669;
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-submit:disabled:hover {
  transform: none;
  box-shadow: none;
}

/* Progress Bar */
.progress-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  order: 2;
  flex: 1;
  max-width: 200px;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.3s ease;
}

.progress-dot.active {
  background: #3b82f6;
  width: 24px;
  border-radius: 4px;
}

.progress-dot.completed {
  background: #10b981;
}

/* Success Screen */
.success-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.5s ease-out;
  padding: 20px;
}

.success-screen.show {
  display: flex;
}

.success-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 40px 30px;
  text-align: center;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.success-icon {
  width: 70px;
  height: 70px;
  background: #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 25px;
  font-size: 32px;
  color: white;
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.success-card h2 {
  color: #1e293b;
  font-size: 24px;
  margin-bottom: 12px;
  line-height: 1.3;
}

.success-card p {
  color: #64748b;
  font-size: 16px;
  line-height: 1.4;
}

/* Success details */
.success-details {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 12px;
  margin-top: 15px;
  font-size: 14px;
}

.success-details strong {
  color: #059669;
  display: block;
  margin-bottom: 5px;
}

/* Sibling Sections */
.sibling-section {
  margin: 30px 0;
}

.sibling-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #e2e8f0;
}

.sibling-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: center;
}

.btn-add-sibling {
  padding: 14px 20px;
  background: #f8fafc;
  border: 2px dashed #cbd5e1;
  color: #475569;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 280px;
  justify-content: center;
  min-height: 48px;
}

.btn-add-sibling:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #334155;
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 18px;
  font-weight: bold;
}

/* Sibling Cards */
.sibling-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  transition: all 0.3s ease;
  animation: slideIn 0.3s ease-out;
}

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

.sibling-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sibling-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
  gap: 10px;
}

.sibling-number {
  font-size: 14px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-remove-sibling {
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
}

.btn-remove-sibling:hover {
  background: #fecaca;
  border-color: #f87171;
  transform: scale(1.05);
}

/* Show remove button when there are multiple siblings */
.sibling-card:not(:only-child) .btn-remove-sibling {
  display: flex !important;
}

.sibling-card .grid {
  margin-bottom: 0;
}

/* Firebase Status Indicator */
.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  animation: pulse 2s infinite;
}

.status-indicator.connected .status-dot {
  background: #10b981;
  animation: none;
}

.status-indicator.error .status-dot {
  background: #dc2626;
  animation: none;
}

.status-text {
  color: #64748b;
}

.status-indicator.connected .status-text {
  color: #059669;
}

.status-indicator.error .status-text {
  color: #dc2626;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Error Message */
.error-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.4;
}

.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== MOBILE RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }

  .header-content {
    padding: 15px;
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .header-left {
    flex-direction: column;
    text-align: center;
    gap: 12px;
    width: 100%;
  }

  .header-text h1 {
    font-size: 20px;
  }

  .header-text p {
    font-size: 13px;
  }

  .section-buttons {
    justify-content: center;
    width: 100%;
  }

  .section-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .form-wrapper {
    padding: 25px 20px;
    border-radius: 10px;
  }

  .section-title {
    font-size: 18px;
    margin-bottom: 25px;
    padding-bottom: 12px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 25px;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 16px;
    font-size: 16px;
  }

  .sub-section {
    margin-top: 30px;
    padding-top: 25px;
  }

  .form-nav {
    margin-top: 30px;
    padding-top: 25px;
  }

  .nav-buttons {
    flex-direction: column;
    gap: 15px;
  }

  button {
    padding: 16px 20px;
    font-size: 16px;
    width: 100%;
    min-height: 52px;
    max-width: none;
  }

  .btn-prev,
  .btn-next,
  .btn-submit {
    max-width: none;
    order: unset;
  }

  .progress-bar {
    order: unset;
    max-width: none;
    margin-top: 10px;
  }

  .sibling-card {
    padding: 16px;
  }

  .sibling-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .btn-remove-sibling {
    align-self: flex-end;
    min-width: 40px;
    min-height: 40px;
  }

  .btn-add-sibling {
    max-width: 100%;
    padding: 16px 20px;
    min-height: 52px;
  }

  .success-card {
    padding: 30px 20px;
    margin: 20px;
  }

  .success-icon {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .success-card h2 {
    font-size: 22px;
  }

  .success-card p {
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .header-content {
    padding: 12px;
  }

  .header-text h1 {
    font-size: 18px;
  }

  .form-wrapper {
    padding: 20px 15px;
  }

  .section-title {
    font-size: 17px;
  }

  .grid {
    gap: 12px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px;
  }

  button {
    padding: 14px 16px;
    font-size: 15px;
  }

  .sibling-card {
    padding: 14px;
  }

  .btn-add-sibling {
    padding: 14px 16px;
    font-size: 15px;
  }

  .success-card {
    padding: 25px 15px;
  }

  .success-icon {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }

  .success-card h2 {
    font-size: 20px;
  }
}

/* Extra small devices */
@media (max-width: 360px) {
  .header-text h1 {
    font-size: 16px;
  }

  .header-text p {
    font-size: 12px;
  }

  .section-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .form-wrapper {
    padding: 15px 12px;
  }

  .section-title {
    font-size: 16px;
  }

  button {
    padding: 12px 14px;
    font-size: 14px;
  }
}

/* Landscape orientation for mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .container {
    padding: 10px;
  }

  .form-wrapper {
    padding: 20px;
  }

  .grid {
    gap: 12px;
    margin-bottom: 20px;
  }

  .form-nav {
    margin-top: 20px;
    padding-top: 20px;
  }

  button {
    padding: 12px 16px;
    min-height: 44px;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}