:root {
    --bg: rgba(255, 255, 255, 0.7);
    --surface: #ffffff;
    --primary: #0f172a;
    --accent: #2563eb;
    --buy: #16a34a;
    --sell: #dc2626;
    --text-main: #1e293b;
    --text-dim: #64748b;
    --border: #e2e8f0;
    --glass: rgba(255, 255, 255, 0.8);
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    /* background-image: radial-gradient(circle at top right, rgba(37, 99, 235, 0.05), transparent),
                      radial-gradient(circle at bottom left, rgba(22, 163, 74, 0.05), transparent); */
    color: var(--text-main);
    line-height: 150%;
    min-height: 100vh;
    padding: 2rem 1rem;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

.container h1 {
    font-size: 28px;
    font-family: var(--font);
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 20px;
}

header {
    margin-bottom: 3rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* Navigation Tabs */
.nav-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2.5rem;
    position: sticky;
    top: 1rem;
    z-index: 100;
    width: 100%;
}

.tabs-container {
    background: #f2f2f2;
    backdrop-filter: blur(12px);
    padding: 0;
    border-radius: 6px;
    /* border: 1px solid var(--border); */
    display: flex;
    gap: 0.25rem;
    /* box-shadow: var(--shadow); */
    max-width: 100%;
    flex-wrap: nowrap;
}

.tab-btn {
    padding: 20px 40px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: 0 0 auto;
}

/* .tab-btn:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.03);
} */

.tab-btn.active {
    background: var(--primary);
    color: #fff;
    /* box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2); */
}

/* Archive Dropdown Styles */
.archive-wrapper {
    position: relative;
    flex: 0 0 auto;
}

.archive-dropdown {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 1000000;
    min-width: 120px;
    padding: 0.5rem 0;
    display: none;
}

.archive-dropdown.show {
    display: block;
}

.archive-dropdown-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary);
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--border);
}

.archive-dropdown-item:last-child {
    border-bottom: none;
}

.archive-dropdown-item:hover {
    background: var(--bg);
}

/* Dealings List Layout */
.grid-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dealing-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0px;
    padding: 1.25rem 2rem;
    display: grid;
    grid-template-columns: 1.2fr 2fr 1.2fr 1.2fr 1.2fr 48px;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    /* box-shadow: 0 1px 3px rgba(0,0,0,0.05); */
}

/* .dealing-card:hover {
    transform: scale(1.005);
    border-color: var(--accent);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
} */

.card-date {
    color: var(--primary);
    font-size: 16px;
    font-weight: 500;
    /* text-transform: uppercase; */
    /* letter-spacing: 0.05em; */
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.type-badge-container {
    display: flex;
    justify-content: flex-start;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.buy-badge {
    background: var(--slider-background);
    color: var(--primary);
    border: 0px solid rgba(22, 163, 74, 0.1);
}

.buy-badge i {
    color: var(--buy);
}

.sell-badge {
    background: var(--slider-background);
    color: var(--primary);
    border: 0px solid rgba(220, 38, 38, 0.1);
}

.sell-badge i {
    color: var(--sell);
}

.card-metric {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.7rem;
    color: var(--primary);
    /* text-transform: uppercase; */
    margin-bottom: 2px;
    font-weight: 500;
}

.metric-value {
    font-family: var(--font);
    font-weight: 600;
    font-size: 1rem;
    color: var(--primary);
}

.view-btn {
    /* background: #f8fafc; */
    border: 0px solid var(--border);
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    justify-self: end;
    cursor: pointer;
}

/* .dealing-card:hover .view-btn {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
} */

/* Hidden data container */
#raw-html-source {
    display: none;
}

/* Mobile Responsive - FORCED SCROLL FIX */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .nav-wrapper {
        top: 0.5rem;
        margin-bottom: 1.5rem;
        width: 100%;
        overflow: visible;
        padding: 0;
    }
    
    .tabs-container {
        background: var(--glass);
        backdrop-filter: blur(12px);
        padding: 0.5rem;
        border-radius: 50px;
        border: 1px solid var(--border);
        display: flex;
        gap: 0.5rem;
        box-shadow: var(--shadow);
        
        /* CRITICAL - Force horizontal scroll */
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
        white-space: nowrap !important;
        flex-wrap: nowrap !important;
        
        /* Ensure container takes full width */
        width: 100%;
        max-width: 100%;
        
        /* Hide scrollbar but keep functionality */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .tabs-container::-webkit-scrollbar {
        display: none;
    }
    
    /* All buttons must NOT wrap */
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        display: inline-flex !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        width: auto !important;
    }
    
    /* Archive wrapper must NOT wrap */
    .archive-wrapper {
        display: inline-flex !important;
        flex: 0 0 auto !important;
        white-space: nowrap !important;
        position: relative;
    }
    
    .archive-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        display: inline-flex !important;
        align-items: center;
        gap: 4px;
        white-space: nowrap !important;
    }
    
    /* Visual indicator that there's more to scroll */
    /* .tabs-container::after {
        content: "&#9654";
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--text-dim);
        font-size: 0.8rem;
        padding: 0 0.5rem;
        opacity: 0.5;
        flex: 0 0 auto;
    } */
    
    .archive-dropdown {
        min-width: 100px;
    }
    
    .archive-dropdown-item {
        padding: 0.6rem 1.2rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .tab-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    .archive-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
    
    .dealing-card {
        padding: 1rem;
        gap: 1rem;
    }
}

@media (max-width: 360px) {
    .tab-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.7rem;
    }
    
    .archive-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.7rem;
    }
}

@media (max-width: 900px) {
    .dealing-card {
        grid-template-columns: 1fr 1fr auto;
        grid-template-areas: 
            "date date type"
            "name name name"
            "vol price btn";
        padding: 1.5rem;
        gap: 1rem;
    }

    .card-date { grid-area: date; }
    .type-badge-container { grid-area: type; justify-content: flex-end; }
    .card-name { grid-area: name; font-size: 1.25rem; white-space: normal; }
    .card-metric:nth-of-type(1) { grid-area: vol; }
    .card-metric:nth-of-type(2) { grid-area: price; text-align: right; }
    .view-btn { grid-area: btn; width: 40px; justify-self: end; }
}

@media (max-width: 325px) {
    .dealing-card {
        grid-template-columns: 1fr auto;
        grid-template-areas: 
            "date type"
            "name btn"
            "vol price";
        padding: 1.5rem;
        gap: 1rem;
    }

    .card-date { grid-area: date; }
    .type-badge-container { grid-area: type; justify-content: flex-end; }
    .card-name { grid-area: name; font-size: 1.25rem; white-space: normal; }
    .card-metric:nth-of-type(1) { grid-area: vol; }
    .card-metric:nth-of-type(2) { grid-area: price; text-align: right; }
    .view-btn { grid-area: btn; width: 40px; justify-self: end; }
}