/* Filter Bar Container - Renamed to avoid conflicts */
.cdc-nav-filter-container {
    display: flex !important;
    flex-wrap: nowrap !important; /* Force single row */
    flex-direction: row !important;
    gap: 10px !important; /* Slightly smaller gap */
    margin-bottom: 25px;
    align-items: center !important;
    padding: 5px 0;
    width: 100%;
    justify-content: center; /* Center buttons */
    overflow-x: auto !important; /* Enable scroll if needed */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Hide scrollbar Firefox */
}

.cdc-nav-filter-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar Chrome/Safari */
}

/* Filter Buttons - Renamed & Protected */
.cdc-nav-filter-chip {
    background: #ffffff !important; /* White background for inactive */
    border: 1px solid #0288d1 !important; /* Blue border requested */
    border-radius: 50px !important; /* Pill shape requested */
    padding: 8px 20px !important;
    font-size: 14px !important;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    transition: all 0.2s ease;
    color: #0288d1 !important; /* Blue text for inactive */
    font-family: inherit !important;
    font-weight: 600 !important;
    margin: 0 !important;
    text-decoration: none !important;
    line-height: 1.2 !important;
    outline: none !important;
    width: auto !important;
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    text-transform: none !important; /* Normal case usually looks better with pills */
}

/* Hover State */
.cdc-nav-filter-chip:hover {
    color: #01579b !important;
    border-color: #01579b !important;
    background-color: #f0f9ff !important; /* Very light blue tint on hover */
    transform: none !important;
    box-shadow: 0 2px 5px rgba(2, 136, 209, 0.15) !important;
}

/* Active State */
.cdc-nav-filter-chip.active {
    background: #0288d1 !important; /* Filled blue for active */
    color: #ffffff !important; /* White text for active */
    font-weight: 600 !important;
    border: 1px solid #0288d1 !important;
    border-radius: 50px !important; /* Keep pill shape */
    box-shadow: 0 4px 10px rgba(2, 136, 209, 0.3) !important;
}

.cdc-nav-filter-chip.active i {
    color: #ffffff !important;
}

/* Mobile Responsiveness for Filters */
@media (max-width: 768px) {
    .cdc-nav-filter-container {
        justify-content: flex-start; /* Align start on mobile for scroll */
        padding-left: 15px; /* Add some padding for scroll start */
        padding-right: 15px;
    }
}

/* Grid Layout */
.cdc-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important; /* Force 3 columns with minmax protection */
    gap: 25px;
    width: 100%;
    margin: 0 auto;
    overflow-x: hidden; /* Prevent horizontal scroll triggers */
}

/* AdSense Protection - Force ads to own row and handle various ad containers */
.cdc-grid > ins,
.cdc-grid > .adsbygoogle,
.cdc-grid > div[class*="google"],
.cdc-grid > iframe,
.cdc-grid > .google-auto-placed,
.cdc-grid > div[id*="google_ads_iframe"] {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin: 20px 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    display: block !important;
    height: auto !important;
    clear: both !important;
}

/* Hide ads specifically inside the load more container to prevent button obstruction */
.cdc-load-more-container .adsbygoogle,
.cdc-load-more-container .google-auto-placed,
.cdc-load-more-container ins {
    display: none !important;
}

/* Force first child reset to prevent theme interference */
.cdc-grid > .cdc-card:first-child,
.cdc-grid > .cdc-card:first-of-type {
    grid-column: auto !important;
    grid-row: auto !important;
    width: auto !important;
    height: 100% !important;
    margin: 0 !important;
    flex: none !important;
}

@media (max-width: 900px) {
    .cdc-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 600px) {
    .cdc-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    
    /* Extra protection for mobile first child */
    .cdc-grid > .cdc-card:first-child,
    .cdc-grid > .cdc-card:first-of-type {
        grid-column: 1 / -1 !important; /* Standard behavior for 1 col grid */
        width: 100% !important;
    }
    
    /* Ensure image container is strictly 16:9 on mobile for ALL cards including first */
    .cdc-card .cdc-card-image {
        padding-top: 56.25% !important;
        height: 0 !important;
        min-height: 0 !important;
        max-height: none !important;
    }
    
    .cdc-card .cdc-card-image img {
        height: 100% !important;
        width: 100% !important;
        min-height: 100% !important;
        max-height: 100% !important;
    }
}

/* Card Styles - Robust Design */
.cdc-card {
    background: #fff;
    border: 1px solid #03a9f4; /* Blue Border as requested */
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    box-sizing: border-box;
    min-width: 0 !important; /* Critical for Grid/Flex overflow protection */
}

.cdc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(3, 169, 244, 0.15); /* Blue-ish shadow */
    border-color: #0288d1;
}

/* Image */
.cdc-card .cdc-card-image,
.cdc-grid > .cdc-card:first-child .cdc-card-image,
.cdc-grid > .cdc-card:first-of-type .cdc-card-image {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16/9 !important; /* Modern Aspect Ratio */
    padding-top: 0 !important; /* Remove old padding hack */
    padding-bottom: 0 !important;
    overflow: hidden !important;
    background: #f5f8fa;
    border-bottom: 1px solid #f0f0f0;
    margin: 0 !important;
    flex: none !important; /* Prevent flex resizing */
    min-height: 0 !important;
    max-height: none !important;
}

.cdc-card .cdc-card-image img,
.cdc-grid > .cdc-card:first-child .cdc-card-image img,
.cdc-grid > .cdc-card:first-of-type .cdc-card-image img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.5s ease;
    max-width: 100% !important; /* Enforce max-width */
    max-height: 100% !important;
    min-width: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    display: block !important;
}

.cdc-card:hover .cdc-card-image img {
    transform: scale(1.05);
}

/* Content Container */
.cdc-card-content {
    padding: 12px 15px 15px 15px; /* Reduced top padding further */
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Title & Badge */
.cdc-card-title {
    margin: 0 0 6px 0; /* Reduced margin */
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
    color: #14171a;
    display: block;
}

.cdc-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.cdc-card-title a:hover {
    color: #03a9f4;
}

/* CRITICAL: Verified Badge Fix */
.cdc-verified-badge {
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    margin-left: 6px;
    position: relative;
    top: -1px;
}

.cdc-verified-badge svg {
    width: 24px !important;
    height: 24px !important;
    display: block;
    fill: #1d9bf0;
}

/* Info Row: Category & Reactions */
.cdc-card-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Vertically centered */
    margin-bottom: 12px;
    flex-wrap: nowrap; /* CRITICAL: Never wrap the row */
    gap: 15px;
}

.cdc-category-text {
    background: #f1f5f9;
    color: #475569;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 4px;
    text-decoration: none;
    letter-spacing: 0.5px;
    display: inline-block;
    
    /* Flex wrapping logic for text inside */
    white-space: nowrap; 
    text-align: left;
    flex: 0 1 auto; /* Don't grow, allow shrinking */
    width: fit-content; /* Only wrap content */
    max-width: 65%; /* Prevent overlapping with reactions */
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: auto;
}

.cdc-category-text:hover {
    background: #e2e8f0;
    color: #334155;
}

/* Reactions */
.cdc-reactions {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0; /* Never shrink */
    margin-left: 0;
}

.cdc-reaction-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    white-space: nowrap;
}

.cdc-reaction-btn:hover {
    color: #64748b;
    transform: scale(1.1);
}

.cdc-reaction-btn i {
    transition: transform 0.2s;
}

.cdc-reaction-btn:active i {
    transform: scale(0.8);
}

/* Like Active State */
.cdc-btn-like.active {
    color: #03a9f4; /* Blue for Like */
    font-weight: 700;
}

.cdc-btn-like.active i {
    transform: scale(1.2);
    animation: cdc-pop 0.3s ease;
}

/* Dislike Active State */
.cdc-btn-dislike.active {
    color: #ef4444; /* Red for Dislike */
    font-weight: 700;
}

.cdc-btn-dislike.active i {
    transform: scale(1.2);
    animation: cdc-pop 0.3s ease;
}

@keyframes cdc-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1.2); }
}

/* Excerpt */
.cdc-card-excerpt {
    font-size: 14px;
    color: #000000; /* Deep Black as requested */
    line-height: 1.6;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

/* Actions Footer */
.cdc-card-actions {
    margin-top: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 10px; /* Reduced padding */
    border-top: none; /* Removed border as requested */
}

.cdc-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    height: 40px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
}

/* Specific Button Colors - Requested: #03a9f4 */
.cdc-btn-save {
    background: #03a9f4; /* Light Blue */
    color: #fff;
    border: 1px solid #03a9f4;
}

.cdc-btn-save:hover {
    background: #0288d1;
    border-color: #0288d1;
}

.cdc-btn-save.saved {
    background: #025b82; /* Darker Blue for Saved */
    border-color: #025b82;
}

.cdc-btn-save i {
    margin-right: 6px;
}

.cdc-btn-visit {
    background: #03a9f4; /* Light Blue */
    color: #fff;
    border: 1px solid #03a9f4;
}

.cdc-btn-visit:hover {
    background: #0288d1;
    border-color: #0288d1;
}

.cdc-btn-visit i {
    margin-right: 6px;
}

.cdc-btn-download {
    background: #03a9f4; /* Same Blue theme */
    color: #fff;
    border: 1px solid #03a9f4;
}

.cdc-btn-download:hover {
    background: #0288d1;
    border-color: #0288d1;
}

.cdc-btn-download i {
    margin-right: 6px;
}

/* Load More Button */
.cdc-load-more-container {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 50px !important; /* Reduced from 150px */
    width: 100% !important;
    display: flex;
    flex-direction: column; /* CRITICAL: Stack vertically to prevent ads from appearing side-by-side */
    align-items: center;
    justify-content: center;
    clear: both; /* Clear any floats */
    float: none;
    position: relative;
    z-index: 10;
    padding-bottom: 20px; /* Reduced from 50px */
    overflow: visible; /* Allow shadow but keep layout */
}

/* Force specific spacing below the button specifically */
.cdc-load-more-container::after {
    content: "";
    display: block;
    width: 100%;
    height: 20px; /* Reduced from 50px */
    pointer-events: none;
}

@keyframes cdc-gradient-anim {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.cdc-load-more-btn {
    background: linear-gradient(270deg, #1e3a8a, #2563eb, #3b82f6, #60a5fa, #2563eb);
    background-size: 300% 300%;
    animation: cdc-gradient-anim 6s ease infinite;
    color: #fff;
    border: none;
    padding: 18px 40px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 90%;
    max-width: 500px;
}

.cdc-load-more-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.6);
}

/* Auth Modal Styles (Preserved) */
.cdc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.cdc-modal.active { opacity: 1; }
.cdc-modal-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}
.cdc-modal-content {
    background: #fff;
    width: 90%;
    max-width: 420px;
    border-radius: 16px;
    padding: 30px;
    position: relative;
    z-index: 100000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}
.cdc-modal.active .cdc-modal-content { transform: translateY(0); }
.cdc-modal-close {
    position: absolute;
    top: 15px; right: 15px;
    background: none; border: none;
    font-size: 24px; color: #999; cursor: pointer;
}
.cdc-modal-header { text-align: center; margin-bottom: 25px; }
.cdc-modal-header h3 { margin: 0 0 10px 0; font-size: 24px; color: #333; }
.cdc-modal-header p { margin: 0; color: #666; font-size: 15px; }
.cdc-social-login { margin-bottom: 20px; }
.cdc-google-btn {
    display: flex; align-items: center; justify-content: center; width: 100%;
    padding: 12px; border: 1px solid #ddd; border-radius: 8px;
    background: #fff; color: #333; font-weight: 500; text-decoration: none;
    gap: 10px; transition: background 0.2s;
}
.cdc-google-btn:hover { background: #f9f9f9; }
.cdc-google-btn img { width: 20px; height: 20px; }
.cdc-divider { display: flex; align-items: center; margin: 20px 0; color: #999; font-size: 14px; }
.cdc-divider::before, .cdc-divider::after { content: ''; flex: 1; height: 1px; background: #eee; }
.cdc-divider span { padding: 0 10px; }
.cdc-auth-tabs { display: flex; margin-bottom: 20px; border-bottom: 1px solid #eee; }
.cdc-tab-btn {
    flex: 1; background: none; border: none; padding: 10px;
    font-size: 16px; color: #666; cursor: pointer;
    border-bottom: 2px solid transparent; transition: all 0.2s;
}
.cdc-tab-btn.active { color: #333; border-bottom-color: #333; font-weight: 600; }
.cdc-tab-content { display: none; }
.cdc-tab-content.active { display: block; }
.cdc-input-group { margin-bottom: 15px; }
.cdc-input-group label { display: block; margin-bottom: 5px; font-size: 14px; font-weight: 500; color: #333; }
.cdc-input {
    width: 100%; padding: 10px 12px; border: 1px solid #ddd;
    border-radius: 8px; font-size: 15px; box-sizing: border-box;
}
.cdc-input:focus { border-color: #333; outline: none; }
.cdc-submit-btn {
    width: 100%; padding: 12px; background: #333; color: #fff;
    border: none; border-radius: 8px; font-size: 16px;
    font-weight: 600; cursor: pointer; transition: background 0.2s;
}
.cdc-submit-btn:hover { background: #000; }
.cdc-helper-text { font-size: 13px; color: #777; margin-bottom: 15px; }

/* Single Post Vote Section */
.cdc-single-vote-section {
    margin: 40px 0;
    display: flex;
    justify-content: center;
    width: 100%;
    clear: both;
}

.cdc-vote-box {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    max-width: 600px;
    width: 100%;
}

.cdc-vote-title {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 25px 0;
    text-align: center;
}

.cdc-vote-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.cdc-btn-vote-large {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 25px;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    min-width: 140px;
    height: 60px;
}

.cdc-btn-vote-large:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.1);
}

.cdc-btn-vote-large:active {
    transform: scale(0.98);
}

.cdc-btn-vote-large i {
    font-size: 24px;
}

/* Like Button Green */
.cdc-btn-vote-like {
    background: #10b981; /* Green */
    color: #fff;
}

.cdc-btn-vote-like:hover {
    background: #059669;
}

.cdc-btn-vote-like.active {
    background: #047857;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.2);
}

/* Dislike Button Red/Pink */
.cdc-btn-vote-dislike {
    background: #fee2e2; /* Light Red */
    color: #ef4444;
}

.cdc-btn-vote-dislike:hover {
    background: #fecaca;
}

.cdc-btn-vote-dislike.active {
    background: #fca5a5;
    color: #b91c1c;
    box-shadow: inset 0 3px 6px rgba(0,0,0,0.1);
}

/* Center Score */
.cdc-vote-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.cdc-score-number {
    font-size: 28px;
    font-weight: 800;
    color: #334155;
    line-height: 1;
    margin-bottom: 5px;
}

.cdc-score-label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive */
@media (max-width: 500px) {
    .cdc-vote-buttons {
        gap: 15px;
    }
    
    .cdc-btn-vote-large {
        min-width: auto;
        padding: 10px 15px;
        font-size: 16px;
        height: 50px;
    }
    
    .cdc-btn-vote-large i {
        font-size: 20px;
    }
    
    .cdc-vote-box {
        padding: 20px;
    }
}

