/**
 * Shop System Styling - Classified Merchant Theme
 * Document-style shop interface with trader
 */

/* Main container */
.shop-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #3A3238;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    font-family: 'Courier New', monospace;
}

/* Close button */
.shop-close {
    position: absolute;
    right: 20px;
    top: 20px;
    background: transparent;
    border: 2px solid #8E7F7F;
    color: #5F5449;
    font-size: 16px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Courier New', monospace;
    z-index: 300;
}

.shop-close:hover {
    background: rgba(142, 127, 127, 0.2);
    border-color: #5F5449;
}

/* Document container */
/* THE REGISTER SITS BELOW THE HUD. The menu is full-screen at z 3000
   and the top panel lives at 9999, so a 700px card centred on a
   900px screen tucked its top edge — ✕ included — under the HUD.
   The Day-7 grocery lesson ends on "close the shop": at 1600x900 the
   close button could not be clicked and the chapter stopped there.
   Keep the card between the panels and let its content scroll (it
   already does: .shop-content is overflow-y: auto). */
.shop-menu {
    padding: 80px 0 64px;
    box-sizing: border-box;
}

.shop-document {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: min(700px, calc(var(--vh100, 100vh) - 150px));
    background: #EBE6D8;
    border: 2px solid #8E7F7F;
    box-shadow:
        0 0 30px rgba(0,0,0,0.3),
        inset 0 0 100px rgba(210,180,140,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Paper texture */
.shop-document::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.1"/></svg>');
    pointer-events: none;
    opacity: 0.3;
    z-index: 0;
}

/* Trader section at top */
.trader-section {
    position: relative;
    z-index: 1;
    border-bottom: 2px solid #8E7F7F;
    padding: 20px 30px;
    background: rgba(142, 127, 127, 0.05);
    display: flex;
    gap: 20px;
    align-items: center;
}

.trader-portrait {
    width: 80px;
    height: 80px;
    border: 2px solid #8E7F7F;
    background: rgba(95, 84, 73, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    flex-shrink: 0;
}

.trader-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.trader-name {
    color: #5F5449;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.trader-dialogue {
    color: #5F5449;
    font-size: 13px;
    line-height: 1.5;
    padding: 10px;
    border: 1px solid #8E7F7F;
    background: rgba(235, 230, 216, 0.5);
    font-style: italic;
}

.trader-stats {
    display: flex;
    gap: 20px;
    align-items: center;
}

.trader-reputation {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.trader-reputation-label {
    color: #8E7F7F;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.trader-reputation-value {
    color: #5F5449;
    font-size: 13px;
    font-weight: bold;
}

.trader-attitude {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.trader-attitude-label {
    color: #8E7F7F;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.attitude-meter {
    height: 18px;
    background: rgba(142, 127, 127, 0.15);
    border: 2px solid #8E7F7F;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.attitude-meter-fill {
    height: 100%;
    background: repeating-linear-gradient(
        45deg,
        #5F5449,
        #5F5449 10px,
        #6D6150 10px,
        #6D6150 20px
    );
    transition: width 0.3s ease;
    border-right: 2px solid #5F5449;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

.attitude-meter-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    text-align: center;
    color: #5F5449;
    font-size: 10px;
    line-height: 18px;
    font-weight: bold;
    text-shadow:
        1px 1px 0 rgba(235, 230, 216, 0.8),
        -1px -1px 0 rgba(235, 230, 216, 0.8),
        1px -1px 0 rgba(235, 230, 216, 0.8),
        -1px 1px 0 rgba(235, 230, 216, 0.8);
    letter-spacing: 0.5px;
}

/* Main shop area */
.shop-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Left sidebar - categories */
.shop-sidebar {
    width: 180px;
    background: rgba(142, 127, 127, 0.1);
    border-right: 2px solid #8E7F7F;
    padding: 20px;
    overflow-y: auto;
}

.shop-sidebar h2 {
    color: #5F5449;
    font-size: 14px;
    margin-bottom: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #8E7F7F;
}

.shop-categories {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.shop-category {
    background: transparent;
    border: 2px solid #8E7F7F;
    padding: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5F5449;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-align: center;
}

.shop-category:hover {
    background: rgba(142, 127, 127, 0.15);
    border-color: #5F5449;
}

.shop-category.active {
    background: #5F5449;
    border-color: #5F5449;
    color: #EBE6D8;
}

/* Main content area */
.shop-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    position: relative;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #8E7F7F;
}

.shop-title {
    color: #5F5449;
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.shop-money {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #5F5449;
    font-size: 14px;
}

.shop-money-icon {
    font-size: 18px;
}

.shop-money-amount {
    font-weight: bold;
}

/* Items grid */
.shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.shop-item {
    background: transparent;
    border: 2px solid #8E7F7F;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    position: relative;
}

.shop-item:hover {
    background: rgba(142, 127, 127, 0.1);
    border-color: #5F5449;
}

.shop-item.time-limited-item {
    border-color: #c4a87a;
    box-shadow: 0 0 10px rgba(196, 168, 122, 0.25);
}

.shop-item.time-limited-item:hover {
    border-color: #c4a87a;
    box-shadow: 0 0 15px rgba(196, 168, 122, 0.4);
}

.shop-item-timer {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    background: #c4a87a;
    color: #3A3238;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    padding: 4px;
    letter-spacing: 0.5px;
    border: 2px solid #c4a87a;
}

.shop-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.shop-item.time-limited-item .shop-item-header {
    margin-top: 15px;
}

.shop-item-icon {
    font-size: 36px;
}

.shop-item-tags {
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: flex-end;
}

.shop-item-tag {
    background: #5F5449;
    color: #EBE6D8;
    padding: 3px 7px;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid #5F5449;
}

.shop-item-tag.restricted {
    background: rgba(139, 0, 0, 0.3);
    border-color: #8B0000;
    color: #8B0000;
}

.shop-item-tag.stock-low {
    background: rgba(139, 106, 47, 0.22);
    border-color: #8b6a2f;
    color: #8b6a2f;
}

.shop-item-tag.stock-out {
    background: rgba(0, 0, 0, 0.2);
    border-color: #8E7F7F;
    color: #8E7F7F;
}

.shop-item-tag.time-limited {
    background: rgba(196, 168, 122, 0.25);
    border-color: #c4a87a;
    color: #8b6a2f;
    position: relative;
}
/* Glow pulses via ::after OPACITY over a static shadow — never an
   animated box-shadow (INP). */
.shop-item-tag.time-limited::after {
    content: '';
    position: absolute;
    inset: -1px;
    box-shadow: 0 0 9px rgba(196, 168, 122, 0.6);
    opacity: 0;
    animation: shop-tag-glow 2s ease-in-out infinite;
    pointer-events: none;
}
@keyframes shop-tag-glow {
    0%, 100% { opacity: 0; }
    50%      { opacity: 1; }
}



.shop-item-name {
    color: #5F5449;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.shop-item-description {
    color: #8E7F7F;
    font-size: 11px;
    line-height: 1.4;
    margin-bottom: 10px;
    flex: 1;
}

.shop-item-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding-top: 10px;
    border-top: 1px solid #8E7F7F;
}

.shop-item-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.shop-item-meta-label {
    color: #8E7F7F;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shop-item-meta-value {
    color: #5F5449;
    font-size: 11px;
    font-weight: bold;
}

.shop-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #8E7F7F;
}

.shop-item-price {
    color: #5F5449;
    font-size: 16px;
    font-weight: bold;
}

.shop-item-price-original {
    color: #8E7F7F;
    font-size: 12px;
    text-decoration: line-through;
    margin-bottom: 2px;
}

.shop-item-bulk {
    color: #8E7F7F;
    font-size: 9px;
    font-style: italic;
}

.shop-item.sold-out {
    opacity: 0.5;
    cursor: not-allowed;
}

.shop-item.sold-out:hover {
    background: transparent;
    border-color: #8E7F7F;
}

/* Item details modal */
.shop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
}

.shop-modal-content {
    background: #EBE6D8;
    border: 2px solid #8E7F7F;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    font-family: 'Courier New', monospace;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    position: relative;
}

.shop-modal-content::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('data:image/svg+xml,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.8"/></filter><rect width="100" height="100" filter="url(%23noise)" opacity="0.1"/></svg>');
    pointer-events: none;
    opacity: 0.3;
    z-index: 0;
}

.shop-modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #8E7F7F;
    position: relative;
    z-index: 1;
}

.shop-modal-icon {
    font-size: 48px;
}

.shop-modal-info {
    flex: 1;
}

.shop-modal-name {
    color: #5F5449;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.shop-modal-price {
    color: #8E7F7F;
    font-size: 15px;
    font-weight: bold;
}

.shop-modal-body {
    position: relative;
    z-index: 1;
}

.shop-modal-description {
    color: #5F5449;
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(142, 127, 127, 0.05);
    border: 1px solid #8E7F7F;
}

.shop-modal-quantity {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-modal-quantity-label {
    color: #5F5449;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shop-modal-quantity-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.shop-modal-quantity-btn {
    background: transparent;
    border: 2px solid #8E7F7F;
    color: #5F5449;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.shop-modal-quantity-btn:hover:not(:disabled) {
    background: rgba(142, 127, 127, 0.2);
    border-color: #5F5449;
}

.shop-modal-quantity-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.shop-modal-quantity-value {
    color: #5F5449;
    font-size: 16px;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.shop-modal-price-breakdown {
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(142, 127, 127, 0.05);
    border: 1px solid #8E7F7F;
}

.shop-modal-price-row {
    display: flex;
    justify-content: space-between;
    color: #5F5449;
    font-size: 12px;
    margin-bottom: 5px;
    padding: 3px 0;
}

.shop-modal-price-row:last-child {
    margin-bottom: 0;
}

.shop-modal-price-label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shop-modal-price-value {
    font-weight: bold;
}

.shop-modal-price-row.discount {
    color: #4a7c59;
}

.shop-modal-price-row.total {
    border-top: 2px solid #8E7F7F;
    padding-top: 8px;
    margin-top: 8px;
    font-size: 14px;
    font-weight: bold;
}

.shop-modal-total {
    color: #5F5449;
    font-size: 12px;
    margin-bottom: 20px;
    padding: 10px;
    background: rgba(95, 84, 73, 0.1);
    border: 1px solid #8E7F7F;
    display: flex;
    justify-content: space-between;
}

.shop-modal-total-label {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.shop-modal-actions {
    display: flex;
    gap: 10px;
}

.shop-modal-btn {
    flex: 1;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.shop-modal-btn-buy {
    background: #5F5449;
    border: 2px solid #5F5449;
    color: #EBE6D8;
}

.shop-modal-btn-buy:hover:not(:disabled) {
    background: #4A3934;
    border-color: #4A3934;
}

.shop-modal-btn-buy:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.shop-modal-btn-cancel {
    background: transparent;
    border: 2px solid #8E7F7F;
    color: #5F5449;
}

.shop-modal-btn-cancel:hover {
    background: rgba(142, 127, 127, 0.1);
}

/* Empty state */
.shop-empty {
    text-align: center;
    padding: 60px 20px;
    color: #8E7F7F;
}

.shop-empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.shop-empty-text {
    font-size: 15px;
    line-height: 1.6;
}

/* Scrollbar styling */
.shop-sidebar::-webkit-scrollbar,
.shop-content::-webkit-scrollbar {
    width: 8px;
}

.shop-sidebar::-webkit-scrollbar-track,
.shop-content::-webkit-scrollbar-track {
    background: rgba(142, 127, 127, 0.1);
}

.shop-sidebar::-webkit-scrollbar-thumb,
.shop-content::-webkit-scrollbar-thumb {
    background: #8E7F7F;
    border-radius: 4px;
}

.shop-sidebar::-webkit-scrollbar-thumb:hover,
.shop-content::-webkit-scrollbar-thumb:hover {
    background: #5F5449;
}
