/* public_html/assets/css/articles.css */

/* --- 0. THEME VARIABLES --- */
:root {
    /* DEFAULT: PAPER & SKETCH */
    --bg-color: #f4f1ea;
    --bg-image: url('../img/paper/Marco.jpg'); 
    --bg-size: cover;
    --bg-repeat: no-repeat;
    --bg-attachment: fixed;
    
    --card-bg: #ebe7e0;
    --card-body-bg: rgba(255, 253, 249, 0.95);
    
    --text-main: #2d2d2d;
    --text-muted: #4b5563;
    --accent: #2563eb;
    
    --border-color: #2d2d2d;
    --border-width: 2px;
    --border-radius: 0px;
    
    --shadow-card: 6px 6px 0px rgba(0, 0, 0, 0.15);
    --shadow-hover: 10px 10px 0px #2563eb;
    --shadow-hero: 8px 8px 0px #2d2d2d;
    
    --font-heading: 900;
    --img-filter: sepia(15%) contrast(110%);
}

/* MODERN THEME (GRADIENT) */
body.theme-modern {
    --bg-color: transparent;
    --bg-image: none;
    --bg-size: auto;
    --bg-repeat: repeat;
    --bg-attachment: scroll;
    
    --card-bg: #ffffff;
    --card-body-bg: #ffffff;
    
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --accent: #3b82f6;
    
    --border-color: rgba(0,0,0,0.05);
    --border-width: 1px;
    --border-radius: 24px;
    
    --shadow-card: 0 10px 30px rgba(0,0,0,0.03);
    --shadow-hover: 0 20px 40px rgba(37,99,235,0.12);
    --shadow-hero: 0 20px 60px rgba(0,0,0,0.05);
    
    --font-heading: 800;
    --img-filter: none;
}

/* --- 1. GLOBAL LAYOUT --- */
body {
    background-color: var(--bg-color);
    background-image: var(--bg-image);
    background-size: var(--bg-size);
    background-repeat: var(--bg-repeat);
    background-attachment: var(--bg-attachment);
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    transition: color 0.3s ease;
}

/* Modern Theme Gradient Background */
body.theme-modern {
    background: linear-gradient(135deg, #e0f2fe 0%, #fef9c3 50%, #f3e8ff 100%) !important;
    background-size: 200% 200%;
    animation: gradientBG 15s ease infinite;
    background-attachment: fixed;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.article-wrap { 
    padding-top: 40px; 
    padding-bottom: 80px; 
}

/* FIX: DESKTOP MARGIN TOP */
@media (min-width: 992px) {
    body {
        padding-top: 4rem; /* Pushes content down from fixed header */
    }
}

/* --- 2. HERO SECTION & TOGGLE --- */
.hero-glass {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 60px 40px;
    margin-bottom: 50px;
    box-shadow: var(--shadow-hero);
    text-align: center;
    transition: all 0.3s ease;
}

.hero-title {
    font-weight: var(--font-heading);
    color: var(--text-main);
    font-size: 2.8rem;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

/* THEME TOGGLE ICON BUTTON */
.theme-toggle-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: #fff;
    border: var(--border-width) solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-main);
    transition: transform 0.2s, box-shadow 0.2s;
    z-index: 20;
    box-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

.theme-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
    color: var(--accent);
    border-color: var(--accent);
    box-shadow: 4px 4px 0px var(--accent);
}

/* --- 3. ADMIN PANEL (RESTORED) --- */
.admin-panel {
    background: #fff;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 60px;
    box-shadow: var(--shadow-card);
    text-align: left;
    position: relative;
    overflow: hidden;
}

/* Admin Avatar Fix */
.admin-panel img {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent);
}

.form-glass-input {
    background: #fff;
    border: 2px solid #ccc; 
    border-radius: var(--border-radius);
    padding: 12px 15px;
    width: 100%;
    margin-bottom: 15px;
    transition: 0.2s;
    font-size: 0.95rem;
    color: var(--text-main);
}

body.theme-modern .form-glass-input {
    border: 1px solid #cbd5e1;
    background: #f9fafb;
}

.form-glass-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

.btn-add-topic {
    background: var(--text-main);
    color: white;
    padding: 12px 30px;
    border-radius: var(--border-radius);
    font-weight: 700;
    border: 2px solid transparent;
    transition: 0.2s;
    cursor: pointer;
    margin-top: 10px;
}

.btn-add-topic:hover {
    background: white;
    color: var(--text-main);
    border-color: var(--text-main);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    transform: translateY(-2px);
}

/* --- 4. ARTICLE CARDS (LIST) --- */
.article-card {
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s;
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
    margin-bottom: 35px;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-height: 280px;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent);
    z-index: 5;
}

.card-img-wrap {
    background-color: var(--card-bg); 
    width: 35%;
    min-width: 250px; 
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    border-right: var(--border-width) solid var(--border-color);
}

.card-img-top {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
    filter: var(--img-filter);
}

.article-card:hover .card-img-top {
    transform: scale(1.05);
}

.card-body-custom {
    padding: 30px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    background: var(--card-body-bg);
}

.cat-badge {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    margin-bottom: 12px;
    display: inline-block;
    background: #eff6ff;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
}
body:not(.theme-modern) .cat-badge {
    background: #fff;
    border: 2px solid var(--border-color);
    color: var(--text-main);
    border-radius: 0;
    box-shadow: 3px 3px 0px rgba(0,0,0,0.1);
}

.card-title a {
    text-decoration: none;
    color: var(--text-main);
    font-weight: var(--font-heading);
    font-size: 1.6rem;
    line-height: 1.3;
    transition: color 0.2s;
}

.card-title a:hover {
    color: var(--accent);
}

.article-summary {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 25px;
    margin-top: 15px;
}

.meta-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    border-top: 1px dashed #cbd5e1;
    padding-top: 10px;
    width: 100%;
}

/* --- 5. SINGLE ARTICLE CONTAINER --- */
.glass-article {
    background: var(--card-body-bg);
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 60px;
    box-shadow: var(--shadow-hero);
}

.article-header-center {
    text-align: center;
    margin-bottom: 40px;
}

.article-category {
    color: var(--accent);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
    display: block;
    font-size: 0.9rem;
}

.article-title {
    font-weight: var(--font-heading);
    font-size: 2.6rem !important;
    line-height: 1.2;
    text-align: center;
    margin-bottom: 40px;
}

/* AUTHOR BADGE & AVATAR FIX */
.author-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 20px 8px 8px;
    background: #fff;
    border-radius: var(--border-radius);
    border: var(--border-width) solid var(--border-color);
    box-shadow: 4px 4px 0px rgba(0,0,0,0.05);
    margin: 0 auto;
    max-width: 100%;
}

.author-img {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important; /* Forces size preventing squish */
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    border: 2px solid #e5e7eb;
}

/* --- 6. ARTICLE CONTENT & TYPOGRAPHY --- */
.main-img {
    width: 80%;
    display: block;
    margin: 40px auto 60px auto;
    border: var(--border-width) solid var(--border-color);
    box-shadow: var(--shadow-card);
    background-color: #ebe7e0;
    padding: 10px;
    border-radius: var(--border-radius);
    transform: rotate(-1deg);
    transition: transform 0.3s ease;
}
.main-img:hover { transform: rotate(0deg) scale(1.02); }

.article-body { 
    font-size: 1.15rem; 
    line-height: 1.85; 
    color: var(--text-main); 
}

/* HEADINGS */
.article-body h2 { 
    margin-top: 60px; 
    margin-bottom: 25px; 
    color: #111827; 
    font-weight: 900; 
    font-size: 1.8rem;
    position: relative;
    display: inline-block;
    padding-bottom: 8px;
}
/* Sketch underline */
.article-body h2::after {
    content: '';
    display: block;
    width: 100%;
    height: 4px;
    background-color: var(--accent);
    opacity: 0.3;
    border-radius: 4px;
    position: absolute;
    bottom: 0;
    left: 0;
}

.article-body h3 {
    margin-top: 40px; 
    margin-bottom: 15px;
    font-weight: 800; 
    font-size: 1.4rem;
    color: var(--text-main);
    border-left: 4px solid var(--accent);
    padding-left: 15px;
}

/* HIGHLIGHTS */
.article-body strong, .article-body b {
    font-weight: 800;
    background: linear-gradient(120deg, transparent 0%, rgba(37, 99, 235, 0.15) 20%, rgba(37, 99, 235, 0.15) 80%, transparent 100%);
    padding: 0 4px;
    border-radius: 4px;
}

/* LISTS */
.article-body ul { list-style: none; padding-left: 10px; margin-bottom: 30px; }
.article-body ul li { position: relative; padding-left: 35px; margin-bottom: 15px; }
.article-body ul li::before {
    content: '➜'; 
    position: absolute; left: 0; top: 0;
    color: var(--accent); font-weight: bold; font-size: 1.1rem;
    background: rgba(37, 99, 235, 0.1);
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid var(--accent);
}

.article-body blockquote {
    background: #fff;
    border-left: 6px solid var(--accent);
    margin: 40px 0; padding: 25px 30px;
    font-style: italic; font-weight: 500; color: #4b5563;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.05);
}

/* MODERN THEME OVERRIDES FOR CONTENT */
body.theme-modern .article-body h2::after { display: none; }
body.theme-modern .article-body h2 {
    border-bottom: none;
    background: -webkit-linear-gradient(45deg, #2563eb, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
body.theme-modern .article-body ul li::before {
    content: '✓'; background: transparent; border: none; font-size: 1.4rem; padding: 0; width: auto; color: #10b981;
}

/* --- 7. CTA & BUTTONS --- */
.cta-box {
    margin-top: 70px;
    padding: 50px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border-radius: var(--border-radius);
    border: var(--border-width) solid var(--border-color);
    text-align: center;
    color: white;
    box-shadow: var(--shadow-hover);
}
body:not(.theme-modern) .cta-box {
    background: var(--accent);
    box-shadow: 8px 8px 0px #1e3a8a;
}

.btn-cta {
    background: white; color: var(--accent);
    padding: 15px 40px; border-radius: var(--border-radius);
    font-weight: 700; text-decoration: none;
    display: inline-block; margin-top: 20px;
    box-shadow: 4px 4px 0px rgba(0,0,0,0.2);
    border: var(--border-width) solid #1e3a8a;
}

/* --- 8. INFINITE SCROLL LOADER --- */
#infinite-loader {
    text-align: center;
    padding: 20px;
    display: none;
    width: 100%;
    clear: both;
    margin-top: 20px;
}
.loader-dots span {
    display: inline-block;
    width: 12px; height: 12px;
    border-radius: 50%;
    background-color: var(--accent);
    margin: 0 5px;
    animation: bounce 1.4s infinite ease-in-out both;
    border: 1px solid var(--border-color);
}
.loader-dots span:nth-child(1) { animation-delay: -0.32s; }
.loader-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* --- 9. RESPONSIVE --- */
@media (max-width: 768px) {
    .article-card { flex-direction: column; height: auto; }
    .card-img-wrap { width: 100%; height: 250px; border-right: none; border-bottom: var(--border-width) solid var(--border-color); }
    .card-body-custom { padding: 25px; }
    .hero-title { font-size: 2rem; }
    .article-title { font-size: 1.8rem !important; }
    .glass-article { padding: 25px; }
    .main-img { width: 100%; }
}