/* リセット＆共通設定 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #F5F1E9;
  color: #333;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  padding: 20px;
}

/* ヘッダー */
hgroup {
  text-align: center;
  margin-bottom: 2em;
}
h1 {
  font-weight: 300;
  color: #48b5e3;
}
h2 {
  font-weight: 300;
  color: #494949;
  background: transparent;
  border-left: 5px solid #48b5e3;
  font-size: 1.1em;
  padding: 0 8px;
  margin-bottom: 0.5em;
}
h3 {
  font-weight: 300;
  color: #676767;
  font-size: 1em;
  margin-top: 0.5em;
}

/* 入力グループ（マテリアル風） */
.group { 
  position: relative; 
  margin-bottom: 45px; 
}
.group input {
  font-size: 18px;
  display: block;
  width: 100%;
  padding: 10px 5px;
  background: transparent;
  color: #636363;
  border: none;
  border-bottom: 1px solid #ccc;
  transition: border-color 0.2s ease;
}
.group input:focus {
  outline: none;
  border-bottom: 2px solid #48b5e3;
}
.group label {
  position: absolute;
  top: 12px;
  left: 5px;
  font-size: 18px;
  color: #999;
  pointer-events: none;
  transition: all 0.2s ease;
}
.group input:focus ~ label,
.group input.used ~ label {
  top: -12px;
  font-size: 14px;
  color: #48b5e3;
  left: 0;
}
/* 装飾用エレメント */
.bar {
  position: relative;
  display: block;
  width: 100%;
}
.bar:before, .bar:after {
  content: '';
  height: 2px;
  width: 0;
  position: absolute;
  bottom: 1px;
  background: #48b5e3;
  transition: width 0.2s ease;
}
.bar:before { left: 50%; }
.bar:after { right: 50%; }
.group input:focus ~ .bar:before,
.group input:focus ~ .bar:after {
  width: 50%;
}
.highlight {
  position: absolute;
  height: 60%;
  width: 100px;
  top: 25%;
  left: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* ボタン共通 */
.button {
  position: relative;
  display: inline-block;
  letter-spacing: 1px;
  background: #48b5e3;
}
.button:hover {
  background: #6ABADF;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.button:focus {
  outline: none;
}

/* ボタングループ */
.button-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-group button {
  flex: 1;
  min-width: 120px;
}

/* ゴーストボタン */
.buttonGhost {
  background: transparent;
  border: 1px solid #48b5e3;
  color: #48b5e3;
}

.buttonGhost:hover {
  background: rgba(72, 181, 227, 0.1);
}

/* SweetAlert2 用のボタン */
.swal2-popup .button {
  display: block;
  width: 100%;
  margin: 0.5em 0;
  background: #48b5e3;
  color: #fff;
  border: none;
  border-radius: 4px;
}

/* 日記エディタ専用スタイル */
.diary-editor {
  text-align: left;
}

.datetime-display {
  background-color: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 1em;
  text-align: center;
  color: #48b5e3;
  font-weight: 500;
  font-size: 1.1em;
  border-left: 3px solid #48b5e3;
}

.textarea-wrapper {
  position: relative;
  margin-bottom: 1.2em;
}

#diaryPayload {
  width: 100%;
  min-height: 220px;
  padding: 15px;
  font-size: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background-color: white;
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  color: #444;
  line-height: 1.6;
}

#diaryPayload:focus {
  outline: none;
  border-color: #48b5e3;
  box-shadow: 0 0 0 2px rgba(72, 181, 227, 0.2);
}

.counter {
  text-align: right;
  font-size: 0.9em;
  color: #888;
  margin-top: 6px;
}

/* 日記検索専用スタイル */
.diary-search {
  text-align: left;
}

.search-field {
  margin-bottom: 1.2em;
}

.search-field label {
  display: block;
  margin-bottom: 6px;
  color: #555;
  font-weight: 500;
}

.search-field i {
  color: #48b5e3;
  margin-right: 6px;
}

/* 検索結果の表示スタイル */
.search-results {
  text-align: left;
  margin-top: 1em;
}

.search-info {
  background-color: #f8f9fa;
  padding: 1em;
  border-radius: 8px;
  margin-bottom: 1.2em;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.search-criteria {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.criteria-item {
  display: flex;
  align-items: center;
  background-color: white;
  padding: 8px 12px;
  border-radius: 4px;
  border-left: 3px solid #48b5e3;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.criteria-item i {
  color: #48b5e3;
  margin-right: 8px;
}

.diary-list {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 10px;
  margin-bottom: 1.5em;
}

.diary-entry {
  background-color: white;
  margin-bottom: 1.5em;
  padding: 1.2em;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.diary-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.diary-date {
  font-weight: 600;
  color: #48b5e3;
  margin-bottom: 0.8em;
  padding-bottom: 0.5em;
  border-bottom: 1px solid #f0f0f0;
}

.diary-content {
  white-space: pre-line;
  line-height: 1.6;
  color: #444;
}

mark {
  background-color: rgba(255, 220, 40, 0.4);
  padding: 2px 0;
  border-radius: 2px;
}

.search-actions {
  margin-top: 1.5em;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.search-actions button {
  flex: 1;
}

/* ローディングアニメーション */
.loading-animation {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 3px solid rgba(72, 181, 227, 0.3);
  border-radius: 50%;
  border-top-color: #48b5e3;
  animation: spin 1s ease-in-out infinite;
}

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

/* スクロールバーのスタイリング */
.diary-list::-webkit-scrollbar {
  width: 8px;
}

.diary-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.diary-list::-webkit-scrollbar-thumb {
  background: #48b5e3;
  border-radius: 4px;
}

.diary-list::-webkit-scrollbar-thumb:hover {
  background: #3da8d4;
}

/* レスポンシブ対応の改善 */
@media (max-width: 768px) {
  .search-criteria {
    flex-direction: column;
    gap: 8px;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  #diaryPayload {
    min-height: 180px;
  }
}