/* Import the main site styles */
@import url('../styles.css');

/* Override body styles for full-page layout */
body {
    margin: 0;
    padding: 2rem;
    overflow-x: hidden;
    width: 100vw;
    min-height: 100vh;
    background: var(--primary-color);
    box-sizing: border-box;
    font-family: Georgia, 'Times New Roman', Times, serif;
    /* border: 5px solid red !important;  REMOVE DEBUG BORDER */
}

/* Remove grid background for this page */
body::before {
    display: none;
}

/* Header section */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--secondary-color) 20%, transparent);
    margin-bottom: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.stats {
    display: flex;
    gap: 2rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--secondary-color);
}

.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--hover-glow);
    box-shadow: 0 0 10px var(--glow-color);
}

/* Main title */
.main-title {
    font-size: var(--font-size-h1);
    font-family: inherit;
    color: var(--secondary-color);
    text-align: center;
    margin: 2rem 0;
    font-weight: bold;
    letter-spacing: 1px;
}

/* Sub header */
.sub-header {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.stats-small {
    display: flex;
    gap: 2rem;
    font-family: inherit;
    font-size: 0.85rem;
    color: color-mix(in srgb, var(--secondary-color) 80%, transparent);
}

/* Ranking tabs */
.ranking-tabs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.tab-label {
    font-family: inherit;
    color: var(--secondary-color);
    margin-right: 1rem;
    font-weight: bold;
}

.tab {
    background: transparent;
    border: 1px solid color-mix(in srgb, var(--secondary-color) 30%, transparent);
    color: var(--secondary-color);
    padding: 0.5rem 1rem;
    border-radius: 1.5rem;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.tab.active {
    background: var(--secondary-color);
    color: var(--primary-color);
    border-color: var(--secondary-color);
}

.tab:hover:not(.active) {
    background: var(--hover-glow);
    border-color: var(--secondary-color);
}

/* Table container */
.table-container {
    overflow-x: auto;
    border: 1px solid color-mix(in srgb, var(--secondary-color) 20%, transparent);
    border-radius: 0.5rem;
    background: var(--primary-color);
    margin-top: 2rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Table styles */
.companies-table {
    width: 100%;
    border-collapse: collapse;
    font-family: inherit;
    color: var(--secondary-color);
    table-layout: fixed;
}

.companies-table thead {
    background: color-mix(in srgb, var(--secondary-color) 5%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--secondary-color) 20%, transparent);
}

.companies-table th {
    padding: 1rem;
    text-align: left;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--secondary-color);
    cursor: pointer;
    transition: background 0.3s ease;
}

.companies-table th:hover {
    background: color-mix(in srgb, var(--secondary-color) 10%, transparent);
}

.companies-table th i {
    margin-left: 0.5rem;
    opacity: 0.6;
}

/* Table rows */
.company-row {
    border-bottom: 1px solid color-mix(in srgb, var(--secondary-color) 10%, transparent);
    transition: background 0.3s ease;
}

.company-row:hover {
    background: color-mix(in srgb, var(--secondary-color) 5%, transparent);
}

.company-row td {
    padding: 1rem;
    vertical-align: middle;
}

/* Table column widths - ensure proper alignment */
.rank-col { width: 80px; }
.name-col { width: 200px; }
.market-cap-col { width: 120px; }
.price-col { width: 100px; }
.today-col { width: 100px; }
.price-30-col { width: 100px; }
.chart-col { width: 100px; }

/* Rank column */
.rank {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    width: 100%;
}

/* Name column */
.company-name {
    font-weight: bold;
    font-size: 0.95rem;
}

/* Market cap column */
.market-cap {
    font-weight: bold;
    font-size: 0.95rem;
}

/* Price column */
.price {
    font-weight: bold;
    font-size: 0.95rem;
}

/* Today column */
.today {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: bold;
}

.today.negative {
    color: #ef4444;
}

.today.positive {
    color: #22c55e;
}

/* 30-day price change column */
.price-30-days {
    font-weight: bold;
    font-size: 0.9rem;
}

/* Chart column */
.chart {
    width: 80px;
}

.mini-chart {
    width: 80px;
    height: 30px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .stats {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .ranking-tabs {
        gap: 0.3rem;
    }
    
    .tab {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .companies-table th,
    .companies-table td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    .company-logo {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
    
    .chart {
        width: 60px;
    }
    
    .mini-chart {
        width: 60px;
        height: 25px;
    }
    
    .mini-chart svg {
        width: 60px;
        height: 25px;
    }
}

@media (max-width: 600px) {
    .main-title {
        font-size: 1.5rem;
    }
    
    .stats-small {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .table-container {
        font-size: 0.75rem;
    }
    
    /* Hide some columns on very small screens */
    .price-30-col,
    .price-30-days,
    .chart-col,
    .chart {
        display: none !important;
    }
    
    /* Ensure rank column is always visible */
    .rank-col {
        display: table-cell !important;
        width: 60px !important;
        min-width: 60px !important;
    }
    
    .rank {
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        font-weight: bold !important;
    }
}

/* Data warning styles */
.data-warning {
    background: color-mix(in srgb, #fbbf24 20%, var(--primary-color));
    border: 1px solid #fbbf24;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem auto 2rem auto;
    max-width: 1400px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    color: var(--secondary-color);
}

.data-warning i {
    color: #fbbf24;
    font-size: 1.1rem;
}

.data-warning .close-warning {
    background: transparent;
    border: none;
    color: var(--secondary-color);
    font-size: 1.2rem;
    cursor: pointer;
    margin-left: auto;
    padding: 0.2rem 0.5rem;
    border-radius: 0.2rem;
    transition: background 0.3s ease;
}

.data-warning .close-warning:hover {
    background: color-mix(in srgb, var(--secondary-color) 20%, transparent);
}

/* Fix column widths to prevent overlap */
.companies-table {
    table-layout: fixed !important;
    width: 100% !important;
}

/* Specific column widths */
.rank-col {
    width: 40px !important;
    max-width: 40px !important;
}

.name-col {
    width: 200px !important;
    min-width: 200px !important;
}

.market-cap-col {
    width: 100px !important;
}

.price-col {
    width: 90px !important;
}

.today-col {
    width: 80px !important;
}

.price-30-col {
    width: 80px !important;
}

.chart-col {
    width: 100px !important;
}

/* Prevent content overflow */
.companies-table th,
.companies-table td {
    border: none !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 0.5rem !important;
}

.rank {
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    font-weight: bold !important;
    width: 100% !important;
    max-width: 60px !important;
    overflow: hidden !important;
}

.company-info {
    width: 100% !important;
    max-width: 200px !important;
    overflow: hidden !important;
}

/* New Company Logos */
.jpmorgan-logo {
    background-color: #0E1B42;
}

.bofa-logo {
    background-color: #012169;
}

.jnj-logo {
    background-color: #0066B3;
}

.unh-logo {
    background-color: #1B4F9C;
}

.pg-logo {
    background-color: #003366;
}

.coca-cola-logo {
    background-color: #F40009;
}

.mcdonalds-logo {
    background-color: #FFC72C;
}

.amd-logo {
    background-color: #ED1C24;
}

.intel-logo {
    background-color: #0071C5;
}

.exxon-logo {
    background-color: #000000;
}

.chevron-logo {
    background-color: #E31837;
}

.walmart-logo {
    background-color: #0071DC;
}

.costco-logo {
    background-color: #005DAA;
}

.disney-logo {
    background-color: #113CCF;
}

.netflix-logo {
    background-color: #E50914;
}
