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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #1a1a2e;
  color: #eee;
  min-height: 100vh;
  padding: 20px;
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 30px;
}

header h1 {
  font-size: 2.5rem;
  color: #fff;
  margin-bottom: 8px;
}

.subtitle {
  color: #888;
  font-size: 1.1rem;
}

/* Controls */
.controls {
  background: #16213e;
  padding: 20px;
  border-radius: 12px;
  margin-bottom: 30px;
}

.settings-row {
  display: flex;
  gap: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setting label {
  font-size: 0.9rem;
  color: #aaa;
}

.setting input {
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f23;
  color: #fff;
  font-size: 1rem;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
}

.export-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 5px;
  background: #0f0f23;
  border: 1px solid #333;
  border-radius: 6px;
  overflow: hidden;
  z-index: 100;
  min-width: 150px;
}

.export-menu.active {
  display: block;
}

.export-option {
  display: block;
  width: 100%;
  padding: 10px 15px;
  background: none;
  border: none;
  color: #ddd;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.export-option:hover {
  background: #374151;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn.primary {
  background: #4f46e5;
  color: white;
}

.btn.primary:hover {
  background: #4338ca;
}

.btn.secondary {
  background: #374151;
  color: white;
}

.btn.secondary:hover {
  background: #4b5563;
}

.btn.danger {
  background: #dc2626;
  color: white;
}

.btn.danger:hover {
  background: #b91c1c;
}

/* Main Content */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* Canvas Wrapper */
.canvas-wrapper {
  background: #16213e;
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
  text-align: center;
}

#lifeCalendarCanvas {
  display: inline-block;
  cursor: crosshair;
}

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

.modal.active {
  display: flex;
}

.modal-content {
  background: #16213e;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  color: #fff;
}

.close-btn {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
}

.close-btn:hover {
  color: #fff;
}

.modal-description {
  color: #aaa;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: #aaa;
  font-size: 0.9rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #0f0f23;
  color: #fff;
  font-size: 1rem;
}

.form-group input[type="color"] {
  height: 45px;
  cursor: pointer;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 25px;
}

/* Typical Events List */
.typical-events-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.typical-event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #0f0f23;
  border-radius: 8px;
}

.typical-event-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.typical-event-info {
  flex: 1;
}

.typical-event-name {
  font-weight: 500;
  color: #fff;
}

.typical-event-age {
  font-size: 0.85rem;
  color: #888;
}

.typical-event-color {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}

.typical-event-item .edit-btn {
  padding: 4px 10px;
  font-size: 0.8rem;
  background: #374151;
  border: none;
  border-radius: 4px;
  color: #ddd;
  cursor: pointer;
}

.typical-event-item .edit-btn:hover {
  background: #4b5563;
}

/* Form row for side-by-side inputs */
.form-row {
  display: flex;
  gap: 15px;
}

.form-row .form-group {
  flex: 1;
}

/* Modal wide variant */
.modal-content.modal-wide {
  max-width: 650px;
}

/* Life Phases List */
.life-phases-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.life-phase-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #0f0f23;
  border-radius: 8px;
}

.life-phase-item input[type="text"] {
  width: 120px;
  padding: 6px 10px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #fff;
  font-size: 0.9rem;
}

.life-phase-item input[type="number"] {
  width: 60px;
  padding: 6px 8px;
  border: 1px solid #333;
  border-radius: 4px;
  background: #16213e;
  color: #fff;
  font-size: 0.9rem;
  text-align: center;
}

.life-phase-item input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
}

.life-phase-item label {
  color: #888;
  font-size: 0.85rem;
}

.life-phase-item .delete-phase-btn {
  padding: 4px 8px;
  background: #dc2626;
  border: none;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-size: 0.8rem;
}

.life-phase-item .delete-phase-btn:hover {
  background: #b91c1c;
}

.life-phase-ages {
  display: flex;
  align-items: center;
  gap: 6px;
}

.life-phase-ages span {
  color: #888;
}

/* Tooltip */
.tooltip {
  position: fixed;
  background: #0f0f23;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  pointer-events: none;
  z-index: 1000;
  max-width: 250px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  border: 1px solid #333;
}

.tooltip-title {
  font-weight: bold;
  margin-bottom: 4px;
}

.tooltip-date {
  color: #888;
  font-size: 0.8rem;
}

.tooltip-description {
  margin-top: 6px;
  color: #aaa;
}

/* Responsive */
@media (max-width: 900px) {
  .canvas-wrapper {
    min-width: auto;
    overflow-x: scroll;
  }
}
