/* v1.1 - Unified title button styling */
body {
  font-family: system-ui;
  padding: 0;
  margin: 0;
  padding-top: 60px;
  position: relative;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

body::before {
  content: '';
  position: fixed;
  bottom: 0;
  right: 0;
  width: 300px;
  height: 300px;
  background-image: url('../assets/images/quarter.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom right;
  pointer-events: none;
  z-index: 0;
  opacity: 0.8;
}

*:focus-visible {
  outline: 2px solid #c00;
  outline-offset: 2px;
}

body.no-scroll {
  overflow: hidden;
}

input {
  margin: 4px 0;
}

.day {
  margin: 12px 0;
  padding-left: 12px;
}

.day-header {
  font-weight: bold;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.days-remaining {
  font-size: 12px;
  font-weight: normal;
  color: #666;
}

.day-body {
  position: relative;
  padding: 12px;
  background: rgba(255, 255, 255, 0.4);
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(5px);
}

.day-body.region-event {
  border-width: 6px;
  border-style: double;
}

.day-body:last-child {
  margin-bottom: 0;
}

/* Pinned items - vibrant background only */
.day-body.pinned-vibrant::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  filter: saturate(4) brightness(0.95);
  border-radius: 4px;
  z-index: -1;
}

.date-block {
  background: #f5f5f5;
  padding: 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  min-width: 45px;
  min-height: 45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  line-height: 1.3;
  align-self: flex-start;
}

.date-block.empty {
  background: transparent;
  visibility: hidden;
}

.date-block .day-number {
  font-size: 16px;
}

.date-block .day-ordinal {
  font-size: 8px;
  vertical-align: super;
  font-weight: normal;
}

.day-body.region-森之國 {
  background-color: rgba(231, 244, 232, 0.4);
}

.day-body.region-山之國 {
  background-color: rgba(251, 246, 234, 0.4);
}

.day-body.region-澤之國 {
  background-color: rgba(237, 248, 255, 0.4);
}

.day-body.region-龍之國 {
  background-color: rgba(255, 235, 238, 0.4);
}

.day-body.region-羽之國 {
  background-color: rgba(232, 248, 248, 0.4);
}

.day-body.region-哈帕迪 {
  background-color: rgba(245, 232, 255, 0.4);
}

.day-body.region-伊格尼斯 {
  background-color: rgba(255, 237, 213, 0.4);
}

.category-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: #555;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid #ccc;
  font-size: 12px;
  font-weight: bold;
  margin-right: 10px;
  align-self: flex-start;
}

.day-body-content {
  display: inline-block;
  vertical-align: top;
  font-weight: bold;
  color: #555;
  font-size: 15px;
  line-height: 1.7;
}

.event-content-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  padding-left: max(15px, 3vw);
}

.event-note {
  font-size: 12px;
  color: #888;
  font-weight: normal;
}

#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: rgba(227, 227, 227, 0.186);
  backdrop-filter: blur(10px);
  color: #666;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(129, 129, 129, 0.2);
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

#header h1 {
  margin: 0;
  font-size: 20px;
  padding: 0px;
}

.titleBtn {
  background: none;
  border: none;
  color: #555;
  font-size: 24px;
  cursor: pointer;
  padding: 5px 10px;
  transition: all 0.3s ease;
}

.titleBtn img {
  width: 20px;
  height: 20px;
  display: block;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.lang-btn {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  opacity: 0.6;
  padding: 5px 8px;
  transition: opacity 0.3s ease;
}

.lang-btn:hover,
.lang-btn:focus {
  opacity: 0.85;
}

.titleBtn:hover img,
.titleBtn:focus img {
  opacity: 0.8;
  filter: drop-shadow(0 0 1.5px rgba(0, 0, 0, 0.2));
}

#settingsPanel {
  display: none;
}

#overlay {
  display: none;
}

#settingsPanel h4 {
  margin-bottom: 8px;
  margin-top: 16px;
  color: #444;
  text-align: right;
  padding-right: 16px;
  font-size: 13px;
}

.settings-card {
  background: white;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 10px;
  padding-left: 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.settings-card span {
  font-weight: 600;
  font-size: 13px;
  color: #555;
}

.offset-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.offset-controls button {
  width: 26px;
  height: 26px;
  border: 1px solid #ccc;
  background: white;
  border-radius: 3px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
}

.offset-controls button:hover,
.offset-controls button:focus {
  background: #f0f0f0;
}

.offset-controls button:active {
  background: #e0e0e0;
}

.offset-value {
  min-width: 26px;
  text-align: center;
  font-weight: bold;
  font-size: 13px;
  color: #333;
}

#settingsPanel.open {
  right: 0;
}

#closePanel {
  position: absolute;
  top: 15px;
  right: 15px;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 5px;
  line-height: 1;
  width: 36px;
  height: 36px;
  display: none;
  z-index: 10;
}

#closePanel:hover,
#closePanel:focus {
  color: #333;
  background: #f0f0f0;
}

.settings-footer {
  margin-top: auto;
  padding-top: 20px;
  text-align: center;
  font-size: 11px;
  color: #999;
  line-height: 1.6;
}

.settings-footer a {
  color: #999;
  text-decoration: none;
}

.settings-footer a:hover {
  color: #666;
}

#overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999;
}

#overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#content {
  padding: 20px;
  position: relative;
  z-index: 1;
}

.current-day-separator {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 30px 0;
}

.current-day-separator::before,
.current-day-separator::after {
  content: '';
  flex: 1;
  border-bottom: 2px solid #c00;
}

.day-badge {
  padding: 0 15px;
  color: #c00;
  font-weight: bold;
  font-size: 14px;
  white-space: nowrap;
}

#todayButton {
  position: fixed;
  bottom: 30px;
  right: 30px;
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(204, 0, 0, 0.357);
  color: rgba(255, 255, 255, 0.85);
  border: none;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 998;
  transition: all 0.3s ease;
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  gap: 6px;
}

#todayButton img {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

#todayButton:hover {
  background: rgba(204, 0, 0, 0.6);
  transform: scale(1.05);
}

#todayButton:active {
  transform: scale(0.95);
}

/* Mobile Responsive Styles */
@media (max-width: 500px) {
  body {
    padding-top: 50px;
  }

  #header {
    padding: 0 10px;
    height: 50px;
  }

  #header h1 {
    font-size: 18px;
    padding: 10px;
  }

  .header-icon {
    width: 28px;
    height: 28px;
  }

  .titleBtn {
    font-size: 20px;
    padding: 5px;
  }

  #settingsPanel {
    width: 100%;
    right: -100%;
    padding: 15px;
    padding-top: 60px;
  }

  #closePanel {
    display: block;
  }

  #settingsPanel h2 {
    font-size: 20px;
  }

  #settingsPanel h4 {
    font-size: 14px;
  }

  .settings-card {
    padding: 10px;
    padding-left: 15px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .settings-card span {
    font-size: 13px;
  }

  #content {
    padding: 10px;
  }

  .day {
    margin: 10px 0;
    padding-left: 8px;
    border-left-width: 3px;
  }

  .day-header {
    font-size: 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .days-remaining {
    font-size: 11px;
  }

  .day-body {
    padding: 10px;
    gap: 8px;
    align-items: flex-start;
  }

  .date-block {
    min-width: 50px;
    max-width: 50px;
    min-height: 50px;
    padding: 6px;
    font-size: 10px;
    flex-shrink: 0;
  }

  .date-block .day-number {
    font-size: 14px;
  }

  .date-block .day-ordinal {
    font-size: 7px;
  }

  .event-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }

  .category-badge {
    font-size: 11px;
    padding: 2px 8px;
    margin-right: 0;
    align-self: flex-start;
  }

  .day-body-content {
    font-size: 13px;
    line-height: 1.5;
  }

  .event-note {
    font-size: 11px;
  }

  .current-day-separator {
    margin: 20px 0;
  }

  .day-badge {
    font-size: 12px;
    padding: 0 10px;
  }

  #todayButton {
    bottom: 15px;
    right: 15px;
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 8px;
  }

  .offset-controls button {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .offset-value {
    min-width: 25px;
    font-size: 14px;
  }

  input[type="date"] {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  #header h1 {
    font-size: 14px;
    padding: 5px;
  }

  .header-icon {
    width: 24px;
    height: 24px;
  }

  .day-body {
    padding: 8px;
  }

  .day-body-content {
    font-size: 13px;
  }

  .settings-card {
    padding: 8px;
    padding-left: 12px;
  }

  #todayButton {
    bottom: 10px;
    right: 10px;
    padding: 8px 12px;
    font-size: 13px;
  }
}
