/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&display=swap");

/* General Styles */
* {
  box-sizing: border-box;
  user-select: none; /* Prevent text selection */
}

body {
  font-family: "Noto Sans KR", sans-serif;
  padding-top: 55px; /* 네비바 높이 살짝 증가 */
  min-height: 100vh;
  background-image: url("img/Frame_17.png");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
  padding-bottom: 60px; /* Space for sticky cart */
}

.main-container {
  padding: 30px 20px; /* 아이패드 최적화 */
  max-width: 1200px; /* 아이패드 화면에 맞게 조정 */
  margin: 0 auto;
}

/* Navbar - 살짝 늘림 */
.navbar {
  background-color: #fffae9;
  /* backdrop-filter: blur(10px); */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid #dee2e6;
  padding: 1.7rem 0; /* 기존 1rem에서 1.2rem으로 증가 */
}

.navbar-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.navbar-title {
  color: #212529;
  font-weight: 700;
  font-size: 1.4rem; /* 기존 1.3rem에서 1.4rem으로 증가 */
}

/* Products Grid */
.products-grid {
  display: flex;
  flex-direction: column;
  gap: 15px; /* 행 간격 */
}

.product-row {
  display: flex;
  gap: 20px; /* 상품 간격 */
  justify-content: center;
  align-items: stretch; /* 높이 맞춤 */
}

.product-item {
  flex: 1;
}

/* Square Products */
.square-product {
  max-width: 280px;
  min-width: 250px;
}

/* Horizontal Products - 너비 확장 */
.horizontal-product {
  min-width: 440px; /* 380px에서 440px로 확장 */
  flex: 1; /* 1:1 비율로 나누기 */
}

/* Vertical Product (키캡 키링) */
.vertical-product {
  max-width: 280px;
  min-width: 250px;
}

/* Full Width Product */
.full-width-product {
  width: 100%;
  max-width: 880px; /* 전체 너비 */
}

/* Product Cards */
.product-card {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* Product Images */
.product-image-container {
  position: relative;
  /* overflow: hidden; */
}

.square-image {
  height: 250px; /* 아이패드 최적화 */
  flex: 3;
}

.vertical-image {
  height: 350px; /* 세로형 이미지 */
  flex: 4;
}

.product-image {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
}

/* Square Product Card Body */
.square-product .card-body {
  flex: 2;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

.vertical-product .card-body {
  flex: 1;
  padding: 15px;
  display: flex;
  flex-direction: column;
}

/* Horizontal Layout */
.horizontal-card {
  height: 240px; /* 아이패드 최적화 */
}

.vertical-card {
  height: 450px; /* 세로형 카드 높이 */
}

.horizontal-layout {
  display: flex;
  height: 100%;
  flex-direction: row;
}

.horizontal-image-container {
  flex: 3;
  overflow: hidden;
}

.horizontal-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  margin-top: 10px;
}

.horizontal-content {
  flex: 2;
  display: flex;
  flex-direction: column;
}

/* Product Badge */
.product-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #007bff;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: bold;
  z-index: 1;
  text-transform: uppercase;
}

.hot-badge {
  background-color: #dc3545;
}

.sale-badge {
  background-color: #28a745;
}

.new-badge {
  background-color: #17a2b8;
}

/* Card Body */
.card-body {
  padding: 15px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.horizontal-content .card-body {
  padding: 15px;
  justify-content: center;
}

.card-title {
  margin-top: 30px;
  font-size: 1.1rem;
  color: #212529;
  margin-bottom: 8px;
}

.card-title-1 {
  /* margin-top: 30px; */
  font-size: 1.1rem;
  color: #212529;
  /* margin-bottom: 8px; */
}

.card-text {
  color: #6c757d;
  font-size: 0.9rem;
  margin-bottom: -38px;
  flex-grow: 1;
}

.product-footer {
  margin-top: auto;
}

.product-price {
  color: #007bff;
  font-size: 1.2rem;
  display: block;
  margin-bottom: 10px;
}

.add-to-cart-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: 0.95rem;
  border-radius: 6px;
  border: none;
  background-color: #007bff;
  color: white;
  transition: all 0.2s ease;
}

.add-to-cart-btn:hover {
  background-color: #0056b3;
  transform: translateY(-1px);
}

/* Sticky Cart Bar */
.sticky-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  padding: 15px 0;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  border-top: 1px solid #dee2e6;
  z-index: 1000;
}

.cart-total {
  color: #007bff;
  font-size: 1.2rem;
}

.sticky-cart-bar .btn {
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 6px;
}

/* Cart Modal */
.cart-items {
  max-height: 60vh; /* 아이패드 최적화 */
  overflow-y: auto;
  margin-bottom: 20px;
}

.empty-cart-message {
  text-align: center;
  color: #6c757d;
  padding: 40px 0;
  font-size: 1.1rem;
}

.cart-item {
  display: flex;
  align-items: center;
  padding: 15px 0;
  border-bottom: 1px solid #dee2e6;
}

.cart-item-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  margin-right: 15px;
  border-radius: 4px;
  border: 1px solid #dee2e6;
}

.cart-item-details {
  flex-grow: 1;
}

.cart-item-title {
  font-weight: bold;
  margin-bottom: 5px;
  color: #212529;
}

.cart-item-option,
.cart-item-price {
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 3px;
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: #6c757d;
  margin-bottom: 3px;
}

.cart-item-quantity-input {
  width: 50px;
  text-align: center;
  margin: 0 8px;
  padding: 4px 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

.cart-item-quantity-btn {
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 1rem;
}

.cart-item-quantity-btn:hover {
  background-color: #007bff;
  color: white;
}

.cart-item-remove {
  color: #dc3545;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s;
  font-size: 1.1rem;
}

.cart-item-remove:hover {
  background-color: #dc3545;
  color: white;
}

/* Product Modal */
.modal-content {
  border: none;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
}

.modal-header {
  background-color: rgba(248, 249, 250, 0.95);
  border-bottom: 1px solid #dee2e6;
  border-radius: 8px 8px 0 0;
}

.modal-body {
  padding: 30px;
}

#modal-product-image {
  max-height: 300px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #dee2e6;
}

.modal-footer {
  border-top: 1px solid #dee2e6;
  padding: 20px 30px;
}

.modal-footer .btn {
  padding: 12px 24px;
  font-size: 1rem;
}

/* QR Modal Styling */
.qr-modal .modal-content {
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(15px);
}

.qr-modal #qrimg {
  border: 3px solid #007bff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Footer */
.footer {
  /* background-color: rgba(248, 249, 250, 0.95); */
  backdrop-filter: blur(10px);
  border-top: 1px solid #dee2e6;
  /* margin-top: 50px; */
}

.footer a {
  color: #007bff;
  text-decoration: none;
}

.footer a:hover {
  color: #0056b3;
  text-decoration: underline;
}

/* Form Controls */
.form-control,
.form-select {
  border: 1px solid #ced4da;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 1rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control-lg {
  padding: 12px 16px;
  font-size: 1.1rem;
}

/* Buttons */
.btn {
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s ease;
  border: none;
}

.btn-lg {
  padding: 12px 20px;
  font-size: 1.1rem;
}

.btn-primary {
  background-color: #007bff;
  color: white;
}

.btn-primary:hover {
  background-color: #0056b3;
}

.btn-success {
  background-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #1e7e34;
}

.btn-outline-danger {
  border: 1px solid #dc3545;
  color: #dc3545;
  background-color: transparent;
}

.btn-outline-danger:hover {
  background-color: #dc3545;
  color: white;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-secondary:hover {
  background-color: #545b62;
}

/* Toast Notifications */
.toast {
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-header {
  background-color: #007bff;
  color: white;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

/* 아이패드 최적화 반응형 디자인 */
@media (max-width: 1024px) {
  .main-container {
    padding: 25px 15px;
    max-width: 100%;
  }

  .product-row {
    gap: 15px;
  }

  .square-product {
    max-width: 240px;
    min-width: 200px;
  }

  .horizontal-product {
    min-width: 320px;
  }

  .square-image {
    height: 200px;
  }

  .vertical-image {
    height: 280px;
  }

  .horizontal-card {
    height: 150px;
  }

  .vertical-card {
    height: 380px;
  }

  .horizontal-image {
    height: 240px;
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: 20px 10px;
  }

  .product-row {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .square-product,
  .horizontal-product,
  .vertical-product,
  .full-width-product {
    max-width: 100%;
    width: 100%;
  }

  .horizontal-layout {
    flex-direction: column;
  }

  .horizontal-image-container,
  .horizontal-content {
    flex: none;
  }

  .horizontal-image {
    height: 200px;
  }

  .horizontal-card {
    height: auto;
  }

  .vertical-card {
    height: auto;
  }

  .sticky-cart-bar .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
  }

  .cart-items {
    max-height: 50vh;
  }
}

/* Animation for loading */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card {
  animation: fadeInUp 0.4s ease-out;
}

.product-row:nth-child(1) .product-card {
  animation-delay: 0.1s;
}

.product-row:nth-child(2) .product-card {
  animation-delay: 0.3s;
}

.product-row:nth-child(3) .product-card {
  animation-delay: 0.5s;
}

/* Scrollbar Styling */
.cart-items::-webkit-scrollbar {
  width: 8px;
}

.cart-items::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb {
  background: #007bff;
  border-radius: 4px;
}

.cart-items::-webkit-scrollbar-thumb:hover {
  background: #0056b3;
}

/* Debug Modal Styling */
.debug-modal .modal-content {
  border: 2px solid #ffc107;
}

.debug-modal .btn {
  margin-bottom: 10px;
  border: 2px solid;
  font-weight: 600;
}

/* Manual Checkout Modal */
.manual-item {
  background-color: #f8f9fa;
  border: 2px solid #dee2e6 !important;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.manual-item:hover {
  border-color: #007bff !important;
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.manual-item-subtotal {
  font-weight: 600;
  color: #007bff;
}

/* Price Editor Modal */
.price-editor-container .border {
  border: 2px solid #dee2e6 !important;
  border-radius: 8px;
  background-color: #f8f9fa;
  transition: all 0.2s ease;
}

.price-editor-container .border:hover {
  border-color: #17a2b8 !important;
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.15);
}

/* Debug Modal Button Styling */
#debugModal .btn {
  border-width: 2px;
  font-weight: 600;
  transition: all 0.2s ease;
}

#debugModal .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#debugModal .btn-outline-primary:hover {
  background-color: #007bff;
  border-color: #007bff;
}

#debugModal .btn-outline-danger:hover {
  background-color: #dc3545;
  border-color: #dc3545;
}

#debugModal .btn-outline-warning:hover {
  background-color: #ffc107;
  border-color: #ffc107;
  color: #000;
}

#debugModal .btn-outline-success:hover {
  background-color: #28a745;
  border-color: #28a745;
}

#debugModal .btn-outline-info:hover {
  background-color: #17a2b8;
  border-color: #17a2b8;
}

/* Modal Headers */
.modal-header.bg-warning {
  border-bottom: 2px solid #ffc107;
}

.modal-header.bg-success {
  border-bottom: 2px solid #28a745;
}

.modal-header.bg-info {
  border-bottom: 2px solid #17a2b8;
}

/* Form Controls in Modals */
.modal .form-control:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Manual Total Display */
#manual-total {
  font-size: 1.5rem;
  font-weight: bold;
  color: #28a745;
}

/* Payment Method Toggle Buttons */
.btn-outline-success.disabled,
.btn-outline-info.disabled {
  opacity: 0.5;
  background-color: #f8f9fa;
  border-color: #dee2e6;
  color: #6c757d;
}

/* Order Summary Styling */
.order-summary {
  background-color: rgba(248, 249, 250, 0.8);
  border-radius: 8px;
  padding: 15px;
  border: 1px solid #dee2e6;
}

.order-summary h6 {
  color: #495057;
  margin-bottom: 10px;
  font-weight: 600;
}

.order-item {
  display: flex;
  justify-content: between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.order-item:last-child {
  border-bottom: none;
  font-weight: 600;
  color: #007bff;
}

/* Payment Method Button Styling */
.payment-method-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  padding: 15px 20px;
  border: 2px solid;
  transition: all 0.3s ease;
}

.payment-method-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.payment-method-btn i {
  font-size: 1.5rem;
  margin-right: 15px;
}

.payment-method-btn div {
  flex-grow: 1;
}

.payment-method-btn small {
  display: block;
  margin-top: 2px;
}
