/* Reset & Base */
:root {
    --primary-color: #4A7C59;
    /* Keeping but modernized context */
    --gold-color: #D4AF37;
    --bg-color: #F7F8FA;
    /* Updated to slight off-white */
    --card-bg: #FFFFFF;
    --text-primary: #111827;
    /* Darker, higher contrast */
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --success-color: #059669;
    --danger-color: #DC2626;
    --offline-color: #9CA3AF;
    --online-color: #10B981;
    --font-family: 'Inter', sans-serif;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --radius-md: 8px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    outline: none;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    /* Added border */
    height: 80px;
    /* Taller header */
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.nav-left {
    flex: 1;
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.logo-img {
    height: 32px;
    width: auto;
}

.logo-img-sm {
    height: 24px;
    width: auto;
}

.nav-center {
    flex: 2;
    display: flex;
    justify-content: center;
}

.nav-menu {
    display: flex;
    gap: 2rem;
    display: none;
}

@media(min-width: 768px) {
    .nav-menu {
        display: flex;
    }
}

.nav-menu a {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--text-primary);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: -28px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.nav-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--offline-color);
    display: inline-block;
}

.dot.online {
    background-color: var(--online-color);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.btn {
    padding: 0.6rem 1.25rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(74, 124, 89, 0.2);
}

.btn-primary:hover {
    background-color: #3d664a;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(74, 124, 89, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
}

.btn-outline:hover {
    background: var(--bg-color);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Store Buttons */
.store-buttons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.store-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    /* Circle */
    background-color: var(--bg-color);
    color: var(--text-primary);
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.store-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.ios-btn:hover {
    background-color: #000;
    border-color: #000;
}

.android-btn:hover {
    background-color: #3DDC84;
    color: #fff;
    border-color: #3DDC84;
}


/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

@media(min-width: 992px) {
    .main-layout {
        grid-template-columns: 2.2fr 1fr;
    }
}

/* Price Section */
.page-title {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

/* Toolbar */
.toolbar {
    margin-bottom: 1.5rem;
}

.search-wrapper {
    position: relative;
    width: 100%;
    transition: all 0.2s;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 14px;
    color: #9CA3AF;
}

#searchInput {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 3rem;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    background: #FFFFFF;
    font-size: 1rem;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

#searchInput:focus {
    box-shadow: 0 0 0 4px rgba(74, 124, 89, 0.1);
    border-color: var(--primary-color);
}

/* Tabs */
.tabs {
    display: flex;
    background: #E5E7EB;
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #FFFFFF;
    color: var(--primary-color);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.tab-btn[data-tab="gold"].active {
    color: #854d0e;
    /* Darker Gold */
}

/* Table */
.table-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    /* 16px */
    border: 1px solid rgba(229, 231, 235, 0.5);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 40px;
    padding: 1rem 1.5rem;
    background: #F9FAFB;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.price-row {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1.5fr 40px;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: all 0.2s;
    cursor: pointer;
    background: white;
}

.price-row:last-child {
    border-bottom: none;
}

.price-row:hover {
    background: #F3F4F6;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    position: relative;
    z-index: 1;
}

.col-product {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.product-count {
    font-size: 0.75rem;
    color: #9CA3AF;
    font-weight: 500;
}

.col-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.price-val {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.price-company {
    font-size: 0.75rem;
    color: #6B7280;
    font-weight: 500;
}

.col-action {
    display: flex;
    justify-content: flex-end;
    color: #D1D5DB;
    transition: color 0.2s;
}

.price-row:hover .col-action {
    color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.widget {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(229, 231, 235, 0.5);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
}

.widget-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.news-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #F3F4F6;
}

.news-item:last-child {
    border-bottom: none;
    margin-bottom: 0.5rem;
}

.news-title {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    display: block;
    line-height: 1.4;
    color: #374151;
}

.news-title:hover {
    color: var(--primary-color);
}

.news-time {
    font-size: 0.75rem;
    color: #9CA3AF;
    font-weight: 500;
}

.contact-form-sidebar .form-group {
    margin-bottom: 1rem;
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #F9FAFB;
    outline: none;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.form-input:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(74, 124, 89, 0.1);
}

/* Footer */
.footer {
    background: white;
    padding: 2.5rem 0;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
}

.footer-center {
    display: flex;
    gap: 2rem;
}

.footer-center a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.footer-center a:hover {
    color: var(--primary-color);
}

.social-icon {
    font-size: 1.25rem;
    color: #9CA3AF;
    cursor: pointer;
    transition: color 0.2s;
}

.social-icon:hover {
    color: var(--text-primary);
}

/* Detail View Styles */
.hidden {
    display: none !important;
}

#detailView {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.back-btn {
    background: none;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
}

.back-btn:hover {
    color: var(--primary-color);
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.detail-title {
    font-size: 2rem;
    font-weight: 800;
    color: #111827;
}

.fav-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #D1D5DB;
    transition: color 0.2s;
}

.fav-btn.active {
    color: #F59E0B;
    fill: #F59E0B;
}

.fav-btn:hover {
    color: #F59E0B;
}

.detail-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.buy-card {
    border-left: 4px solid var(--success-color);
}

.sell-card {
    border-left: 4px solid var(--danger-color);
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.detail-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.detail-company {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.market-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.market-list-container {
    background: white;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.market-list .price-row {
    cursor: default;
}

.market-list .price-row:hover {
    background: white;
    transform: none;
    box-shadow: none;
}

.market-placeholder {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
}

.sort-arrows {
    font-size: 0.8rem;
    margin-left: 4px;
    opacity: 0.5;
    cursor: pointer;
}

.sort-arrows:hover {
    opacity: 1;
}

/* Responsive adjustments */
@media(max-width: 600px) {

    .table-header,
    .price-row {
        grid-template-columns: 1fr max-content max-content 30px;
        padding: 0.75rem 0.5rem;
        gap: 0.5rem;
    }

    .price-val {
        font-size: 0.95rem;
    }

    .product-name {
        font-size: 0.9rem;
    }

    .nav-right .btn {
        display: none;
    }

    .navbar {
        height: 60px;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .detail-cards {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    display: none !important;
    opacity: 0;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 12px;
    margin-bottom: 1rem;
    background: #f9fafb;
    padding: 10px;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.modal-body {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.info-row {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 12px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-icon {
    font-size: 1.2rem;
    min-width: 24px;
}

.info-link {
    color: var(--primary-color);
    font-weight: 500;
    word-break: break-word;
}

/* Store List Styles in Detail View */
.store-list-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 6px;
    background: white;
}

.store-list-initials {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.btn-info {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1px solid #d1d5db;
    background: white;
    color: #6b7280;
    font-size: 0.8rem;
    font-weight: 700;
    font-family: serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: all 0.2s;
}

.btn-info:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f0fdf4;
}

/* Updated Header Sort Alignment */
.col-price {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.table-header .col-price {
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.sort-arrows {
    font-size: 1rem;
    display: inline-block;
}



.contact-form-main {
    max-width: 600px;
}

.contact-form-main .form-group {
    margin-bottom: 1.5rem;
}

.contact-form-main label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: #F9FAFB;
    outline: none;
    min-height: 120px;
    font-family: inherit;
}

.form-textarea:focus {
    border-color: var(--primary-color);
    background: white;
}

/* Blink Animation for Price Updates */
@keyframes blinkEffect {
    0% {
        /* Soft Gold Background */
        color: #b45309;
        /* Darker Orange Text for contrast */
        border-radius: 4px;
    }

    100% {
        background-color: transparent;
        color: inherit;
    }
}

.blink-update {
    animation: blinkEffect 1.5s ease-out;
    /* Slightly faster, ease-out for immediate flash */
    padding: 2px 6px;
    /* Add padding so background looks like a badge */
    margin: -2px -6px;
    /* Negative margin to prevent layout shift */
    border-radius: 4px;
    display: inline-block;
    /* Ensure transform/padding works */
}

/* Fix Status Indicator Mobile Wrap */
.status-indicator {
    white-space: nowrap;
}