:root {
  --bg-light: #f8fafc;
  --text-light: #1e293b;
  --primary: #3b82f6;
  --primary-light: #dbeafe;
  --success: #10b981;
  --danger: #fee2e2;
  --card-bg-light: #ffffff;
  --border-light: #e2e8f0;
  --radius: 16px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(135deg, var(--bg-light) 0%, #e2e8f0 100%);
  color: var(--text-light);
  transition: all 0.3s;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.header {
  text-align: center;
  margin-bottom: 3rem;
  position: relative;
}

.header h1 {
  font-size: 3rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.header p {
  font-size: 1.125rem;
  color: #64748b;
  margin-top: 0.5rem;
}

.card {
  background: var(--card-bg-light);
  padding: 1.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
  border: 1px solid var(--border-light);
  transition: 0.3s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.summary-card {
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: white;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.stat-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-value {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.8;
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: end;
}

input,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  font-size: 1rem;
  background: var(--card-bg-light);
  color: var(--text-light);
}

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

.btn {
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: 0.3s;
}

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

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.split-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.split-option {
  padding: 1rem 1.5rem;
  text-align: center;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  cursor: pointer;
  background: var(--card-bg-light);
  user-select: none;
}

.split-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.custom-splits {
  background: var(--primary-light);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--primary);
}

.custom-split-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.custom-split-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.custom-split-controls input {
  width: 100px;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  font-size: 0.875rem;
  color: var(--text-light);
}

#participantsList div {
  padding: 1rem;
  margin: 0.5rem 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--primary-light);
  font-weight: 600;
  color: var(--primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.expense-item {
  padding: 1.5rem;
  margin: 1rem 0;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--card-bg-light);
}

.expense-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.expense-title {
  font-weight: 700;
  font-size: 1.125rem;
}

.expense-amount {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--success);
}

.expense-details {
  font-size: 0.875rem;
  color: #64748b;
}

.balance-item {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  margin: 0.5rem 0;
  border-radius: 12px;
  font-weight: 600;
}

.balance-positive {
  background: #d1fae5;
  color: var(--success);
  border: 1px solid var(--success);
}

.balance-negative {
  background: #fee2e2;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.settlement-item {
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  margin: 0.5rem 0;
  background: #fef3c7;
  color: #f59e0b;
  border: 1px solid #f59e0b;
  border-radius: 12px;
  font-weight: 600;
}

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.whatsapp-share {
  background: #25d366;
  color: white;
}

.whatsapp-share:hover {
  background: #128c7e;
}

/* Collapsible button styles */
.collapsible {
  cursor: pointer;
  padding: 0.75rem 1rem;
  background: var(--primary-light);
  border-radius: 12px;
  border: none;
  width: 100%;
  text-align: left;
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  user-select: none;
  transition: background 0.3s ease;
}

.collapsible:hover {
  background: #bfdbfe;
}

.collapsible.active {
  background: var(--primary);
  color: white;
}

/* Collapsible content container */
.content {
  display: none;
  max-height: 300px; /* fixed height with scrollbar */
  overflow-y: auto;
  margin-bottom: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--card-bg-light);
  padding: 1rem 1.5rem;
  box-shadow: var(--shadow);
}

.content.active {
  display: block;
}

/* Responsive tweaks */
@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .form-row {
    flex-direction: column;
  }

  .split-options {
    grid-template-columns: 1fr;
  }

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