/* --- Global Reset & Main Container --- */
.ctp-container a { text-decoration: none !important; }
.ctp-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9e9e9;
}

/* --- Tab Navigation (Desktop & Mobile) --- */
.ctp-tabs-nav {
    list-style: none !important; margin: 0 0 20px 0 !important;
    display: flex;
    gap: 10px;
    flex-wrap: nowrap; /* Prevent tabs from wrapping to the next line */
    overflow-x: auto;  /* Allow horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on touch devices */
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #ccc #f0f0f0; /* Firefox */
    padding: 0 0 15px 0 !important; /* Add padding for the scrollbar to sit in */
}

/* Nicer Scrollbar for Webkit browsers (Chrome, Safari) */
.ctp-tabs-nav::-webkit-scrollbar {
    height: 6px;
}
.ctp-tabs-nav::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 6px;
}
.ctp-tabs-nav::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 6px;
}
.ctp-tabs-nav::-webkit-scrollbar-thumb:hover {
    background-color: #aaa;
}

.ctp-tabs-nav li { margin: 0 !important; padding: 0 !important; list-style-type: none !important; }
.ctp-tabs-nav a {
    display: block;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    border-radius: 5px;
    transition: all 0.2s ease-in-out;
    background-color: #3e3e3e;
    color: #fff;
    border: 2px solid transparent;
    white-space: nowrap; /* Prevent tab text from breaking into two lines */
}
.ctp-tabs-nav a:hover:not(.active) {
    background-color: #555;
}
.ctp-tabs-nav a.active {
    background-color: #d9232d;
    color: #fff;
    border-color: #d9232d;
}

/* --- Post Item Card (Desktop) --- */
.ctp-post-item {
    display: flex; background: #fff; border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-bottom: 20px; transition: box-shadow 0.3s ease;
    overflow: hidden; /* Added to help contain elements */
}
.ctp-post-item:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.ctp-posts-container .ctp-post-item:last-child { margin-bottom: 0; }

/* Left Column: Image */
.ctp-post-image {
    flex-shrink: 0; width: 330px;
    overflow: hidden; border-radius: 8px 0 0 8px;
}
.ctp-post-image a { display: block; height: 100%; }
.ctp-post-image img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 0.4s ease-out;
}

/* Right Column: Content */
.ctp-post-content {
    flex: 1; padding: 25px;
    display: flex; flex-direction: column;
}
.ctp-post-content h3 {
    font-size: 24px; line-height: 1.3; font-weight: 700;
    margin: 0 0 12px 0;
}
.ctp-post-content h3 a { color: #111; }

/* FIXED: Excerpt is now clamped to 3 lines to prevent layout breaking */
.ctp-post-excerpt {
    color: #555; font-size: 15px; line-height: 1.6;
    margin-bottom: 20px; /* Add margin to create space before the footer */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.ctp-post-excerpt p { margin: 0; }

/* Content Footer (Author & Comments) */
.ctp-post-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto; /* Pushes footer to the bottom of the card content */
    padding-top: 15px; border-top: 1px solid #f0f0f0;
}

/* NEW: Styles for the left side of the footer (Author/Date) */
.ctp-footer-meta-left {
    display: flex;
    align-items: center;
    gap: 15px;
}
.ctp-author-label { color: #999; font-size: 14px; font-weight: 500; margin-right: 5px; }
.ctp-author-name { color: #111; font-size: 14px; font-weight: 700; }

/* FIXED: Date is now visible on desktop */
.ctp-post-time {
    display: block;
    color: #888;
    font-size: 14px;
}

.ctp-post-comments { display: flex; align-items: center; gap: 6px; }
.ctp-post-comments svg { width: 20px; height: 20px; fill: #888; }
.ctp-post-comments span { color: #555; font-size: 14px; font-weight: 700; }

/* --- Loader --- */
.ctp-loader-spinner {
    border: 4px solid rgba(0,0,0,0.1); border-top: 4px solid #d9232d;
    border-radius: 50%; width: 40px; height: 40px;
    animation: ctp-spin 1s linear infinite; margin: 40px auto;
}
@keyframes ctp-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/*
==========================================================================
   MOBILE VIEW
==========================================================================
*/
@media (max-width: 768px) {
    .ctp-post-item {
        flex-direction: column; box-shadow: none;
        border: 1px solid #e5e5e5;
        transition: border-color 0.3s ease, transform 0.3s ease;
    }
    .ctp-post-item:hover { border-color: #ccc; transform: translateY(-2px); }
    .ctp-post-image { width: 100%; height: 180px; border-radius: 7px 7px 0 0; }
    
    .ctp-post-content { padding: 10px 15px; flex-grow: 1; }
    
    .ctp-post-content h3 {
        font-size: 18px; font-weight: 700; line-height: 1.4;
        margin: 0;
        overflow: hidden; display: -webkit-box;
        -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    }
    .ctp-post-excerpt { display: none; } /* Excerpt remains hidden on mobile for a cleaner look */
    .ctp-post-footer {
        display: flex; align-items: flex-end;
        margin-top: auto; padding-top: 12px;
        border: none;
    }
    /* On mobile, stack author and time vertically */
    .ctp-footer-meta-left { display: flex; flex-direction: column; gap: 4px; }
    .ctp-author-label, .ctp-author-name { font-size: 13px; }
    .ctp-post-time { display: block; color: #888; font-size: 12px; font-weight: 500; text-transform: none; }
    .ctp-post-comments svg { width: 18px; height: 18px; fill: #aaa; }
    .ctp-post-comments span { display: none; }
}