/* ============ BASE STYLES ============ */
:root {
    --primary: #4361ee;
    --primary-dark: #3a56d4;
    --secondary: #6c757d;
    --success: #4cc9f0;
    --warning: #f8961e;
    --danger: #f94144;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --light-gray: #e9ecef;
    --dark-gray: #495057;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.05);
    --transition: all 0.2s ease-in-out;
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #4895ef;
        --primary-dark: #3a7bd5;
        --light: #212529;
        --dark: #f8f9fa;
        --light-gray: #343a40;
        --dark-gray: #adb5bd;
    }
}

/* Base styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ============ HEADER STYLES ============ */
.main-header {
    background: linear-gradient(135deg, #4361ee, #3f37c9);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.header-content {
    text-align: center;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
    margin-right: 0.75rem;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: white;
}

.header-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
}

/* ============ SEARCH & FILTERS ============ */
.search-section {
    background-color: white;
    padding: 1.25rem;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.filter-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--gray);
}

.timeframe-filter .btn-group {
    box-shadow: var(--box-shadow);
}

.timeframe-filter .btn {
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
}

.search-box {
    position: relative;
}

.search-box .input-group-text {
    background-color: white;
    border-right: none;
}

.search-box .form-control {
    border-left: none;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.search-box .btn {
    font-size: 0.875rem;
    font-weight: 500;
}

.search-feedback {
    font-size: 0.8125rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

/* High Yield Filter Button */
.btn-high-yield {
    background-color: rgba(76, 201, 240, 0.1);
    color: var(--success);
    border: 1px solid rgba(76, 201, 240, 0.3);
    font-weight: 500;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-high-yield:hover {
    background-color: rgba(76, 201, 240, 0.2);
    color: var(--success);
    border-color: rgba(76, 201, 240, 0.4);
}

.btn-high-yield.active {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

.high-yield-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--success);
    margin-right: 8px;
}

.btn-high-yield.active .high-yield-indicator {
    background-color: white;
}

/* Status Indicators */
.status-indicators .badge {
    font-size: 0.8125rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 50rem;
    display: inline-flex;
    align-items: center;
}

/* Sponsored Card */
.sponsored-card .card {
    border: none;
    box-shadow: var(--box-shadow);
}

.sponsored-badge {
    background-color: var(--success);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    display: inline-block;
}

/* ============ TABLE STYLES ============ */
.table-section {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* ============ UPDATED TABLE TITLE STYLES ============ */
.table-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #212529; /* Dark gray for light mode */
    padding: 0.5rem 0;
    line-height: 1.2;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .table-title {
        color: #f8f9fa !important; /* Light color for dark mode */
    }
}

/* Additional context styles */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #dee2e6; /* Light border */
    padding-bottom: 0.5rem;
}

/* Dark mode border adjustment */
@media (prefers-color-scheme: dark) {
    .table-header {
        border-bottom-color: #495057; /* Darker border for dark mode */
    }
}

.last-updated {
    font-size: 0.875rem;
    color: var(--gray);
}

#stocks-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: separate;
    border-spacing: 0;
}

#stocks-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: var(--gray);
    padding: 0.75rem 1rem;
    background-color: var(--light);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--light-gray);
}

#stocks-table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--light-gray);
    transition: var(--transition);
}

#stocks-table tbody tr:last-child td {
    border-bottom: none;
}

#stocks-table tbody tr:hover {
    background-color: rgba(67, 97, 238, 0.03);
}

/* Column widths */
.symbol-col { width: 8%; min-width: 80px; }
.company-col { width: 22%; min-width: 150px; }
.sector-col { width: 12%; min-width: 100px; }
.ex-date-col { width: 12%; min-width: 110px; }
.pay-date-col { width: 10%; min-width: 90px; }
.price-col { width: 8%; min-width: 80px; }
.yield-col { width: 8%; min-width: 80px; }
.amount-col { width: 10%; min-width: 90px; }
.freq-col { width: 10%; min-width: 70px; }

/* Highlight high yield rows */
.high-yield {
    position: relative;
}

.high-yield::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--success);
    border-radius: 0 4px 4px 0;
}

/* ============ SECTOR TAGS ============ */
.sector-tags .card {
    border: none;
    box-shadow: var(--box-shadow);
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.sector-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--gray);
    background-color: var(--light);
    border-radius: 50rem;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
    border: 1px solid var(--light-gray);
}

.sector-tag:hover {
    background-color: var(--light-gray);
    color: var(--dark);
}

.sector-tag.active {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ============ PAGINATION ============ */
.pagination-section {
    margin-bottom: 2rem;
}

.pagination {
    --bs-pagination-padding-x: 0.75rem;
    --bs-pagination-padding-y: 0.5rem;
    --bs-pagination-font-size: 0.875rem;
    --bs-pagination-color: var(--gray);
    --bs-pagination-border-width: 0;
    --bs-pagination-border-radius: 0.375rem;
    --bs-pagination-hover-color: var(--primary);
    --bs-pagination-hover-bg: var(--light);
    --bs-pagination-focus-box-shadow: none;
}

.page-item.active .page-link {
    background-color: var(--primary);
    color: white;
}

/* ============ FOOTER STYLES ============ */
.main-footer {
    background-color: var(--light);
    border-top: 1px solid var(--light-gray);
    padding: 2rem 0;
    color: var(--gray);
    font-size: 0.875rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.footer-links a {
    color: var(--gray);
}

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

.footer-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-copyright {
    text-align: center;
    color: var(--gray);
}

/* ============ LOADING & ERROR STATES ============ */
#loading-spinner {
    padding: 3rem 0;
}

#error-message {
    font-size: 0.875rem;
    border-radius: var(--border-radius);
}

#no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
}

/* ============ RESPONSIVE ADJUSTMENTS ============ */
@media (max-width: 992px) {
    .main-header {
        padding: 1.5rem 0;
    }
    
    .site-title {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        font-size: 0.875rem;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 768px) {
    #stocks-table {
        display: block;
        overflow-x: auto;
    }
    
    .search-section .row > div {
        margin-bottom: 1rem;
    }
    
    .search-section .row > div:last-child {
        margin-bottom: 0;
    }
}

@media (max-width: 576px) {
    .main-header {
        padding: 1.25rem 0;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    .site-title {
        font-size: 1.25rem;
    }
    
    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
    }
    
    /* Mobile table styles */
    #stocks-table thead {
        display: none;
    }
    
    #stocks-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--light-gray);
        border-radius: var(--border-radius);
        padding: 1rem;
    }
    
    #stocks-table tbody tr td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
    }
    
    #stocks-table tbody tr td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 1rem;
        color: var(--gray);
        flex: 0 0 100px;
    }
    
    #stocks-table tbody tr td > span {
        flex: 1;
        text-align: right;
    }
    
    /* Hide frequency column on very small screens */
    #stocks-table tbody tr td:nth-child(9) {
        display: none;
    }
}

/* ============ FILTER BAR ALIGNMENT FIX ============ */
.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.timeframe-filter {
    flex: 1;
    min-width: 250px;
}

.search-box {
    flex: 2;
    min-width: 300px;
}

.high-yield-filter-container {
    flex: 1;
    min-width: 150px;
}

@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
    }
    
    .timeframe-filter,
    .search-box,
    .high-yield-filter-container {
        width: 100%;
        min-width: auto;
    }
}


/* Responsive table */
@media (max-width: 768px) {
    #stocks-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    #stocks-table th, 
    #stocks-table td {
        white-space: nowrap;
    }
}

/* ============ HIGH YIELD STYLE FIX ============ */
.high-yield {
    background-color: rgba(76, 201, 240, 0.08) !important; /* Light blue background */
    border-left: 3px solid var(--success); /* Left border instead of vertical line */
}

/* Remove any previous high-yield indicator styles */
.high-yield::before {
    content: none !important;
}

/* Ensure cells maintain alignment */
#stocks-table td {
    position: static !important;
    padding-left: 0.5rem !important;
}

/* ============ TABLE COLUMN ALIGNMENT ============ */
#stocks-table {
    table-layout: fixed;
}

#stocks-table th,
#stocks-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Column Widths */
.symbol-col { width: 90px; }
.company-col { width: 260px; }
.sector-col { width: 100px; }
.ex-date-col { width: 170px; } /* Wider ex-date column */
.pay-date-col { width: 100px; }
.price-col { width: 90px; }
.yield-col { width: 90px; }
.amount-col { width: 110px; }
.freq-col { width: 70px; }

/* Right alignment for numeric columns */
.text-end {
    text-align: right !important;
    padding-right: 1rem !important;
}

