/**
 * Index Page Styles - 모바일 최적화
 */

/* Body with bottom nav */
.has-bottom-nav {
  padding-bottom: 70px;
}

/* Mobile Header */
.mobile-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(250, 246, 241, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -1px;
}

.logo-sub {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 1px;
}

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

.admin-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  border-radius: 50%;
  transition: all 0.2s;
}

.admin-btn:hover {
  color: var(--color-primary);
  background: var(--color-bg-darker);
}

.connection-status .status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-warning);
  display: block;
}

.connection-status.connected .status-dot {
  background: var(--color-success);
}

.connection-status.disconnected .status-dot {
  background: var(--color-danger);
}

/* Main Content */
.mobile-main {
  padding-top: 72px;
  padding-left: 12px;
  padding-right: 12px;
  min-height: calc(100vh - 70px);
}

/* Products Section */
.products-section {
  margin-bottom: 1rem;
}

/* Products Grid - 2 columns */
.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Scroll Sentinel - 무한 스크롤 로딩 인디케이터 */
.scroll-sentinel {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.scroll-sentinel .loading-more {
  color: var(--color-text-muted);
  font-size: 1.5rem;
  visibility: hidden;
}

/* Product Card - 9:16 thumbnail with overlay */
.product-card {
  display: block;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--color-bg-card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.product-card:active {
  transform: scale(0.98);
}

.product-card.inactive {
  opacity: 0.5;
}

/* 9:16 Aspect Ratio Container */
.product-thumbnail {
  position: relative;
  width: 100%;
  padding-bottom: 177.78%; /* 16/9 = 1.7778 */
  background: var(--color-bg-darker);
  overflow: hidden;
}

.product-thumbnail img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-thumbnail .no-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 2.5rem;
}

/* Product Info Overlay */
.product-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 40px 12px 12px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
  color: white;
}

.product-name {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-price {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.product-price .won {
  font-size: 0.8rem;
  font-weight: 500;
}

/* Loading & Empty States */
.loading-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.loading-placeholder i {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item span {
  font-size: 0.7rem;
  font-weight: 500;
}

.nav-item:active,
.nav-item.active {
  color: var(--color-primary);
}

/* Slide Panels */
.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 400px;
  background: var(--color-bg-dark);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

.slide-panel.active {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
}

.panel-close {
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-close:hover {
  background: var(--color-bg-darker);
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
  z-index: 150;
}

.panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Orders List in Panel */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-bg-card);
  border-radius: 12px;
  border: 1px solid var(--color-border);
}

.order-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-bg-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.order-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.order-info {
  flex: 1;
  min-width: 0;
}

.order-user {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.9rem;
  margin-bottom: 2px;
}

.order-product {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.order-meta {
  text-align: right;
  flex-shrink: 0;
}

.order-time {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.order-status {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

.order-status.pending {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning);
}

.order-status.confirmed {
  background: rgba(99, 102, 241, 0.2);
  color: var(--color-secondary);
}

.order-status.completed {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

.order-status.cancelled {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-danger);
}

/* CS Info */
.cs-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cs-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--color-bg-card);
  border-radius: 12px;
  border: 1px solid var(--color-border);
}

.cs-item i {
  font-size: 1.5rem;
  color: var(--color-primary);
  width: 40px;
  text-align: center;
}

.cs-text strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.cs-text p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
}

/* Profile */
.profile-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: var(--color-bg-card);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  margin-bottom: 20px;
}

.profile-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.profile-info strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.profile-info p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
}

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-prompt {
  text-align: center;
  padding: 40px 20px;
}

.login-prompt i {
  font-size: 4rem;
  color: var(--color-text-muted);
  margin-bottom: 16px;
}

.login-prompt p {
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* Buttons */
.btn-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
}

.btn-kakao {
  background: #FEE500;
  color: #000;
  border: none;
}

.btn-kakao:hover {
  background: #E6CF00;
}

/* New Order Animation */
.order-card.new {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Responsive - larger screens */
@media (min-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .mobile-main {
    max-width: 600px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
  }

  .bottom-nav {
    max-width: 600px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 20px 20px 0 0;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .mobile-main {
    max-width: 900px;
  }

  .bottom-nav {
    max-width: 600px;
  }
}

/* Cart Badge */
.nav-item {
  position: relative;
}

.cart-badge {
  position: absolute;
  top: 2px;
  right: 8px;
  min-width: 18px;
  height: 18px;
  background: var(--color-danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* Cart List */
.cart-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 100px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-bg-card);
  border-radius: 12px;
  border: 1px solid var(--color-border);
  position: relative;
}

.cart-item-image {
  width: 60px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--color-bg-darker);
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-item-option {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.cart-item-price {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-primary);
}

.cart-item-quantity {
  display: flex;
  align-items: center;
  gap: 8px;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qty-btn:active {
  background: var(--color-bg-darker);
}

.qty-value {
  min-width: 24px;
  text-align: center;
  font-weight: 600;
}

.cart-item-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-remove:hover {
  color: var(--color-danger);
}

/* Cart Footer */
.cart-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
}

.cart-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 1rem;
}

.cart-total strong {
  font-size: 1.25rem;
  color: var(--color-primary);
}

.slide-panel .panel-content {
  position: relative;
}
