/* --- Base Styles & Resets --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #111;
    background-color: #f4f4f4;
    line-height: 1.6;
}

/* --- TIER 1: Top Bar --- */
.top-bar {
    background-color: #d10000;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 40px;
    font-size: 0.8rem;
    text-transform: uppercase;
}
.top-bar-right {
    display: flex;
    gap: 20px;
    align-items: center;
}
.nav-link, .nav-btn {
    color: white;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    text-transform: uppercase;
    font-weight: bold;
}
.nav-link:hover, .nav-btn:hover {
    opacity: 0.8;
}
.social-icons i { margin-left: 15px; cursor: pointer; transition: opacity 0.2s; }
.social-icons i:hover { opacity: 0.7; }

/* --- TIER 2: Main Header --- */
.main-header {
    background-color: #111;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
}
.logo { font-size: 1.8rem; font-weight: 900; font-style: italic; letter-spacing: -0.5px; }
.logo-red { background-color: #d10000; color: white; padding: 2px 8px; }
.logo-white { color: white; padding: 2px 8px; }

.nav-actions { display: flex; align-items: center; gap: 40px; }
.nav-icons { color: white; font-size: 1.2rem; display: flex; gap: 20px; cursor: pointer; }
.icon-badge-container { position: relative; }
.badge {
    position: absolute;
    top: -8px; right: -10px;
    background: #d10000; color: white;
    font-size: 0.6rem; padding: 2px 5px; border-radius: 50%;
    font-weight: bold;
}
.main-menu a {
    color: white; text-decoration: none;
    margin-left: 20px; font-weight: 500;
    text-transform: uppercase;
    font-size: 0.85rem;
}
.main-menu a:hover { color: #d10000; }

/* --- The Magazine Grid --- */
.magazine-wrapper {
    max-width: 1200px;
    margin: 40px auto;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 30px;
    padding: 0 20px;
}

/* --- The Red Category Badge --- */
.category-badge {
    background-color: #e60040;
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 4px 8px;
    text-transform: uppercase;
    display: inline-block;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

/* --- Left Side: Hero Card --- */
.hero-card {
    position: relative;
    background: #222;
    height: 500px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
    cursor: pointer;
    transition: opacity 0.2s;
    overflow: hidden;
}
.hero-card:hover { opacity: 0.95; }
.hero-title { color: white; font-size: 2.2rem; font-weight: bold; margin-bottom: 15px; line-height: 1.2; }
.hero-meta { color: #ccc; font-size: 0.9rem; }

/* --- Right Side: List Cards --- */
.list-card {
    display: flex;
    flex-direction: column;
    margin-bottom: 30px;
    cursor: pointer;
    background: white;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}
.list-card:hover { transform: translateY(-3px); }
.list-card .list-title {
    color: #111;
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
    line-height: 1.3;
}
.list-card .list-meta { color: #666; font-size: 0.9rem; }

/* --- Forms & Submission Pages (submit.html) --- */
#submit-section, #full-article-section {
    background: #ffffff;
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
}

button#btn-submit, button#btn-update {
    background-color: #d10000;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
button#btn-submit:hover, button#btn-update:hover {
    background-color: #a00000;
}

/* --- CKEditor Styles --- */
.ck-editor__editable_inline {
    min-height: 400px;
    margin-bottom: 20px;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .magazine-wrapper {
        grid-template-columns: 1fr;
    }
    .main-header {
        flex-direction: column;
        gap: 20px;
    }
    .nav-actions {
        flex-direction: column;
        gap: 20px;
    }
}

/* --- Dark Mode Theme --- */
body.dark-mode {
    background-color: #111 !important;
    color: #fff !important;
}

/* Invert the background and text of the right-side list cards */
body.dark-mode .list-card {
    background-color: #222 !important;
    box-shadow: 0 2px 4px rgba(255,255,255,0.05);
}

body.dark-mode .list-card .list-title {
    color: #fff !important;
}

/* Optional: Invert the forms and containers if you want dark mode on the submit/edit pages too */
body.dark-mode #submit-section,
body.dark-mode #full-article-section {
    background-color: #222 !important;
    color: #fff !important;
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #333 !important;
    color: #fff !important;
    border-color: #555 !important;
}

/* --- UPDATE THIS EXISTING RULE --- */
.article-tab-btn:hover {
    color: #e60040; /* Changed from #111 to match your screenshot */
}

/* --- ADD THESE NEW RULES AT THE BOTTOM --- */

/* Author Section UI */
.author-box {
    display: flex;
    gap: 20px;
    background: #fdfdfd;
    padding: 30px;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    margin-top: 20px;
}
.author-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ccc;
}
.author-info h3 { margin-bottom: 5px; color: #111; }
.author-info p.author-email { color: #e60040; font-size: 0.85rem; font-weight: bold; margin-bottom: 10px; }
.author-info p.author-bio { color: #666; line-height: 1.6; }

/* Related Section UI */
.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}
.related-card {
    border: 1px solid #eaeaea;
    padding: 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.related-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.related-img-placeholder {
    width: 100%;
    height: 120px;
    background: #eee;
    margin-bottom: 15px;
    border-radius: 2px;
}
.related-card h4 { font-size: 1.1rem; color: #111; margin-bottom: 5px; }

/* Comments Section UI */
.comments-section {
    margin-top: 20px;
}
.comments-section h3 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    border-bottom: 2px solid #111;
    display: inline-block;
    padding-bottom: 5px;
}
.comment-form textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    font-family: inherit;
    margin-bottom: 15px;
    min-height: 100px;
    resize: vertical;
}
.comment-form textarea:focus { outline: none; border-color: #111; }
.btn-comment {
    background: #111;
    color: #fff;
    border: none;
    padding: 12px 25px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
}
.btn-comment:hover { background: #e60040; }

/* --- Article Page Dark Mode --- */
body.dark-mode .article-main-container,
body.dark-mode .search-widget {
    background-color: #222 !important;
    color: #fff !important;
}

/* Update this rule in your styles.css */
.article-main-container {
    background: #ffffff;
    /* Adjusting padding: [Top] [Right] [Bottom] [Left] */
    padding: 20px 20px 20px 20px;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

body.dark-mode .article-tabs-header {
    border-color: #444 !important;
}

body.dark-mode .article-tab-btn {
    color: #aaa !important;
}

body.dark-mode .article-tab-btn:hover,
body.dark-mode .article-tab-btn.active {
    color: #e60040 !important; /* Keep the red accents */
}

body.dark-mode .author-box {
    background-color: #333 !important;
    border-color: #444 !important;
}

body.dark-mode .author-info h3,
body.dark-mode .widget-title,
body.dark-mode .comments-section h3,
body.dark-mode .related-card h4 {
    color: #fff !important;
}

body.dark-mode .related-card {
    border-color: #444 !important;
}

/* Dark Mode tab line overrides */
body.dark-mode .article-tab-btn::after {
    background-color: #444 !important; /* Muted line for inactive dark mode tabs */
}
body.dark-mode .article-tab-btn.active::after {
    background-color: #e60040 !important; /* Keep the active line vibrant red */
}

/* --- Article Tabs (Matching your screenshot) --- */
.article-tabs-header {
    display: flex;
    /* Add a tiny gap to create the breaks between the bottom lines */
    gap: 4px;
    border-top: 1px solid #eaeaea;
    /* Removed the solid bottom border completely */
    margin-bottom: 30px;
    padding-top: 10px;
}

.article-tab-btn {
    /* flex: 1 makes all buttons take up exactly equal space */
    flex: 1;
    background: none;
    border: none;
    padding: 20px 10px;
    font-size: 0.85rem;
    font-weight: 400;
    color: #666;
    text-transform: uppercase;
    cursor: pointer;
    letter-spacing: 1px;
    position: relative;
    outline: none;
}

.article-tab-btn:hover {
    color: #e60040;
}

/* Active Tab Text */
.article-tab-btn.active {
    color: #e60040;
}

/* BASE LINE: The thin red/pink line under ALL tabs */
.article-tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: #ff99a8; /* Light faded red */
    transition: all 0.2s;
}

/* ACTIVE LINE: Overrides the thin line with the thick rounded one */
.article-tab-btn.active::after {
    height: 4px;
    background-color: #e60040; /* Solid brand red */
    border-radius: 4px 4px 0 0;
}

/* --- Social Inputs for Profile Form --- */
.social-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}
.social-input-group i {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}
.social-input-group input {
    margin-bottom: 0; /* Override default input margin */
    flex-grow: 1;
}

/* --- Social Links in Author Tab --- */
.author-social-link {
    display: inline-block;
    color: #111;
    font-size: 1.2rem;
    margin-right: 15px;
    transition: color 0.2s, transform 0.2s;
}
.author-social-link:hover {
    color: #e60040;
    transform: translateY(-2px);
}

/* --- Author's Article List --- */
.author-articles-list h4 {
    font-size: 0.95rem;
    text-transform: uppercase;
    margin-bottom: 10px;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 5px;
}
.author-articles-list ul {
    list-style-type: none;
    padding: 0;
}
.author-articles-list li {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

/* Dark mode overrides for new elements */
body.dark-mode .author-social-link { color: #fff !important; }
body.dark-mode .author-social-link:hover { color: #e60040 !important; }
body.dark-mode .author-articles-list h4 { border-color: #444 !important; }

/* --- Author Profile Picture --- */
.author-avatar {
    /* Ensure the container hides any overflowing square corners of the image */
    overflow: hidden;
}

.author-profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the image fills the circle perfectly */
    border-radius: 50%;
}

/* --- Author's Article List (Horizontal Card UI) --- */
.author-articles-list h4 {
    font-size: 1.2rem;
    text-transform: uppercase;
    margin-bottom: 20px;
    border-bottom: 2px solid #111;
    padding-bottom: 5px;
    display: inline-block;
}

.author-article-card {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}

.author-article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.author-article-img {
    width: 280px;
    min-width: 280px;
    background: #eee;
    background-size: cover;
    background-position: center;
}

.author-article-content {
    padding: 20px 20px 20px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.author-article-title {
    font-size: 1.4rem;
    font-weight: bold;
    color: #111;
    margin-bottom: 10px;
    line-height: 1.3;
}

.author-article-excerpt {
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Automatically truncates after 3 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.author-article-meta {
    color: #666;
    font-size: 0.85rem;
    display: flex;
    gap: 20px;
}

/* Mobile responsiveness: Stack the image on top of the text on small screens */
@media (max-width: 768px) {
    .author-article-card {
        flex-direction: column;
        gap: 0;
    }
    .author-article-img {
        width: 100%;
        height: 200px;
    }
    .author-article-content {
        padding: 20px;
    }
}

/* --- Dark Mode Support for New Cards --- */
body.dark-mode .author-article-card {
    background: #222 !important;
    box-shadow: 0 2px 4px rgba(255,255,255,0.05);
}
body.dark-mode .author-article-title {
    color: #fff !important;
}
body.dark-mode .author-article-excerpt {
    color: #ccc !important;
}
body.dark-mode .author-article-meta {
    color: #aaa !important;
}
body.dark-mode .author-articles-list h4 {
    border-color: #fff !important;
}

/* --- Restore Tab Visibility Rules --- */
.article-tab-content {
    display: none; /* Hides all tabs by default */
}

.article-tab-content.active {
    display: block; /* Shows only the clicked tab */
    animation: fadeIn 0.3s ease-in-out;
}

/* Adds a smooth fade-in effect when switching tabs */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Featured Content Section Grid Rules --- */
.featured-section-wrapper {
    max-width: 1200px;
    margin: 60px auto;
    padding: 0 20px;
}

.featured-main-title {
    font-size: 1.4rem;
    font-weight: bold;
    text-transform: uppercase;
    color: #111;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.5px;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.featured-card-item {
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.06);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s cubic-bezier(0.1, 0.8, 0.2, 1), box-shadow 0.2s ease;
}

.featured-card-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.featured-card-image {
    height: 200px;
    width: 100%;
    background-size: cover;
    background-position: center;
    background-color: #eaeaea;
}

.featured-card-text {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.featured-mini-badge {
    font-size: 0.65rem !important;
    padding: 2px 6px !important;
    margin-bottom: 12px !important;
}

.featured-card-title {
    font-size: 1.15rem;
    font-weight: bold;
    color: #111;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-card-excerpt {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-card-meta {
    margin-top: auto;
    font-size: 0.8rem;
    color: #777;
    display: flex;
    justify-content: space-between;
}

/* --- Dark Mode Adaptation --- */
body.dark-mode .featured-main-title,
body.dark-mode .featured-card-title {
    color: #ffffff !important;
}

body.dark-mode .featured-card-item {
    background: #222222 !important;
    box-shadow: 0 2px 5px rgba(255,255,255,0.02);
}

body.dark-mode .featured-card-excerpt {
    color: #cccccc !important;
}

body.dark-mode .featured-card-meta {
    color: #999999 !important;
}

/* --- Responsive Layout Breakers --- */
@media (max-width: 950px) {
    .featured-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 650px) {
    .featured-grid {
        grid-template-columns: 1fr;
    }
}