/**
 * SIGMIX - All Stocks Page Styles
 * /css/stocks.css
 */

/* ========================================
   UTILITIES
======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

.hidden {
    display: none !important;
}

.up { color: #059669 !important; }
.down { color: #DC2626 !important; }

/* ========================================
   HEADER SPACER
======================================== */
.header-spacer {
    height: 70px;
}

/* ========================================
   SECONDARY NAVIGATION
======================================== */
.secondary-nav {
    background: var(--off-white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 70px;
    z-index: 100;
}

.secondary-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.secondary-nav-container::-webkit-scrollbar {
    display: none;
}

.secondary-nav a {
    color: var(--gray);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.secondary-nav a:hover,
.secondary-nav a:focus,
.secondary-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========================================
   PAGE HEADER
======================================== */
.page-header {
    padding: 2rem 0 1.5rem;
    background: var(--off-white);
    border-bottom: 1px solid var(--gray-200);
}

.page-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.page-header-text h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.25rem;
    line-height: 1.2;
}

.page-header-text h1 span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header-text p {
    font-size: 0.95rem;
    color: var(--gray);
    max-width: 500px;
}

.page-header-text p a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.page-header-text p a:hover {
    text-decoration: underline;
}

.page-header-text .last-updated {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.page-header-text .last-updated i {
    color: var(--primary);
}

.header-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-stat {
    text-align: center;
    padding: 0.75rem 1.25rem;
    background: var(--white);
    border-radius: 12px;
    border: 1px solid var(--gray-200);
    min-width: 85px;
}

.header-stat strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.header-stat strong.accent { color: var(--accent); }
.header-stat strong.up { color: #059669; }
.header-stat strong.down { color: #DC2626; }

.header-stat span {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   MARKET PULSE BAR
======================================== */
.market-pulse-bar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 0.75rem 0;
}

.pulse-items {
    display: flex;
    justify-content: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.pulse-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--white);
}

.pulse-label {
    font-size: 0.8rem;
    opacity: 0.8;
}

.pulse-value {
    font-weight: 700;
    font-size: 0.9rem;
}

.pulse-value.up { color: #6ee7b7; }
.pulse-value.down { color: #fca5a5; }

/* ========================================
   FILTERS SECTION
======================================== */
.filters-section {
    background: var(--white);
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 118px;
    z-index: 90;
}

.filters-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
}

.filter-input {
    padding: 0.6rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--white);
}

.filter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-select {
    min-width: 160px;
    cursor: pointer;
}

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.search-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
    font-size: 0.85rem;
}

.search-input {
    width: 100%;
    padding-left: 2.5rem;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.clear-filters {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    background: var(--gray-200);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s;
}

.clear-filters:hover {
    background: var(--gray);
    color: var(--white);
}

.filter-summary {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--gray);
}

.filter-summary strong {
    color: var(--primary);
    font-weight: 700;
}

/* ========================================
   MAIN CONTENT
======================================== */
.stocks-content {
    padding: 1.5rem 0 3rem;
    background: var(--white);
}

/* ========================================
   VIEW CONTROLS
======================================== */
.view-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.view-toggle {
    display: flex;
    gap: 0.25rem;
    background: var(--off-white);
    padding: 0.25rem;
    border-radius: 8px;
}

.view-btn {
    padding: 0.5rem 0.75rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray);
    transition: all 0.2s;
}

.view-btn:hover {
    color: var(--primary);
}

.view-btn.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sort-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray);
}

.sort-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    background: var(--white);
}

.sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ========================================
   STOCKS TABLE
======================================== */
.stocks-table-wrapper {
    overflow-x: auto;
}

.stocks-table {
    width: 100%;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    border-collapse: collapse;
}

.stocks-table th {
    background: var(--primary);
    color: var(--white);
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stocks-table th:first-child {
    border-radius: 16px 0 0 0;
}

.stocks-table th:last-child {
    border-radius: 0 16px 0 0;
}

.stocks-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
    vertical-align: middle;
}

.stocks-table tbody tr:last-child td {
    border-bottom: none;
}

.stocks-table tbody tr:hover td {
    background: var(--off-white);
}

.stock-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.stock-logo-sm {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--off-white);
    border: 1px solid var(--gray-200);
}

.stock-logo-sm img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stock-name-cell strong {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
}

.stock-name-cell span {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    font-family: monospace;
}

.price-cell {
    font-weight: 700;
}

.change-cell {
    font-weight: 700;
}

.change-cell.up { color: #059669; }
.change-cell.down { color: #DC2626; }

.sector-link {
    color: var(--gray);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.sector-link:hover {
    color: var(--primary);
}

.trend-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.trend-badge.trend-uptrend {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.trend-badge.trend-downtrend {
    background: rgba(239, 68, 68, 0.15);
    color: #DC2626;
}

.trend-badge.trend-sideways,
.trend-badge.trend-n\/a {
    background: var(--gray-200);
    color: var(--gray);
}

.shariah-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
}

.view-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    transition: gap 0.2s ease;
}

.view-link:hover {
    text-decoration: underline;
    gap: 0.6rem;
}

/* ========================================
   MOBILE LIST VIEW
======================================== */
.stocks-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stock-mobile-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.stock-mobile-card:hover {
    border-color: var(--primary);
}

.stock-mobile-logo img {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: var(--off-white);
}

.stock-mobile-info {
    flex: 1;
    min-width: 0;
}

.stock-mobile-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stock-mobile-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.2rem;
}

.stock-mobile-symbol {
    font-size: 0.7rem;
    color: var(--primary);
    font-weight: 700;
    font-family: monospace;
}

.shariah-tag {
    font-size: 0.6rem;
    color: var(--accent);
    font-weight: 600;
}

.stock-mobile-price {
    text-align: right;
}

.stock-mobile-price .price {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    display: block;
}

.stock-mobile-price .change {
    font-size: 0.8rem;
    font-weight: 700;
}

.stock-mobile-price .change.up { color: #059669; }
.stock-mobile-price .change.down { color: #DC2626; }

/* ========================================
   GRID VIEW
======================================== */
.stocks-grid {
    display: none;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.stocks-grid.active {
    display: grid;
}

.stock-card {
    display: block;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 16px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
}

.stock-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(7, 0, 120, 0.12);
}

.shariah-indicator {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 0.65rem;
}

.stock-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stock-logo-card {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--off-white);
    border: 1px solid var(--gray-200);
}

.stock-logo-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stock-card-symbol {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
    font-family: monospace;
}

.stock-card-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--dark);
}

.stock-card-price {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.card-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
}

.card-change {
    font-size: 0.9rem;
    font-weight: 700;
}

.card-change.up { color: #059669; }
.card-change.down { color: #DC2626; }

.stock-card-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--gray-200);
}

.stock-card-sector {
    font-size: 0.75rem;
    color: var(--gray);
}

/* ========================================
   NO RESULTS
======================================== */
.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray);
}

.no-results i {
    font-size: 3rem;
    opacity: 0.4;
    margin-bottom: 1rem;
}

.no-results h3 {
    font-size: 1.25rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

/* ========================================
   PAGINATION
======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--gray-200);
    border-radius: 8px;
    background: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0 0.5rem;
    color: var(--gray);
}

/* ========================================
   CTA SECTION
======================================== */
.cta-section {
    padding: 3rem 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

.cta-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.cta-text {
    color: var(--white);
}

.cta-text h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.cta-text p {
    font-size: 0.95rem;
    opacity: 0.9;
}

.cta-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cta-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--white);
    color: var(--primary);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.cta-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.cta-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: transparent;
    color: var(--white);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.cta-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--white);
}

/* ========================================
   RESPONSIVE
======================================== */
@media (min-width: 768px) {
    .stocks-mobile-list {
        display: none;
    }
    
    .stocks-table-wrapper {
        display: block;
    }
}

@media (max-width: 767px) {
    .stocks-mobile-list {
        display: flex;
    }
    
    .stocks-table-wrapper {
        display: none !important;
    }
    
    .stocks-grid {
        grid-template-columns: 1fr;
    }
    
    .view-toggle {
        display: none;
    }
}

@media (max-width: 768px) {
    .secondary-nav-container {
        padding: 0.75rem 1.5rem;
        gap: 1.5rem;
    }
    
    .page-header-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .page-header-text .last-updated {
        justify-content: center;
    }
    
    .page-header-text p {
        max-width: 100%;
    }
    
    .header-stats {
        justify-content: center;
    }
    
    .filters-section {
        position: static;
    }
    
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .pulse-items {
        gap: 1.5rem;
    }
    
    .cta-inner {
        flex-direction: column;
        text-align: center;
    }
    
    .cta-buttons {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-stats {
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .header-stat {
        flex: 1;
        min-width: 75px;
        padding: 0.6rem 0.75rem;
    }
    
    .header-stat strong {
        font-size: 1.25rem;
    }
    
    .cta-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .cta-btn-primary,
    .cta-btn-secondary {
        justify-content: center;
    }
}

/* ========================================
   PRINT STYLES
======================================== */
@media print {
    .secondary-nav,
    .market-pulse-bar,
    .filters-section,
    .view-controls,
    .pagination,
    .cta-section {
        display: none;
    }
    
    .stocks-table {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}


/* ========================================
   CLICKABLE STOCK CELL
======================================== */
a.stock-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

a.stock-cell:hover {
    opacity: 0.8;
}

a.stock-cell:hover strong {
    color: var(--primary);
    text-decoration: underline;
}