/* Nicobay Theme - Global Styles */

:root {
  /* Nicobay Brand Colors */
  --nicobay-green: 21, 136, 8;
  --nicobay-green-dark: 50, 107, 31;
  --nicobay-green-light: 76, 161, 47;

  /* Color scheme overrides */
  --color-background: 255, 255, 255;
  --color-foreground: 0, 0, 0;
  --color-accent: var(--nicobay-green);
  --color-accent-2: var(--nicobay-green-dark);

  /* Typography */
  --font-heading-family: "Noto Sans JP", sans-serif;
  --font-body-family: "Noto Sans JP", sans-serif;
}

/* Campaign Announcement Bar */
.nicobay-campaign-bar {
  background-color: rgb(var(--nicobay-green));
    position: sticky;   /* relative → sticky に変更 */
  top: 0;             /* ← 追加 */
  z-index: 1000;      /* ← 追加（ヘッダーより上） */
  min-height: 2.75rem;
  overflow: hidden;
  transition: height 0.3s ease;
}

.nicobay-campaign-bar__inner {
  position: relative;
  max-width: 1600px;
  margin: 0 auto;
  height: 100%;
  transition: height 0.3s ease;
}

.nicobay-campaign-bar__text {
  color: white;
  letter-spacing: 0.5px;
  font-weight: 400;
  font-size: 14px;
  margin: 0;
  text-transform: uppercase;
  width: 100%;
  padding: 0.85rem 4rem;
  box-sizing: border-box;
  line-height: 1.6;
  text-align: center;
  white-space: normal;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
}

.nicobay-campaign-bar__text.is-active {
  opacity: 1;
  pointer-events: auto;
}

.nicobay-campaign-bar__text.slide-in-right {
  animation: slideInRight 1s ease;
}

.nicobay-campaign-bar__text.slide-in-left {
  animation: slideInLeft 1s ease;
}

.nicobay-campaign-bar__text.slide-out-right {
  animation: slideOutRight 1s ease;
}

.nicobay-campaign-bar__text.slide-out-left {
  animation: slideOutLeft 1s ease;
}

.nicobay-campaign-bar__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: white;
  padding: 8px;
  cursor: pointer;
  z-index: 10;
  transition: opacity 0.3s ease;
  opacity: 0.7;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
}

.nicobay-campaign-bar__arrow:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.nicobay-campaign-bar__arrow--prev {
  right: 20px;
}

.nicobay-campaign-bar__arrow--next {
  left: 20px;
}

.nicobay-campaign-bar__arrow svg {
  width: 12px;
  height: 12px;
}

@keyframes slideInRight {
  0% {
    transform: translateX(50%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  0% {
    transform: translateX(-50%);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(50%);
    opacity: 0;
  }
}

@keyframes slideOutLeft {
  0% {
    transform: translateX(0);
    opacity: 1;
  }
  100% {
    transform: translateX(-50%);
    opacity: 0;
  }
}

/* Header Styles */
.nicobay-header {
  background-color: white;
  border-bottom: 1px solid #e5e5e5;
  position: relative;
  z-index: 100;
}

.nicobay-header__container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 30px;
  display: -webkit-grid;
  display: grid;
  -webkit-grid-columns: 1fr auto 1fr;
  grid-template-columns: 1fr auto 1fr;
  -webkit-align-items: center;
  align-items: center;
  height: 80px;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

/* Safari-specific fixes */
@supports (-webkit-appearance: none) and (not (-webkit-touch-callout: none)) {
  .nicobay-header__container {
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
  }

  .nicobay-header__left,
  .nicobay-header__center,
  .nicobay-header__right {
    -webkit-flex-shrink: 0;
    flex-shrink: 0;
  }

  .nicobay-header__left {
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    min-width: 0;
  }

  .nicobay-header__center {
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
  }

  .nicobay-header__right {
    -webkit-flex: 1 1 0;
    flex: 1 1 0;
    min-width: 0;
    -webkit-justify-content: flex-end;
    justify-content: flex-end;
  }
}

.nicobay-header__left {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 24px;
  -webkit-justify-self: start;
  justify-self: start;
}

/* Safari gap fallback */
@supports not (gap: 24px) {
  .nicobay-header__left > * + * {
    margin-left: 24px;
  }
}

.nicobay-header__center {
  display: -webkit-flex;
  display: flex;
  -webkit-justify-content: center;
  justify-content: center;
  -webkit-align-items: center;
  align-items: center;
  -webkit-justify-self: center;
  justify-self: center;
  height: 100%;
  margin-top: -8px;
}

.nicobay-header__center h1 {
  margin: 0;
  line-height: 1;
}

.nicobay-header__right {
  display: -webkit-flex;
  display: flex;
  -webkit-align-items: center;
  align-items: center;
  gap: 16px;
  -webkit-justify-self: end;
  justify-self: end;
}

/* Safari gap fallback */
@supports not (gap: 16px) {
  .nicobay-header__right > * + * {
    margin-left: 16px;
  }
}

/* Logo */
.nicobay-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  line-height: 1;
}

.nicobay-logo img {
  display: block;
  height: auto;
  max-height: 50px;
}

.nicobay-logo:hover {
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

/* Navigation Menu */
.nicobay-nav-wrapper {
  background-color: #f8f9fa;
}

.nicobay-nav {
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  padding: 12px 0;
}

.nicobay-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 8px 30px;
  max-width: 1250px;
}

.nicobay-nav__item {
  font-size: 12px;
  font-weight: 500;
  color: #505050;
  text-decoration: none;
  padding-top: 8px;
  padding-bottom: 2px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: all 0.3s ease;
}

.nicobay-nav__item:hover {
  color: rgb(var(--nicobay-green));
  border-bottom-color: rgb(var(--nicobay-green));
}

/* Header Search */
.nicobay-header-search {
  flex: 0 0 280px;
  margin: 0;
}

.nicobay-header-search .nicobay-search-input-wrapper {
  height: 40px;
}

.nicobay-header-search .nicobay-search-input {
  padding: 12px 20px;
  font-size: 13px;
}

.nicobay-header-search .nicobay-search-button {
  padding: 6px 12px;
  margin: 2px;
}

.nicobay-header-search .nicobay-search-button svg {
  width: 16px;
  height: 16px;
}

/* Header Icons */
.nicobay-header__icons {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 0;
}

.nicobay-header__icon {
  width: 24px;
  height: 24px;
  color: #333;
  transition: color 0.3s ease;
}

.nicobay-header__icon:hover {
  color: rgb(var(--nicobay-green));
}

/* Search Icon */
.nicobay-search-icon {
  cursor: pointer;
  display: none; /* Hide by default, show on smaller screens */
}

/* Search Modal */
.nicobay-search-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.nicobay-search-modal.is-active {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
  opacity: 1;
}

.nicobay-search-modal__content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 600px;
  width: 90%;
  position: relative;
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.nicobay-search-modal.is-active .nicobay-search-modal__content {
  transform: translateY(0);
}

.nicobay-search-modal__close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #666;
  transition: color 0.3s ease;
}

.nicobay-search-modal__close:hover {
  color: #333;
}

.nicobay-search-modal__close svg {
  width: 24px;
  height: 24px;
}

.nicobay-search-modal__title {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.nicobay-search-modal .nicobay-search-form {
  width: 100%;
}

.nicobay-search-modal .nicobay-search-input-wrapper {
  height: 50px;
}

.nicobay-search-modal .nicobay-search-input {
  padding: 16px 24px;
  font-size: 16px;
}

.nicobay-search-modal .nicobay-search-button {
  padding: 10px 16px;
  margin: 4px;
}

.nicobay-search-modal .nicobay-search-button svg {
  width: 20px;
  height: 20px;
}

/* Account Icon */
.nicobay-account-icon {
  cursor: pointer;
}

/* Wishlist Icon */
.nicobay-wishlist-icon {
  position: relative;
  cursor: pointer;
}

/* Cart Icon */
.nicobay-cart-icon {
  position: relative;
  cursor: pointer;
}

.nicobay-cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background-color: #ff4066;
}

/* Mobile Menu Button */
.nicobay-mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nicobay-mobile-menu-btn svg {
  width: 24px;
  height: 24px;
  color: #333;
}

/* Hide the default header drawer button */
.header__icon--menu {
  display: none !important;
}

/* Mobile Menu Drawer Overrides */
@media (max-width: 768px) {
  .menu-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    background-color: #f5f5f5 !important;
  }

  .js .menu-drawer {
    height: 100vh !important;
    height: 100dvh !important;
  }

  .menu-drawer__inner-container {
    height: 100%;
    overflow-y: auto;
    padding-top: 40px;
  }

  /* Custom close button */
  .nicobay-menu-close-btn {
    position: fixed;
    top: 10px;
    left: 10px;
    width: 74px;
    height: 74px;
    z-index: 10000;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
  }

  /* Welcome message */
  .nicobay-menu-welcome {
    width: 100%;
    text-align: end;
    padding: 0 30px;
    font-size: 12px;
    font-weight: 500;
    color: #333;
  }

  /* Mobile menu buttons */
  .nicobay-mobile-menu-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 10px 35px 10px 38px;
  }

  .nicobay-mobile-menu-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #ffffff;
    border-radius: 5px;
    text-decoration: none;
    color: #505050;
    transition: all 0.3s ease;
    height: 92px;
    position: relative;
  }

  .nicobay-mobile-menu-button:hover {
    background: #e8e8e8;
    transform: translateY(-2px);
  }

  .nicobay-mobile-menu-button svg {
    width: 32px;
    height: 32px;
    margin-bottom: 8px;
    color: #505050;
  }

  .nicobay-mobile-menu-button span {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
  }

  /* Cart button specific */
  .nicobay-mobile-menu-button-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
  }

  .nicobay-mobile-menu-cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: #ff4066;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
  }

  /* Campaign button */
  .nicobay-mobile-campaign-btn {
    display: block;
    width: calc(100% - 35px - 38px);
    margin: 10px 35px 10px 38px;
    padding: 25px;
    background-color: rgb(var(--nicobay-green));
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 19px;
    font-weight: 200;
    line-height: 0.5;
    transition: all 0.3s ease;
    border: solid 4px white;
  }

  .nicobay-mobile-campaign-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
  }

  /* Mobile search bar */
  .nicobay-mobile-search {
    padding: 10px 35px 10px 38px;
    display: block !important;
  }

  .nicobay-mobile-search .nicobay-search-form {
    width: 100%;
  }

  .nicobay-mobile-search .nicobay-search-input-wrapper {
    position: relative;
    width: 100%;
    border-radius: 90px;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
  }

  .nicobay-mobile-search .nicobay-search-input {
    width: 100%;
    padding: 10px;
    padding-left: 32px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
  }

  .nicobay-mobile-search .nicobay-search-button {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .nicobay-mobile-search .nicobay-search-button svg {
    width: 25px;
    height: 25px;
  }

  /* Mobile Navigation Accordion */
  .nicobay-mobile-nav {
    padding: 10px 35px 10px 38px;
  }

  .nicobay-mobile-nav-item {
    background: white;
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .nicobay-mobile-nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    list-style: none;
    background: white;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: #333;
  }

  .nicobay-mobile-nav-header::-webkit-details-marker {
    display: none;
  }

  .nicobay-mobile-nav-arrow {
    width: 32px;
    height: 32px;
    padding: 6px;
    color: #666;
    background-color: #f5f5f5;
    border-radius: 50%;
    transition: transform 0.3s ease;
    transform: rotate(-90deg);
  }

  .nicobay-mobile-nav-item[open] .nicobay-mobile-nav-arrow {
    transform: rotate(0deg);
  }

  .nicobay-mobile-nav-content {
    padding: 0 20px 20px;
    background: white;

    .nicobay-mobile-nav-first-time {
      color: #666;
    }
  }

  .nicobay-mobile-nav-link {
    display: block;
    padding: 12px 0;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
  }

  .nicobay-mobile-nav-link:last-child {
    border-bottom: none;
  }

  /* View All link styling */
  .nicobay-mobile-nav-link.nicobay-mobile-nav-all {
    color: #666;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 8px;
    padding-bottom: 12px;
    transition: transform 0.3s ease;
  }

  .nicobay-mobile-nav-link.nicobay-mobile-nav-all:hover {
    transform: translateX(5px);
  }

  /* Flavor Grid */
  .nicobay-mobile-flavor-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
  }

  .nicobay-mobile-flavor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #333;
  }

  .nicobay-mobile-flavor-item img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    margin-bottom: 8px;
  }

  .nicobay-mobile-flavor-item span {
    font-size: 12px;
    text-align: center;
  }

  /* Flavor Diagnosis Button */
  .nicobay-mobile-flavor-diagnosis-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    background-color: rgb(var(--nicobay-green));
    color: white;
    text-decoration: none;
    border-radius: calc(Infinity * 1px);
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
  }

  .nicobay-mobile-flavor-diagnosis-btn:hover {
    opacity: 0.9;
  }

  .nicobay-mobile-flavor-diagnosis-btn svg {
    width: 20px;
    height: 20px;
  }

  /* Ensure menu drawer details overlay covers full screen */
  .js menu-drawer > details > summary::before,
  .js menu-drawer > details[open]:not(.menu-opening) > summary::before {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
  }

  .drawer-footer {
    padding: 35px 40px 120px;

    .nicobay-footer-links__logo {
      display: flex;
      justify-content: center;
      margin-bottom: 18px;
    }
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .nicobay-header__container {
    height: 70px;
    padding: 0 16px;
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
  }

  .nicobay-mobile-menu-btn {
    display: block;
  }

  .nicobay-logo {
    font-size: 28px;
  }

  .nicobay-header__icons {
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .nicobay-header__container {
    height: 60px;
    padding: 0 12px;
    display: -webkit-flex;
    display: flex;
    -webkit-justify-content: space-between;
    justify-content: space-between;
    -webkit-align-items: center;
    align-items: center;
  }

  .nicobay-logo {
    font-size: 24px;
  }
}

/* Search Form Styles */
.nicobay-search-form {
  width: 100%;
}

.nicobay-search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background-color: #f5f5f5;
  border-radius: 90px;
  overflow: hidden;
  transition: background-color 0.3s ease;
}

.nicobay-search-input-wrapper:hover {
  background-color: #ebebeb;
}

.nicobay-search-input-wrapper:focus-within {
  background-color: #ebebeb;
}

.nicobay-search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 14px 24px;
  font-size: 14px;
  font-family: var(--font-body-family);
  color: #333;
  background-color: transparent;
  box-shadow: none;
}

.nicobay-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.nicobay-search-input:focus {
  outline: none;
  border: none;
  box-shadow: none;
}

.nicobay-search-input::placeholder {
  color: #999;
  font-weight: 400;
}

.nicobay-search-button {
  background-color: transparent;
  border: none;
  outline: none;
  padding: 8px 16px;
  margin: 3px;
  border-radius: 3px;
  color: rgb(var(--nicobay-green));
  cursor: pointer;
  transition: color 0.3s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nicobay-search-button:hover {
  color: rgb(var(--nicobay-green-dark));
  transform: scale(1.05);
}

.nicobay-search-button svg {
  width: 18px;
  height: 18px;
}

/* Main Content Background */
#MainContent {
  background-color: #f5f5f5;
  min-height: 500px;
}

/* Keep sections with white background */
.section {
  background-color: white;
}

/* Responsive Design Updates */
@media (max-width: 1200px) {
  .nicobay-header-search {
    display: none;
  }

  /* Show search icon on tablets and smaller screens */
  .nicobay-search-icon {
    display: block !important;
  }
}

@media (max-width: 768px) {
  .nicobay-nav {
    display: none;
  }

  /* Hide all icons except wishlist and cart on mobile */
  .nicobay-search-icon,
  .nicobay-beginner-icon,
  .nicobay-question-icon,
  .nicobay-account-icon,
  .nicobay-calendar-icon {
    display: none !important;
  }
}
