/* Animations and Custom Styles */
.animate-text-gradient {
    background: linear-gradient(-45deg, #0ea5e9, #f59e0b, #22c55e, #8b5cf6);
    background-size: 400% 400%;
    animation: gradientXY 4s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.particle-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 20% 80%, rgba(14, 165, 233, 0.15) 0%, transparent 50%), radial-gradient(circle at 80% 20%, rgba(245, 158, 11, 0.15) 0%, transparent 50%), radial-gradient(circle at 40% 40%, rgba(34, 197, 94, 0.1) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

.morphing-blob {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: morph 8s ease-in-out infinite;
}

.line-clamp-2 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.line-clamp-3 {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
}

.floating-particles {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.floating-particles::before,
.floating-particles::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(14, 165, 233, 0.4);
    border-radius: 50%;
    animation: particle 15s infinite linear;
}

.floating-particles::before {
    left: 10%;
    animation-delay: 0s;
}

.floating-particles::after {
    left: 80%;
    animation-delay: 5s;
    background: rgba(245, 158, 11, 0.4);
}

.aspect-video {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 Aspect Ratio */
}

.aspect-video>* {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Drop cap styling */
.drop-cap:first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    padding-right: 0.5rem;
    padding-top: 0.1rem;
    font-weight: 700;
    color: #1a202c;
}

/* Drop cap styling */
.drop-cap:first-letter {
    float: left;
    font-size: 3.5rem;
    line-height: 0.8;
    padding-right: 0.5rem;
    padding-top: 0.1rem;
    font-weight: 700;
    color: #1a202c;
}

/* Reading progress bar */
#reading-progress {
    transition: width 0.1s ease;
}

/* Article Content Styles */
.article-content {
    font-size: 1.125rem;
    line-height: 1.8;
}

.article-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 2.5rem 0 1.5rem 0;
    color: #111827;
    letter-spacing: -0.025em;
}

.article-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 2rem 0 1rem 0;
    color: #374151;
}

.article-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
    color: #374151;
}

.article-content blockquote {
    border-left: 4px solid #0ea5e9;
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #4b5563;
    background: #f9fafb;
    padding: 1.5rem;
    border-radius: 0 0.5rem 0.5rem 0;
}

.article-content ul,
.article-content ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

/* Constrain images inside article content */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 2rem auto;
    display: block;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

@media (min-width: 768px) {
    .article-content img {
        max-width: 85%;
        /* Prevent full width on desktop for better readability */
    }
}

/* Shared Keyframes if not in Tailwind */
@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

/* WYSIWYG Editor Styles */
.editor-toolbar button.active {
    background-color: #e5e7eb;
    color: #0ea5e9;
}

#editor-content {
    font-size: 1rem;
    line-height: 1.6;
}

#editor-content:empty:before {
    content: attr(placeholder);
    color: #9ca3af;
    display: block;
}

/* Ensure headings inside editor look like headings */
#editor-content h2 {
    font-size: 1.5em;
    font-weight: bold;
    margin-top: 0.83em;
    margin-bottom: 0.83em;
}

#editor-content h3 {
    font-size: 1.17em;
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 1em;
}

#editor-content ul {
    list-style-type: disc;
    padding-left: 2em;
    margin: 1em 0;
}

#editor-content ol {
    list-style-type: decimal;
    padding-left: 2em;
    margin: 1em 0;
}

#editor-content a {
    color: #0ea5e9;
    text-decoration: underline;
}

#editor-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1em;
    margin: 1em 0;
    font-style: italic;
}

/* ============================================
   PAGE LOADER — Premium Clean Design
   ============================================ */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-loader.fade-out {
    opacity: 0;
    transform: scale(1.02);
    pointer-events: none;
}

.page-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

/* Logo container */
.loader-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    animation: loaderFadeIn 0.5s ease forwards;
}

.loader-logo-icon {
    width: 52px;
    height: 52px;
    background: #4f46e5;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.30);
    animation: loaderIconPulse 2.5s ease-in-out infinite;
}

.loader-logo-icon svg {
    width: 28px;
    height: 28px;
}

.loader-logo-text {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.04em;
}

/* Progress bar */
.loader-bar-track {
    width: 200px;
    height: 3px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    animation: loaderFadeIn 0.5s ease 0.1s both;
}

.loader-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4f46e5, #818cf8);
    border-radius: 999px;
    animation: loaderBarProgress 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Tagline */
.loader-tagline {
    font-family: 'Merriweather', serif;
    font-size: 0.8rem;
    color: #94a3b8;
    letter-spacing: 0.02em;
    font-style: italic;
    animation: loaderFadeIn 0.5s ease 0.2s both;
}

@keyframes loaderFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loaderIconPulse {

    0%,
    100% {
        box-shadow: 0 8px 24px rgba(79, 70, 229, 0.30);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 8px 32px rgba(79, 70, 229, 0.50);
        transform: scale(1.04);
    }
}

@keyframes loaderBarProgress {
    0% {
        width: 0%;
        opacity: 1;
    }

    70% {
        width: 85%;
        opacity: 1;
    }

    90% {
        width: 95%;
        opacity: 1;
    }

    100% {
        width: 100%;
        opacity: 0;
    }
}



/* ============================================
   SKELETON LOADERS
   ============================================ */
.article-skeleton {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    animation: skeleton-fade-in 0.5s ease forwards;
    opacity: 0;
}

@keyframes skeleton-fade-in {
    to {
        opacity: 1;
    }
}

.skeleton-image {
    width: 100%;
    padding-top: 56.25%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-content {
    padding: 1.5rem;
}

.skeleton-badge {
    width: 80px;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.skeleton-title {
    width: 100%;
    height: 20px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.25rem;
    margin-bottom: 0.75rem;
}

.skeleton-title.short {
    width: 70%;
}

.skeleton-text {
    width: 100%;
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 50%;
}

.skeleton-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.skeleton-date {
    width: 100px;
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.25rem;
}

.skeleton-link {
    width: 80px;
    height: 14px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.25rem;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* ============================================
   FADE-IN ANIMATIONS
   ============================================ */
.fade-in-animation {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-on-load {
    opacity: 0;
    transform: translateY(20px);
}

.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.scroll-reveal {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   SMOOTH TRANSITIONS
   ============================================ */
.smooth-transition {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.loading-skeletons {
    min-height: 400px;
}

/* Animation pour les articles qui apparaissent */
.article-card-enter {
    animation: articleEnter 0.5s ease forwards;
}

@keyframes articleEnter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   BUTTON LOADING STATES
   ============================================ */
button.loading {
    position: relative;
    pointer-events: none;
}

button.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ============================================
   LOADING MESSAGES
   ============================================ */
.loading-articles {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    font-size: 1.125rem;
    color: #64748b;
    gap: 0.75rem;
}

.loading-articles i {
    color: #3b82f6;
    font-size: 1.5rem;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 768px) {
    .loader-logo-icon {
        width: 42px;
        height: 42px;
        border-radius: 11px;
    }

    .loader-logo-icon svg {
        width: 22px;
        height: 22px;
    }

    .loader-logo-text {
        font-size: 1.6rem;
    }

    .loader-bar-track {
        width: 160px;
    }

    .skeleton-content {
        padding: 1rem;
    }
}