/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    color: #000000;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    font-size: 48px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.trading-mode {
    color: #ff0000;
}

.version {
    font-size: 12px;
    font-weight: 400;
    color: #999999;
    margin-bottom: 8px;
}

/* Feature list */
.feature-list {
    list-style: none;
    font-size: 13px;
    color: #666666;
    margin: 12px 0;
    opacity: 1;
    transition: opacity 1s ease;
    text-align: left;
    display: inline-block;
}

.feature-list li {
    margin: 4px 0;
}

.feature-list li:before {
    content: "• ";
    font-weight: 600;
}

.feature-list.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Refresh indicator */
.refresh-indicator {
    width: 20px;
    height: 20px;
    margin: 8px auto 0;
    border: 2px solid #e5e5e5;
    border-top: 2px solid #000000;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.1s ease;
}

.refresh-indicator.active {
    opacity: 1;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.subtitle {
    font-size: 18px;
    font-weight: 400;
    color: #666666;
}

/* Controls */
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    margin-bottom: 20px;
}

.btn {
    background: #000000;
    color: #ffffff;
    border: none;
    padding: 12px 32px;
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    background: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.status {
    font-size: 14px;
    color: #666666;
}

/* Table */
.table-container {
    overflow-x: auto;
    border: 1px solid #000000;
    border-radius: 8px;
    width: fit-content;
    margin: 0 auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* Firefox */
}

table {
    width: auto;
    border-collapse: collapse;
    table-layout: auto;
    margin: 0 auto;
}

thead {
    background: #000000;
    color: #ffffff;
}

th {
    padding: 16px 8px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid #e5e5e5;
    transition: background 0.15s ease;
}

/* Only show hover effect on devices with hover capability (not touch) */
@media (hover: hover) and (pointer: fine) {
    tbody tr:hover {
        background: #f5f5f5;
    }

    .news-link:hover {
        opacity: 0.5;
    }

    .btn:hover {
        background: #333333;
        transform: translateY(-1px);
    }
}

/* Touch-friendly active states */
@media (hover: none) and (pointer: coarse) {
    tbody tr:active {
        background: #f5f5f5;
    }

    .news-link:active {
        opacity: 0.5;
    }

    .btn:active {
        background: #333333;
    }
}

tbody tr:last-child {
    border-bottom: none;
}

td {
    padding: 16px 8px;
    font-size: 15px;
    white-space: nowrap;
}

td:first-child {
    font-weight: 600;
}

.loading {
    text-align: center;
    color: #666666;
    font-style: italic;
}

.positive {
    color: #000000;
    font-weight: 600;
}

.negative {
    color: #666666;
}

.news-link {
    color: #000000;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.news {
    text-align: center;
    font-size: 18px;
}

.no-news {
    color: #999999;
    font-weight: 400;
}

/* Footer */
footer {
    margin-top: 30px;
    text-align: center;
}

.last-update {
    font-size: 14px;
    color: #666666;
}

.turbo-mode {
    font-size: 12px;
    color: #ff0000;
    font-weight: 600;
    padding: 8px 0;
}

.news-status {
    font-size: 12px;
    color: #999999;
    font-weight: 400;
    padding: 8px 0;
}

/* Responsive Design */

/* Tablet and smaller desktop (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
        padding: 24px 16px;
    }

    h1 {
        font-size: 40px;
    }

    .table-container {
        width: 100%;
        border-radius: 6px;
    }

    th, td {
        padding: 14px 6px;
        font-size: 14px;
    }
}

/* Mobile landscape and tablet portrait (481px - 768px) */
@media (max-width: 768px) {
    .container {
        padding: 20px 12px;
    }

    h1 {
        font-size: 32px;
        letter-spacing: -0.01em;
    }

    .version {
        font-size: 11px;
    }

    .feature-list {
        font-size: 12px;
        max-width: 90%;
    }

    .feature-list li {
        margin: 3px 0;
    }

    .table-container {
        border-radius: 4px;
        margin: 0 -12px;
        width: calc(100% + 24px);
        border-left: none;
        border-right: none;
    }

    table {
        width: 100%;
        font-size: 13px;
    }

    th {
        padding: 12px 6px;
        font-size: 11px;
        letter-spacing: 0.01em;
    }

    td {
        padding: 12px 6px;
        font-size: 13px;
    }

    /* Abbreviate long headers on mobile */
    .market-cap-header::before {
        content: "Mkt Cap";
    }
    .market-cap-header {
        font-size: 0;
    }
    .market-cap-header::before {
        font-size: 11px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }

    .news-status {
        font-size: 11px;
        padding: 6px 0;
    }

    footer {
        margin-top: 20px;
    }
}

/* Mobile portrait (320px - 480px) */
@media (max-width: 480px) {
    .container {
        padding: 16px 8px;
    }

    h1 {
        font-size: 28px;
        margin-bottom: 3px;
    }

    .version {
        font-size: 10px;
        margin-bottom: 6px;
    }

    .feature-list {
        font-size: 11px;
        margin: 8px 0;
    }

    .feature-list li {
        margin: 2px 0;
    }

    .refresh-indicator {
        width: 16px;
        height: 16px;
        margin: 6px auto 0;
    }

    .table-container {
        margin: 0 -8px;
        width: calc(100% + 16px);
        border-radius: 0;
    }

    table {
        font-size: 12px;
    }

    th {
        padding: 10px 4px;
        font-size: 10px;
    }

    td {
        padding: 10px 4px;
        font-size: 12px;
    }

    /* Compact column spacing */
    td:first-child {
        padding-left: 8px;
        font-weight: 600;
    }

    td:last-child {
        padding-right: 8px;
    }

    /* Abbreviate headers for very small screens */
    th {
        font-size: 0;
    }

    th::before {
        font-size: 10px;
    }

    th:nth-child(1)::before { content: "Sym"; }
    th:nth-child(2)::before { content: "PM%"; }
    th:nth-child(3)::before { content: "Price"; }
    th:nth-child(4)::before { content: "Float"; }
    th:nth-child(5)::before { content: "Cap"; }
    th:nth-child(6)::before { content: "Op%"; }
    th:nth-child(7)::before { content: "News"; }

    .market-cap {
        border-right: 1px solid #cccccc;
        padding-right: 8px;
    }

    .change-from-open {
        padding-left: 8px;
    }

    .news-link {
        font-size: 16px;
    }

    .news-status {
        font-size: 10px;
        padding: 4px 0;
    }

    footer {
        margin-top: 16px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* Extra small mobile (below 360px) */
@media (max-width: 360px) {
    h1 {
        font-size: 24px;
    }

    .feature-list {
        font-size: 10px;
    }

    table {
        font-size: 11px;
    }

    th {
        padding: 8px 3px;
    }

    th::before {
        font-size: 9px;
    }

    td {
        padding: 8px 3px;
        font-size: 11px;
    }

    td:first-child {
        padding-left: 6px;
    }

    td:last-child {
        padding-right: 6px;
    }

    .news-link {
        font-size: 14px;
    }
}

/* Number formatting */
.price {
    font-variant-numeric: tabular-nums;
}

.change-positive {
    color: #000000;
    font-weight: 600;
}

.change-negative {
    color: #999999;
}

.market-cap {
    font-variant-numeric: tabular-nums;
    border-right: 2px solid #cccccc;
    padding-right: 16px;
}

.market-cap-header {
    padding-right: 16px;
}


/* Wide columns - removed fixed padding to allow natural spacing */

/* Premarket change column */
.premarket-change {
    white-space: nowrap;
}

/* Change from open column */
.change-from-open {
    white-space: nowrap;
    text-align: left;
    padding-left: 16px;
}

/* News column header alignment */
th.news-header {
    text-align: center;
}

/* Secret filter - hide filtered rows */
tr.filtered-out {
    display: none;
}

/* Gray out rows in 8-10% range when trading mode is active */
tr.grayed-out {
    opacity: 0.3;
}
