* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #f5f5f5;
  color: #333;
}

.overlay {
  position: fixed;
  top: 20px;
  left: 20px;
  width: 30%;
  max-width: 400px;
  min-width: 280px;
  height: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.container {
  max-width: 768px;
  min-width: 280px;
  background-color: #e8e8e8;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  position: relative;
  transition:
    height 2s ease-in-out,
    border-radius 2s ease-in-out !important;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.container.collapsed {
  height: 73px !important;
  min-height: 73px !important;
  overflow: hidden;
}

.container.collapsed > *:not(.header) {
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s;
}

.container:not(.collapsed) > *:not(.header) {
  opacity: 1;
  transition: opacity 2s;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background-color: #e8e8e8;
  border-bottom: 1px solid #d0d0d0;
  cursor: move;
}

.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: #666;
  transition: background-color 0.2s;
}

.menu-btn:hover {
  background-color: #d0d0d0;
}

.search-container {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: #999;
  z-index: 1;
  display: none;
}

.search-input {
  width: 100%;
  padding: 12px 40px 12px 15px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: white;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-btn-submit {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.search-btn-submit:hover {
  color: #007bff;
}

.search-input:focus {
  border-color: #007bff;
}

.search-input::placeholder {
  color: #999;
}

.profile-btn {
  background-color: #6c7b8a;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.profile-btn:hover {
  background-color: #5a6875;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background-color: #9ca3af;
  padding: 0;
  flex-wrap: wrap;
}

.nav-tab {
  flex: 1;
  padding: 12px 16px;
  background: none;
  border: none;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.nav-tab:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.nav-tab.active {
  background-color: rgba(255, 255, 255, 0.2);
}

.nav-tab:first-child {
  flex: 0 0 auto;
  padding: 12px;
}

/* Modal */
.modal {
  background-color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.modal-header {
  margin-bottom: 24px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.modal-controls {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.control-btn {
  padding: 8px 16px;
  border: 1px solid #ccc;
  background-color: white;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.control-btn:hover {
  background-color: #f8f9fa;
}

.control-btn.active {
  background-color: #e9ecef;
  border-color: #adb5bd;
}

.days-list {
  height: auto;
  max-height: 237px;
  overflow-y: auto;
  background-color: #9ca3af;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 24px;
}

.day-item {
  color: white;
  padding: 12px 0;
  font-size: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.day-item:last-child {
  border-bottom: none;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-start;
}

.action-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

.action-btn.secondary {
  background-color: #e9ecef;
  color: #495057;
}

.action-btn.secondary:hover {
  background-color: #dee2e6;
}

.action-btn.primary {
  background-color: #6c757d;
  color: white;
}

.action-btn.primary:hover {
  background-color: #5a6268;
}

.resizer {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: se-resize;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
  .overlay {
    left: 0;
    right: 0;
    width: 100%;
    padding: 10px;
    top: 0;
    position: fixed;
    justify-content: center;
  }
  .container {
    margin: 0 auto;
    max-width: 95%;
  }
  .header {
    padding: 12px 16px;
    gap: 12px;
  }
  .search-input {
    font-size: 16px;
  }
  .nav-tab {
    font-size: 13px;
    padding: 10px 12px;
  }
  .modal {
    padding: 20px;
  }
  .modal-actions {
    flex-direction: column;
  }
  .action-btn {
    width: 100%;
  }
  .day-date-input {
    width: 100px;
  }
}

@media (max-width: 480px) {
  .overlay {
    padding: 8px;
  }
  .header {
    padding: 10px 12px;
    gap: 8px;
  }
  .profile-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .search-input {
    padding: 8px 35px 8px 10px;
    font-size: 14px;
  }
  .nav-tab {
    font-size: 12px;
    padding: 8px 10px;
  }
  .modal-title {
    font-size: 16px;
  }
  .control-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  .day-item {
    font-size: 12px;
  }
  .record-item {
    font-size: 12px;
    flex-wrap: wrap;
  }
  .record-item input[type="text"],
  .record-item select {
    min-width: auto;
    width: 100%;
  }
  .day-date-input {
    width: 90px;
    font-size: 12px;
  }
}

/* Для мобильных устройств (ширина < 480px) */
@media (max-width: 480px) {
  .photo-grid {
    grid-template-columns: 1fr !important; /* один столбец */
  }
}

.day-parent {
  font-weight: 600;
}

.record-item {
  margin-left: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
  flex-wrap: wrap;
}

.record-marker {
  width: 16px;
  height: 16px;
  border: 1px solid #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-list {
  padding-left: 20px;
}

.day-item.active {
  background-color: #f0f0f03b;
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  flex-wrap: wrap;
  gap: 8px;
}

.day-date-input {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 14px;
  color: #555;
  background: #fff;
  width: 130px;
}
