/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap');

/* --- Base Styles --- */
body {
    background-color: #121214;
    color: #e1e1e5;
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
                 Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* prevent horizontal scroll */
}

/* --- Message Bar --- */
#message-bar-container {
    width: 100vw;
    overflow: hidden;
    background-color: #1e1e20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    height: 44px;
}
#message-bar {
    position: relative;
    width: 100%;
    overflow: hidden;
}
#message-text {
    white-space: nowrap;
    position: absolute;
    will-change: transform;
    color: #f9fafb;
    font-weight: 600;
    font-size: 1.05rem;
    padding-left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(0);
}

/* --- Header Bar --- */
#header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #1a1a1c;
    padding: 0 32px;
    height: 62px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    position: relative;
    z-index: 10;
}
.left-header {
    display: flex;
    align-items: center;
}
#logo {
    height: 48px;
    cursor: pointer;
    transition: filter 0.25s ease;
}
#logo:active, #logo:focus {
    filter: brightness(1.2);
    outline: none;
}
.center-header {
    display: flex;
    align-items: center;
    flex: 1;
    justify-content: center;
    gap: 14px;
}
.filter-btn.active {
    background-color: #ffffff;
    color: #121214;
    box-shadow: 0 0 18px 4px #8b8b8baa;
}
.filter-btn {
    background-color: #252528;
    color: #e1e1e5;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    font-weight: 600;
    box-shadow: none;
    transition: background-color 0.23s ease, box-shadow 0.25s ease, color 0.25s ease;
}
.filter-btn:hover, .filter-btn:focus {
    background-color: #343436;
    box-shadow: 0 0 14px 3px #ffffffcc;
}

/* --- Currency Selector & Search --- */
.right-header {
    display: flex;
    align-items: center;
    gap: 18px;
}
.currency-dropdown {
    position: relative;
    display: inline-block;
}
#currency-btn {
    background-color: #29292d;
    color: #f0f0f3;
    border: none;
    border-radius: 8px;
    padding: 9px 19px;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    font-weight: 700;
    transition: box-shadow 0.3s ease;
}
#currency-btn:hover, #currency-btn:focus {
    box-shadow: 0 0 14px 3px #ffffffcc;
}
#currency-menu {
    position: absolute;
    left: 0;
    top: 110%;
    min-width: 110px;
    background-color: #1a1a1d;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.54);
    border-radius: 10px;
    padding: 0;
    display: none;
    z-index: 20;
}
.currency-option {
    padding: 12px 18px;
    color: #e1e1e5;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.22s ease;
}
.currency-option:hover {
    background-color: #343437;
}
#search-bar {
    background-color: #202023;
    border: none;
    border-radius: 10px;
    padding: 9px 20px;
    color: #e8e8eb;
    font-size: 1rem;
    outline: none;
    width: 220px;
    transition: box-shadow 0.25s ease;
}
#search-bar:focus, #search-bar:hover {
    box-shadow: 0 0 14px 3px #ffffffcc;
}
#search-container {
    position: relative;
}
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1d;
    border-radius: 8px;
    max-height: 180px;
    overflow-y: auto;
    margin-top: 4px;
    padding: 0;
    list-style: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7);
    z-index: 25;
    font-size: 0.95rem;
    color: #eee;
    user-select: none;
}
.search-suggestions li {
    padding: 9px 18px;
    cursor: pointer;
    transition: background-color 0.18s;
}
.search-suggestions li:hover,
.search-suggestions li.active {
    background-color: #0ee1cb;
    color: #121214;
}
.search-suggestions mark {
    background-color: transparent;
    color: #0ee1cb;
    font-weight: 700;
    text-decoration: underline;
}

/* --- Main Content --- */
#main-content {
    display: flex;
    margin-top: 38px;
    padding-left: 32px;
}
#sidebar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 75px;
    margin-right: 36px;
    gap: 26px;
}
.sidebar-btn {
    background: transparent;
    border: none;
    outline: none;
    border-radius: 14px;
    padding: 2px;
    cursor: pointer;
    transition: box-shadow 0.22s ease;
}
.sidebar-btn:hover, .sidebar-btn:focus {
    box-shadow: 0 0 16px 6px #a978f5;
}
.sidebar-btn img {
    width: 90px;
    filter: drop-shadow(0 2px 8px #1b176480);
    transition: filter 0.22s ease;
}

/* --- Product Grid --- */
#product-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 36px 30px;
    width: 100%;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}
@media (max-width: 1080px) {
    #product-list {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 740px) {
    #product-list {
        grid-template-columns: 1fr;
    }
}

/* --- Pagination Controls --- */
#pagination-controls {
    margin-top: 20px;
    text-align: center;
    user-select: none;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
}
#pagination-controls button {
    background-color: #e4e4e4;
    border: none;
    color: #121214;
    font-weight: 700;
    font-size: 1rem;
    margin: 0 8px;
    padding: 8px 16px;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 0 16px 2px #858585cc;
    transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
#pagination-controls button:disabled {
    background-color: #555;
    color: #999;
    cursor: default;
    box-shadow: none;
}
#pagination-controls button:hover:not(:disabled),
#pagination-controls button:focus:not(:disabled) {
    background-color: #cccccc;
    box-shadow: 0 0 24px 4px #c0c0c0cc;
    outline: none;
}

/* --- Product Card --- */
.product-card {
    background-color: #252528;
    border-radius: 16px;
    box-shadow: 0 5px 22px rgba(0,0,0,0.22);
    overflow: visible; /* allow glow to show without clipping */
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: box-shadow 0.28s ease;
    border: 1px solid #1a1a1b;
    min-width: 215px;
    max-width: 300px;
    height: 250px; /* shorter card */
    padding: 8px 14px;
    position: relative; /* for glow */
}
.product-card:hover, .product-card:focus {
    box-shadow: 0 0 28px 12px #ffffffdd, 0 6px 28px rgba(0, 0, 0, 0.24);
    z-index: 3;
}
.product-photo {
    max-width: 100%;
    height: auto; /* keep aspect ratio */
}

.product-title {
    font-size: 0.9rem;
    white-space: normal;
    word-wrap: break-word;
}

.product-photo {
    width: 130px; /* smaller image */
    height: 130px;
    object-fit: contain;
    border-radius: 12px;
    margin: 4px 0 8px 0;
    flex-shrink: 0;
}
.product-info {
    flex-wrap: wrap;
}

.product-info {
    
    width: 90%;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: center;
}
.product-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #edeef0;
    margin: 0;
    line-height: 1.1;
    overflow-wrap: break-word;
    word-break: break-word;
    max-height: 2.4em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}
.product-variants {
    color: #aaaab2;
    font-size: 0.65rem;
    margin: 0;
}
.product-price {
    color: #08d9d6;
    font-weight: 700;
    font-size: 0.75rem;
    margin: 0;
}
.product-number {
    color: #c7c8ce;
    font-size: 0.65rem;
    background-color: #1f1f22;
    border-radius: 6px;
    padding: 2px 8px;
    font-family: 'Courier New', monospace;
}

/* --- Product Page Specific --- */
.product-detail-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
}
.product-detail-info {
    text-align: center;
    margin-top: 20px;
    color: #ededf1;
    max-width: 600px;
}
.product-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 12px;
}
.product-variants {
    font-size: 1.1rem;
    color: #b2b2b8;
    margin-bottom: 8px;
}
.product-price-large {
    font-size: 1.6rem;
    font-weight: 700;
    color: #08d9d6;
    margin-bottom: 12px;
}
.product-number-large {
    font-size: 1.1rem;
    background-color: #262628;
    border-radius: 10px;
    padding: 6px 16px;
    font-family: 'Courier New', monospace;
}
.product-photo-large {
    max-width: 360px;
    width: 90%;
    border-radius: 14px;
}
.product-detail-gallery {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    margin-bottom: 44px;
}
.gallery-image {
    max-width: 200px;
    border-radius: 14px;
    box-shadow: 0 6px 22px rgba(0,0,0,0.25);
    cursor: pointer;
    transition: transform 0.22s ease-in-out;
}
.gallery-image:hover {
    transform: scale(1.06);
}
.buy-btn {
    display: block;
    margin: 0 auto 30px auto;
    background: linear-gradient(90deg, #ff4e50, #f9d423);
    border: none;
    border-radius: 14px;
    padding: 16px 48px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(255,78,80,0.7);
    transition: box-shadow 0.3s ease, transform 0.22s ease;
    text-align: center;
    user-select: none;
}
.buy-btn:hover {
    box-shadow: 0 8px 28px rgba(255,90,70,0.9);
    transform: scale(1.06);
}
.share-btn {
    display: block;
    margin: 0 auto 15px auto;
    background: linear-gradient(45deg, #00b4db, #0083b0);
    border: none;
    border-radius: 12px;
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0,128,197,0.7);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
    user-select: none;
    text-align: center;
}
.share-btn:hover {
    box-shadow: 0 6px 24px rgba(0,154,238,0.95);
    transform: scale(1.05);
}
.link-copied-msg {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #202020cc;
    color: #0ee1cb;
    border-radius: 14px;
    padding: 18px 42px;
    font-size: 1.3rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    transition: opacity 0.3s ease;
    box-shadow: 0 0 24px #0ee1cbbb;
    z-index: 2000;
}

.product-card,
.product-info,
.product-photo,
.product-title,
.product-variants,
.product-price,
.product-number {
    box-sizing: border-box; /* ensure padding/border included in size */
    max-width: 100%; /* prevent children from overflowing container width */
}
.product-card .product-title {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    max-height: 2em !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    letter-spacing: 0.02em;
    margin-bottom: 2px;
}
#profile-menu-container:hover #profile-dropdown, 
#profile-menu-container:focus-within #profile-dropdown {
  display:block;
}
/* Optional: transition, hover, and focus styles for dropdown */
#profile-dropdown button:hover {
  background:#222224;
  color:#08d9d6;
}
#profile-menu-container:hover #profile-dropdown,
#profile-menu-container:focus-within #profile-dropdown {
  display: block;
}

.product-card {
  position: relative;
  /* your existing styles */
}

.heart-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  user-select: none;
  transition: color 0.3s ease;
}

.heart-btn.saved {
  color: #e00;
}
