/* css/blog2.css - Dynamic Components (Responsive & Deep Blue Tech Style) */

/* --- 1. ARTICLE FEED --- */
.article-feed-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.article-preview {
    display: flex;
    flex-direction: row;
    /* Default: Side by side */
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.article-preview:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: var(--primary-blue);
}

.article-preview .preview-image {
    flex: 0 0 250px;
    /* Fixed width on desktop */
    position: relative;
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.article-preview .preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.article-preview:hover .preview-image img {
    transform: scale(1.05);
}

.article-preview .preview-text {
    padding: 25px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.article-preview h3 {
    margin-top: 0;
    margin-bottom: 10px;
}

.article-preview h3 a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.3;
}

.article-preview h3 a:hover {
    color: var(--primary-blue);
}

.preview-content {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    /* Limit text lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.read-more:hover {
    text-decoration: underline;
}

/* Full Article View */
.full-article img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.full-article {
    color: var(--text-main);
    font-size: 1.1rem;
    line-height: 1.8;
}

.full-article .article-meta {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
}

/* --- 2. MARKET DATA PAGE (The Table & Boxes) --- */
.stock-section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 1.3rem;
    color: var(--primary-blue);
    font-weight: 800;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* -- UPDATED: CSS GRID for Stock Boxes -- */
.stock-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 15px;
}

.stock-box {
    background: var(--bg-card);
    /* White card */
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stock-box:hover {
    transform: translateY(-3px);
    border-color: var(--primary-blue);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stock-box div:first-child {
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.stock-box.positive {
    color: var(--success-green);
}

.stock-box.negative {
    color: var(--danger-red);
}

/* -- UPDATED: Responsive Table Styling -- */
.stock-section-table {
    width: 100%;
    overflow-x: auto;
    /* Allow horizontal scroll */
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll iOS */
    max-height: 500px;
    transition: max-height 0.5s ease-in-out;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    position: relative;
}

.stock-section-table.show-full-table {
    max-height: 5000px;
    /* Expand transition */
}

#allStocksTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    /* Ensures table doesn't squash, forces scroll on mobile */
    color: var(--text-main);
}

#allStocksTable th {
    background-color: var(--bg-secondary);
    color: var(--primary-blue);
    padding: 14px 15px;
    text-align: left;
    font-size: 0.9rem;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    /* Keeps header visible while scrolling */
    top: 0;
    z-index: 10;
}

#allStocksTable td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
}

#allStocksTable tr:hover {
    background-color: var(--bg-input);
}

/* Stock search input */
#searchBox {
    width: 100%;
    padding: 14px;
    margin-bottom: 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 1rem;
}

#searchBox:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: #fff;
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.table-show-more-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 15px;
    background-color: var(--bg-secondary);
    color: var(--primary-blue);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    text-transform: uppercase;
    transition: all 0.2s;
}

.table-show-more-btn:hover {
    background-color: var(--primary-blue);
    color: #fff;
}

/* --- 3. SIDEBAR WIDGETS --- */
.market-prices-box {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

#prices {
    font-family: 'Consolas', 'Courier New', monospace;
    background: #0f172a;
    /* Dark Terminal background */
    color: #10b981;
    border-radius: 6px;
    padding: 15px;
    width: 100%;
    border: 1px solid #334155;
}

.price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 12px 0;
    font-size: 1rem;
    border-bottom: 1px dashed #334155;
    padding-bottom: 8px;
}

.price-row:last-child {
    border-bottom: none;
}

.symbol {
    font-weight: bold;
    color: var(--text-main);
}

.price-value {
    color: var(--text-main);
    font-weight: bold;
    margin-right: 8px;
}

.change {
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.change.up {
    color: #10b981;
    background: rgba(16, 185, 129, 0.15);
}

.change.down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 10px;
}

.social-img {
    width: 40px;
    /* Ensure size consistency */
    height: 40px;
    transition: all 0.3s;
}

.social-img:hover {
    transform: scale(1.1);
}

/* --- 4. AD PLACEMENTS (Dark Mode Integration) --- */
.ad-placeholder {
    width: 100%;
    background-color: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    text-align: center;
    font-size: 0.8rem;
    display: none;
    /* Hidden by default */
}

/* Specific Sizes */
#header-ad-slot,
#footer-ad-slot {
    min-height: 90px;
    max-width: 728px;
    margin: 20px auto;
}

#sidebar-ad-slot {
    min-height: 250px;
    max-width: 300px;
    margin: 0 auto;
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {

    /* Stack Article Preview */
    .article-preview {
        flex-direction: column;
    }

    .article-preview .preview-image {
        width: 100%;
        flex: 0 0 200px;
        /* Fixed height for mobile image */
    }

    /* Ads Resize */
    #header-ad-slot,
    #footer-ad-slot {
        min-height: 50px;
        width: 100%;
    }

    /* Make table text slightly smaller on mobile for density */
    #allStocksTable td,
    #allStocksTable th {
        padding: 10px;
        font-size: 0.85rem;
    }
}