body {
  font-family: Arial, sans-serif;
  margin: 20px;
  max-width: 100%;
  overflow-x: hidden;
}

.container {
  max-width: 700px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  color: #2c5530;
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
}

#numberofdays {
  font-family: 'Albert Sans', sans-serif;
  text-align: center;
  font-style: italic;
  background-color: #f4f7fa;
  border-radius: 8px;
  padding: 20px;
  margin: 30px auto;
  max-width: 600px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.days-selector {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  text-align: center;
}

.routine-selection {
  margin: 30px 0;
}

.routines-container {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.routine {
  border: 2px solid #e9ecef;
  border-radius: 12px;
  padding: 5px;
  transition: all 0.3s ease;
  background: white;
  position: relative;
  overflow: hidden;
}

.routine:hover {
  border-color: #3e6a83;
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.routine.selected {
  border-color: #2c5530;
  background: #f8fff9;
  animation: pulse 2s infinite;
}

.routine-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.routine-header label {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
  padding: 0px !important;
}

.custom-radio {
  width: 20px;
  height: 20px;
  border: 2px solid #ccc;
  border-radius: 50%;
  margin-right: 10px;
  position: relative;
  transition: all 0.3s ease;
}

input[type="radio"]:checked + .custom-radio {
  border-color: #2c5530;
  background: #2c5530;
}

input[type="radio"]:checked + .custom-radio::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
}

/* DESKTOP GRID LAYOUT */
.rect-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  padding: 20px;
  background-color: #3e6a83;
  border-radius: 10px;
  margin-top: 10px;
}

/* Manual positioning for rectangular flow */
.step1 { grid-column: 1; grid-row: 1; }
.arrow1 { grid-column: 2; grid-row: 1; }
.step2 { grid-column: 3; grid-row: 1; }
.arrow2 { grid-column: 4; grid-row: 1; }
.step3 { grid-column: 5; grid-row: 1; }
.arrow3 { grid-column: 5; grid-row: 2; }
.step4 { grid-column: 5; grid-row: 3; }
.arrow4 { grid-column: 4; grid-row: 3; }
.step5 { grid-column: 3; grid-row: 3; }
.arrow5 { grid-column: 2; grid-row: 3; }
.step6 { grid-column: 1; grid-row: 3; }
.arrow6 { grid-column: 1; grid-row: 2; }

.step {
  background: #fff;
  padding: 8px 10px;
  text-align: center;
  border-radius: 6px;
  border: 1px solid #ccc;
  color: #333;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: all 0.3s ease;
}

.routine:hover .step {
  transform: scale(1.05);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.step i {
  margin-right: 5px;
  color: #444;
}

.arrow {
  background: transparent;
  padding: 0;
  border: none;
  color: black;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* MOBILE STACKED FLOW */
.mobile-flow {
  display: none;
}

@media (max-width: 768px) {
  .routine {
    flex-direction: column;
    align-items: flex-start;
  }

  .rect-grid {
    display: none;
  }

  .mobile-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    background-color: #3e6a83;
    border-radius: 10px;
    margin-top: 10px;
  }

  .mobile-flow .step {
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 14px;
    color: #333;
    width: 90%;
    text-align: center;
  }

  .mobile-flow .arrow {
    background: transparent;
    padding: 0;
    border: none;
    font-size: 18px;
    color: black;
    width: auto;
    text-align: center;
  }
  
  header h1 {
    font-size: 2rem;
  }
}

.routine-details {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease;
}

.routine-details.active {
  max-height: 200px;
  margin-top: 15px;
}

.routine-stats {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: #6c757d;
}

.routine-stats i {
  margin-right: 5px;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 30px;
}

.btn-primary, .btn-secondary {
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #2c5530;
  color: white;
  border: 2px solid #2c5530;
}

.btn-primary:hover {
  background: #1e3a23;
  transform: translateY(-2px);
}

.btn-secondary {
  background: white;
  color: #6c757d;
  border: 2px solid #dee2e6;
}

.btn-secondary:hover {
  background: #f8f9fa;
  border-color: #6c757d;
}

.completion-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 15px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  animation: modalAppear 0.5s ease;
}

@keyframes modalAppear {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

.progress-container {
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: #e9ecef;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: #2c5530;
  width: 3%;
  border-radius: 5px;
  transition: width 1s ease;
}

/* Pulse animation for selected routine */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* Toast message styles */
.toast-message {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  z-index: 1001;
  transition: transform 0.3s ease;
}

.toast-message.show {
  transform: translateX(-50%) translateY(0);
}

/* Shake animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

/* Info update animation */
@keyframes infoUpdate {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.info-updated {
  animation: infoUpdate 0.5s ease;
}

.days-changed {
  box-shadow: 0 0 0 3px rgba(62, 106, 131, 0.3);
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
  .actions {
    flex-direction: column;
  }
  
  .routine-stats {
    flex-direction: column;
    gap: 5px;
  }
  
  .container {
    padding: 10px;
  }
  
  header h1 {
    font-size: 1.8rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
}