/* ================================================================
   APROPO THEME IMPROVEMENTS v2.0
   ================================================================ */

/* ── 1. PALETA CULORI MODERNA ─────────────────────────────────── */
:root {
    --apropo-primary:    #0ea5e9;
    --apropo-secondary:  #06b6d4;
    --apropo-accent:     #f59e0b;
    --apropo-dark:       #0f172a;
    --apropo-darker:     #020617;
    --apropo-card-bg:    #ffffff;
    --apropo-text:       #1e293b;
    --apropo-text-muted: #64748b;
    --apropo-border:     #e2e8f0;
    --apropo-shadow:     0 4px 24px rgba(0,0,0,0.08);
    --apropo-radius:     12px;
    --apropo-font:       'Roboto Condensed', system-ui, sans-serif;
    --transition:        0.25s cubic-bezier(0.4,0,0.2,1);
}

/* ── 2. BARA DE PROGRES CITIRE ────────────────────────────────── */
#reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--apropo-primary), var(--apropo-accent));
    z-index: 999999;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

/* ── 3. CARD-URI ARTICOLE IMBUNATATITE ────────────────────────── */
.td_module_wrap,
.td-block-span6,
.td-block-span4,
.td-block-span3 {
    transition: transform var(--transition), box-shadow var(--transition) !important;
    border-radius: var(--apropo-radius) !important;
    overflow: hidden;
}

.td_module_wrap:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 32px rgba(14,165,233,0.15) !important;
}

.td-image-wrap img {
    transition: transform 0.4s ease !important;
}

.td_module_wrap:hover .td-image-wrap img {
    transform: scale(1.06) !important;
}

/* Categorie colorată pe card */
.td-post-category,
.td-category,
.entry-category {
    background: linear-gradient(135deg, var(--apropo-primary), var(--apropo-secondary)) !important;
    color: #fff !important;
    border-radius: 20px !important;
    padding: 3px 12px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    border: none !important;
    transition: opacity var(--transition) !important;
}

.td-post-category:hover { opacity: 0.85 !important; }

/* Titluri card */
.td-module-title a,
.entry-title a {
    transition: color var(--transition) !important;
}

.td-module-title a:hover,
.entry-title a:hover {
    color: var(--apropo-primary) !important;
}

/* ── 4. BLUR PLACEHOLDER IMAGINI ──────────────────────────────── */
.td-image-wrap img,
.wp-post-image,
.apropo-img {
    filter: blur(0px);
    transition: filter 0.4s ease, transform 0.4s ease !important;
}

.td-image-wrap img.loading-blur {
    filter: blur(8px);
    transform: scale(1.02);
}

/* ── 5. STICKY SIDEBAR ────────────────────────────────────────── */
@media (min-width: 1024px) {
    .sidebar-container,
    #secondary.sidebar,
    .widget-area {
        position: sticky !important;
        top: 80px !important;
        max-height: calc(100vh - 100px) !important;
        overflow-y: auto !important;
        scrollbar-width: thin !important;
        scrollbar-color: var(--apropo-primary) transparent !important;
    }

    .sidebar-container::-webkit-scrollbar { width: 4px; }
    .sidebar-container::-webkit-scrollbar-thumb {
        background: var(--apropo-primary);
        border-radius: 2px;
    }
}

/* ── 6. LOAD MORE BUTON ───────────────────────────────────────── */
#apropo-load-more {
    display: block;
    margin: 32px auto;
    padding: 14px 40px;
    background: linear-gradient(135deg, var(--apropo-primary), var(--apropo-secondary));
    color: #fff;
    border: none;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(14,165,233,0.3);
    font-family: var(--apropo-font);
}

#apropo-load-more:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(14,165,233,0.4);
}

#apropo-load-more:active { transform: translateY(0); }

#apropo-load-more.loading {
    opacity: 0.7;
    pointer-events: none;
}

#apropo-load-more.loading::after {
    content: ' ⟳';
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 7. NIGHT MODE AUTO ───────────────────────────────────────── */
body.auto-night-mode {
    --apropo-card-bg: #0f172a;
    --apropo-text: #e2e8f0;
    --apropo-text-muted: #94a3b8;
    --apropo-border: #1e293b;
    background-color: #020617 !important;
    color: var(--apropo-text) !important;
}

body.auto-night-mode .td-main-content,
body.auto-night-mode .td_block_wrap,
body.auto-night-mode .td-pb-span8,
body.auto-night-mode article,
body.auto-night-mode .entry-content,
body.auto-night-mode .sidebar,
body.auto-night-mode #secondary {
    background: #0f172a !important;
    color: var(--apropo-text) !important;
}

body.auto-night-mode .td-module-title a,
body.auto-night-mode .entry-title a,
body.auto-night-mode p { color: var(--apropo-text) !important; }

body.auto-night-mode .td-post-category { opacity: 0.9; }

/* Buton night mode indicator */
#night-mode-indicator {
    position: fixed;
    bottom: 130px;
    right: 16px;
    z-index: 9997;
    background: #1e293b;
    color: #f59e0b;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    transition: all var(--transition);
}

#night-mode-indicator.visible { display: flex; }
#night-mode-indicator:hover { transform: scale(1.1); }

/* ── 8. CRITICAL PERFORMANCE ──────────────────────────────────── */
/* Font display swap */
@font-face {
    font-family: 'Roboto Condensed';
    font-display: swap;
}

/* Reduce layout shift */
.td-image-wrap {
    aspect-ratio: 16/9;
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    overflow: hidden;
}

.td-image-wrap img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* ── 9. MOBILE FONT & UX ──────────────────────────────────────── */
@media (max-width: 767px) {
    body, p { font-size: 16px !important; line-height: 1.7 !important; }
    .entry-content p { font-size: 16px !important; }
    h1 { font-size: 26px !important; }
    h2 { font-size: 22px !important; }
    h3 { font-size: 18px !important; }

    /* Hamburger mai mare */
    .td-menu-btn, .td-icon-menu {
        font-size: 28px !important;
        padding: 12px !important;
        min-width: 48px !important;
        min-height: 48px !important;
    }

    /* Cards mobile */
    .td_module_wrap { margin-bottom: 16px !important; }
}

/* ── 10. CARD SKELETON LOADING ────────────────────────────────── */
.apropo-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 11. HOVER EFECTE GENERALE ────────────────────────────────── */
a { transition: color var(--transition) !important; }

.widget a:hover { color: var(--apropo-primary) !important; }

/* Widget titles */
.widget-title, .td-block-title {
    border-left: 3px solid var(--apropo-primary) !important;
    padding-left: 10px !important;
}

/* ── 12. PRINT STYLES ─────────────────────────────────────────── */
@media print {
    #apropo-radio-bar, #apropo-darkbtn, #apropo-top-btn,
    #apropo-footer-social, #apropo-cookie,
    .sidebar, #secondary, nav, footer,
    #reading-progress-bar { display: none !important; }

    body { font-size: 12pt !important; color: #000 !important; }
    .entry-content { max-width: 100% !important; }
}
