:root {
  --primary-color: #ff6b81;
  --secondary-color: #67c23a;
  --tertiary-color: #409eff;
  --background-color: #ffffff;
  --text-color: #333333;
  --light-gray: #f5f5f5;
  --medium-gray: #e0e0e0;
  --dark-gray: #909399;
  --shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  --dark-background: #1a1a1a;
  --light-text: #f5f5f5;
  --border-color: #ccc;
  --input-background: #f9f9f9;
  --primary-color-dark: #e05a70;
}

/* Dark mode variables */
.dark-mode {
  --primary-color: #ff8c9e;
  --secondary-color: #95d475;
  --tertiary-color: #79bbff;
  --background-color: #1a1a1a;
  --text-color: #f5f5f5;
  --light-gray: #2c2c2c;
  --medium-gray: #3d3d3d;
  --dark-gray: #909399;
  --shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.5rem;
  font-weight: bold;
}

.logo img {
  height: 2rem;
}

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

.icon-button {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.icon-button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

main {
  flex: 1;
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background-color: var(--background-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

h1, h2, h3 {
  margin-bottom: 1rem;
  color: var(--primary-color);
}

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

.cycle-item {
  background-color: var(--light-gray);
  padding: 1rem;
  border-radius: 8px;
  text-align: center;
}

.cycle-item h3 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.cycle-item p {
  font-size: 1.2rem;
  font-weight: bold;
}

.calendar {
  margin-bottom: 1.5rem;
}

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

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  font-weight: bold;
  position: relative;
}

.calendar-day.period {
  background-color: var(--primary-color);
  color: white;
}

.calendar-day.fertile {
  background-color: var(--secondary-color);
  color: white;
}

.calendar-day.ovulation {
  background-color: var(--tertiary-color);
  color: white;
}

.calendar-day.today {
  border: 2px solid var(--primary-color);
}

.calendar-day.other-month {
  opacity: 0.3;
}

.weekday {
  text-align: center;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.button:hover {
  background-color: #e05a70;
}

.button.secondary {
  background-color: var(--dark-gray);
}

.button.secondary:hover {
  background-color: #7d7d7d;
}

.button.full-width {
  width: 100%;
}

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

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--medium-gray);
  border-radius: 4px;
  background-color: var(--light-gray);
  color: var(--text-color);
}

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

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--dark-gray);
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--medium-gray);
}

.settings-item:last-child {
  border-bottom: none;
}

.number-input {
  display: flex;
  align-items: center;
}

.number-input input {
  width: 60px;
  text-align: center;
  border: 1px solid var(--medium-gray);
  border-radius: 4px;
  padding: 0.5rem;
  margin: 0 0.5rem;
  background-color: var(--background-color);
  color: var(--text-color);
}

.number-input button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--medium-gray);
  border-radius: 50%;
  background-color: var(--light-gray);
  color: var(--text-color);
  font-size: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.number-input button:hover {
  background-color: var(--medium-gray);
}

.settings-help {
  font-size: 0.85rem;
  color: var(--dark-gray);
  margin-top: -0.5rem;
  padding: 0 1rem 1rem 1rem;
  font-style: italic;
}

footer {
  text-align: center;
  padding: 1rem;
  background-color: var(--light-gray);
  margin-top: auto;
}

.footer-links {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: var(--dark-gray);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--primary-color);
  text-decoration: underline;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal[style*="display: block"] {
  display: flex !important;
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--background-color);
  color: var(--text-color);
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.5rem;
}

.modal-content p {
  margin-bottom: 20px;
  line-height: 1.5;
}

.close-modal {
  color: var(--text-color);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.donation-amount {
  margin: 20px 0;
}

.donation-amount label {
  display: block;
  margin-bottom: 10px;
  font-weight: bold;
}

.donation-amount input {
  width: 100%;
  padding: 12px;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background-color: var(--input-background);
  color: var(--text-color);
  font-size: 1rem;
  margin-bottom: 15px;
}

#send-donation {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 25px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  display: block;
  width: 100%;
  max-width: 200px;
  margin-left: auto;
  transition: background-color 0.3s;
}

#send-donation:hover {
  background-color: var(--primary-color-dark);
}

.heart-icon {
  margin-right: 8px;
}

.donation-message {
  margin-top: 15px;
  padding: 10px;
  border-radius: 5px;
  text-align: center;
}

.donation-message.success {
  background-color: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
}

.donation-message.error {
  background-color: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.day-details {
  padding: 1rem;
  background-color: var(--light-gray);
  border-radius: 8px;
  margin-top: 1rem;
}

.day-details h3 {
  margin-bottom: 0.5rem;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 1rem;
}

.status-badge.period {
  background-color: var(--primary-color);
  color: white;
}

.status-badge.fertile {
  background-color: var(--secondary-color);
  color: white;
}

.status-badge.normal {
  background-color: var(--dark-gray);
  color: white;
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 0.75rem;
  background-color: var(--light-gray);
  border-radius: 8px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-block;
}

.legend-color.period {
  background-color: var(--primary-color);
}

.legend-color.fertile {
  background-color: var(--secondary-color);
}

.legend-color.ovulation {
  background-color: var(--tertiary-color);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .cycle-summary {
    grid-template-columns: 1fr 1fr;
  }
  
  .calendar-day {
    font-size: 0.8rem;
  }
}

/* Password protection */
.password-protection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.password-form {
  width: 90%;
  max-width: 300px;
  text-align: center;
}

.password-form img {
  width: 80px;
  margin-bottom: 1.5rem;
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 107, 129, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto;
}

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

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 1.5rem;
  padding: 2rem 0;
}

.status-badge {
  display: inline-block;
  padding: 0.5rem 1.5rem;
  border-radius: 50px;
  font-weight: bold;
  font-size: 1.2rem;
  color: white;
  margin: 0 auto;
  box-shadow: var(--shadow);
}

.status-badge.period {
  background-color: var(--primary-color);
}

.status-badge.fertile {
  background-color: var(--secondary-color);
}

.status-badge.ovulation {
  background-color: var(--tertiary-color);
}

.status-badge.normal {
  background-color: var(--dark-gray);
}

/* Summary Card */
.summary-card {
  margin-bottom: 2rem;
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.3s ease;
}

.summary-card:hover {
  transform: translateY(-5px);
}

.summary-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  font-size: 1.5rem;
}

/* Modal styles pour les dons en PI */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: var(--background-color);
  margin: 15% auto;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 90%;
  max-width: 500px;
  position: relative;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  color: var(--dark-gray);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
}

.close-modal:hover {
  color: var(--text-color);
}

.pi-address, .donation-amount {
  margin: 1.5rem 0;
}

.pi-address label, .donation-amount label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.pi-address input, .donation-amount input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--medium-gray);
  border-radius: 4px;
  background-color: var(--light-gray);
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.donation-message {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  text-align: center;
}

.donation-message.success {
  background-color: var(--secondary-color);
  color: white;
}

.donation-message.error {
  background-color: var(--primary-color);
  color: white;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.primary-button {
  background-color: var(--primary-color);
  flex: 2;
  border-radius: 50px;
  padding: 1rem;
  font-size: 1.1rem;
  transition: all 0.3s ease;
}

.primary-button:hover {
  background-color: #e05a70;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 107, 129, 0.3);
}

.secondary-button {
  background-color: var(--light-gray);
  color: var(--text-color);
  flex: 1;
  border-radius: 50px;
  padding: 1rem;
  font-size: 1.1rem;
  border: 1px solid var(--medium-gray);
  transition: all 0.3s ease;
}

.secondary-button:hover {
  background-color: var(--medium-gray);
  transform: translateY(-2px);
}

/* Cycle Summary Items */
.cycle-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.cycle-item {
  background-color: var(--light-gray);
  padding: 1.5rem;
  border-radius: 10px;
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cycle-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.cycle-item h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--dark-gray);
}

.cycle-item p {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--text-color);
}

/* Terms of Use Page */
.last-updated {
  font-style: italic;
  color: var(--dark-gray);
  margin-bottom: 2rem;
}

.terms-section {
  margin-bottom: 2rem;
}

.terms-section h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.terms-section p {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.terms-section ul {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.terms-section ul li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.terms-section a {
  color: var(--primary-color);
  text-decoration: none;
}

.terms-section a:hover {
  text-decoration: underline;
}
