.card-animated {
    position: relative;
    padding: 24px;
    color: white;
    border-radius: 16px;
}

    /* Borda normal */
    .card-animated::before {
        content: "";
        position: absolute;
        inset: 0;
        padding: 1px;
        border-radius: inherit;
        background: #369eb0;
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
    }

    /* Gradiente animado */
    .card-animated::after {
        content: "";
        position: absolute;
        inset: 0;
        padding: 1px;
        border-radius: inherit;
        background: linear-gradient(90deg, transparent, #369eb0, #246f7c, #14b1f7, transparent);
        background-size: 300% 100%;
        background-position: 0% 50%;
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        opacity: 0;
        animation: border-move 3s linear infinite;
        transition: opacity 0.25s ease;
    }

    .card-animated:hover::after {
        opacity: 1;
    }

@keyframes border-move {
    from {
        background-position: 0% 50%;
    }

    to {
        background-position: 300% 50%;
    }
}


/* RTL Support */
.rtl-content {
    direction: rtl;
    text-align: right;
}

.rtl-content ul, .rtl-content ol {
    padding-right: 2rem;
    padding-left: 0;
}

.rtl-content h2 {
    border-left: none;
    border-right: 4px solid #3b82f6;
    padding-left: 0;
    padding-right: 1rem;
}

.rtl-content blockquote {
    border-left: none;
    border-right: 4px solid #3b82f6;
    padding-left: 0;
    padding-right: 1rem;
}

.rtl-content table th,
.rtl-content table td {
    text-align: right;
}

.article-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.article-content h1 {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: #1a202c;
    border-bottom: 3px solid #3b82f6;
    padding-bottom: 1rem;
}

.article-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: #2d3748;
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
}

.article-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: #4a5568;
}

.article-content p {
    margin-bottom: 1rem;
    color: #4a5568;
    font-size: 1.1rem;
}

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

.article-content ul {
    list-style-type: disc;
}

.article-content ol {
    list-style-type: decimal;
}

.article-content li {
    margin-bottom: 0.5rem;
    color: #4a5568;
    display: list-item;
}

.article-content a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: underline;
}

    .article-content a:hover {
        color: #2563eb;
    }

.article-content strong {
    color: #2d3748;
    font-weight: 600;
}

.article-content em {
    font-style: italic;
    color: #5a67d8;
}

.article-content code {
    background: #edf2f7;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    color: #2d3748;
}

.article-content pre {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

    .article-content pre code {
        background: none;
        padding: 0;
        color: inherit;
    }

.article-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1.5rem 0;
    background: #f7fafc;
    padding: 1rem;
    border-radius: 4px;
    font-style: italic;
}

.article-content .table-of-contents:empty {
    display: none;
}

.article-content .key-takeaways {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-left: 4px solid #0ea5e9;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
    overflow: hidden;
    clear: both;
    display: block;
}

.article-content .key-takeaways h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #0369a1;
}

.article-content .key-takeaways ul {
    margin-bottom: 0;
    list-style-type: disc;
    padding-left: 1.5rem;
}

.article-content .key-takeaways li {
    margin-bottom: 0.5rem;
    color: #334155;
}

    .article-content .key-takeaways li:last-child {
        margin-bottom: 0;
    }

/* Table of Contents Styling */
.article-content .table-of-contents {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid #e9d5ff;
    border-left: 4px solid #a855f7;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
}

.article-content .table-of-contents h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #7c3aed;
    border-left: none;
    padding-left: 0;
}

.article-content .table-of-contents ul {
    margin-bottom: 0;
    list-style-type: none;
    padding-left: 0;
}

.article-content .table-of-contents li {
    margin-bottom: 0.5rem;
    padding-left: 1.25rem;
    position: relative;
}

.article-content .table-of-contents li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: #a855f7;
}

.article-content .table-of-contents li:last-child {
    margin-bottom: 0;
}

.article-content .table-of-contents a {
    color: #6d28d9;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.article-content .table-of-contents a:hover {
    color: #4c1d95;
    text-decoration: underline;
}

.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.article-content table th {
    background: #3b82f6;
    color: white;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #2563eb;
}

.article-content table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #4a5568;
}

.article-content table tr:nth-child(even) {
    background: #f9fafb;
}

.article-content table tr:hover {
    background: #f3f4f6;
}

.article-content table th:first-child {
    border-top-left-radius: 8px;
}

.article-content table th:last-child {
    border-top-right-radius: 8px;
}

.article-content table tr:last-child td:first-child {
    border-bottom-left-radius: 8px;
}

.article-content table tr:last-child td:last-child {
    border-bottom-right-radius: 8px;
}

/* Ensure article view mode clears properly */
#article-view-mode {
    overflow: hidden;
    clear: both;
}

#article-view-mode::after {
    content: "";
    display: table;
    clear: both;
}

.article-stats {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #3b82f6;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

.action-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

    .btn-primary:hover {
        background: #2563eb;
        transform: translateY(-1px);
    }

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty-green {
    background-color: #dcfce7;
    color: #166534;
}

.difficulty-blue {
    background-color: #dbeafe;
    color: #1e40af;
}

.difficulty-yellow {
    background-color: #fef3c7;
    color: #92400e;
}

.difficulty-orange {
    background-color: #fed7aa;
    color: #9a3412;
}

.difficulty-red {
    background-color: #fecaca;
    color: #991b1b;
}

.difficulty-gray {
    background-color: #f3f4f6;
    color: #374151;
}

/* Editor Styles */
.editor-btn {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 0.375rem;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
}

.editor-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.editor-btn.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

#editor-content {
    max-height: 600px;
    overflow-y: auto;
}

#editor-content:focus {
    outline: 2px solid #3b82f6;
    outline-offset: -2px;
}

#editor-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 2rem 0 1rem 0;
    color: #2d3748;
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
}

#editor-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem 0;
    color: #4a5568;
}

#editor-content p {
    margin-bottom: 1rem;
    color: #4a5568;
    font-size: 1.1rem;
}

#editor-content ul, #editor-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

#editor-content li {
    margin-bottom: 0.5rem;
    color: #4a5568;
}

#editor-content .key-takeaways {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-left: 4px solid #0ea5e9;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0.5rem;
}

#editor-content .key-takeaways h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: #0369a1;
    border-left: none;
    padding-left: 0;
}

#editor-content a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: underline;
}

#editor-content a:hover {
    color: #2563eb;
}

/* YouTube embed wrapper with controls */
.youtube-embed-wrapper {
    position: relative;
    margin: 1.5em 0;
    padding-top: 35px;
}

.youtube-embed-wrapper .youtube-embed {
    margin: 0;
}

.youtube-embed-controls {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
}

.youtube-embed-control-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.youtube-edit-btn {
    background: #3b82f6;
    color: white;
}

.youtube-edit-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.youtube-delete-btn {
    background: #ef4444;
    color: white;
}

.youtube-delete-btn:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.youtube-embed-control-btn svg {
    width: 14px;
    height: 14px;
}

/* Read More indicator in view mode */
.wp-read-more-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 24px 0;
    position: relative;
}

.wp-read-more-indicator::before,
.wp-read-more-indicator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #cbd5e1, transparent);
}

.wp-read-more-indicator span {
    padding: 0 16px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* Text alignment classes for both editor and view */
.text-left, #editor-content .text-left {
    text-align: left !important;
}

.text-center, #editor-content .text-center {
    text-align: center !important;
}

.text-right, #editor-content .text-right {
    text-align: right !important;
}

.text-justify, #editor-content .text-justify {
    text-align: justify !important;
}

/* Ensure alignment styles work in the article content view */
/* These match Tailwind class names so they won't conflict with infographic styling */
.article-content .text-left {
    text-align: left !important;
}

.article-content .text-center {
    text-align: center !important;
}

.article-content .text-right {
    text-align: right !important;
}

.article-content .text-justify {
    text-align: justify !important;
}

/* Image styles for editor and view */
#editor-content img,
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
    display: block;
}

#editor-content img {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#editor-content img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Table styles for editor */
#editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

#editor-content table th {
    background: #3b82f6;
    color: white;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #2563eb;
}

#editor-content table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
    color: #4a5568;
}

#editor-content table tr:nth-child(even) {
    background: #f9fafb;
}

#editor-content table tr:hover {
    background: #f3f4f6;
}

/* Image modal styles */
#image-modal input:focus {
    border-color: #3b82f6;
    ring-color: #3b82f6;
}

/* Infographic container - simple wrapper for iframe or direct HTML */
.infographic-container {
    margin: 2rem 0;
    clear: both;
    overflow: hidden;
    max-width: 100%;
}

/* Infographic iframe responsive styling */
.infographic-container iframe {
    width: 100%;
    border: 0;
    display: block;
}

/* Direct-embed infographic scaling (fallback when no iframe) */
.infographic-container > .autoseo-infographic-container,
.infographic-container > div:not(.autoseo-infographic-container) {
    max-width: 100%;
    overflow: hidden;
}

/* Mobile-specific styles - remove container boxes, use 95% width */
@media (max-width: 768px) {
    * {
        box-sizing: border-box !important;
    }

    .min-h-screen.bg-gray-50 {
        background: #ffffff !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    .min-h-screen {
        padding: 0 !important;
    }

    .max-w-4xl.mx-auto {
        max-width: 95% !important;
        width: 95% !important;
        padding: 0 !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    .max-w-4xl {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Remove padding from direct children */
    .min-h-screen > div {
        padding: 0 !important;
    }

    .article-content {
        border-radius: 0 !important;
        box-shadow: none !important;
        padding: 1rem !important;
        background: #ffffff !important;
        margin-bottom: 1rem !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* Ensure all article content children respect width */
    .article-content > * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Remove rounded corners and shadows from stats */
    .bg-white.border.border-gray-200.rounded-lg {
        border-radius: 0 !important;
        box-shadow: none !important;
        border: none !important;
        border-bottom: 1px solid #e5e7eb !important;
        margin-bottom: 0 !important;
    }

    /* Remove rounded corners from info boxes */
    .bg-blue-50.border.border-blue-200.rounded-lg {
        border-radius: 0 !important;
        box-shadow: none !important;
        margin-bottom: 1rem !important;
    }

    .bg-white.rounded-lg.shadow-lg {
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Hero image adjustments */
    .article-content img.rounded-lg {
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* Remove all margins from action buttons container */
    .action-buttons {
        margin-top: 1rem !important;
    }

    /* Ensure burger menu is properly positioned */
    #mobile-menu-button {
        margin-top: 0.5rem !important;
        margin-right: 0.5rem !important;
    }

    /* Add top padding to prevent content from going under burger menu */
    .min-h-screen.bg-gray-50 > div {
        padding-top: 3.5rem !important;
    }

    /* Mobile-friendly editor */
    #article-edit-mode .flex.justify-between {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    #article-edit-mode .flex.space-x-2 {
        display: flex !important;
        flex-direction: row !important;
        justify-content: stretch !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }

    #article-edit-mode .flex.space-x-2 button {
        flex: 1 !important;
        font-size: 0.875rem !important;
        padding: 0.5rem 0.75rem !important;
    }

    #article-edit-mode .flex.space-x-2 button svg {
        width: 1rem !important;
        height: 1rem !important;
    }

    /* Editor toolbar - make it scrollable horizontally on mobile */
    #editor-toolbar {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #editor-toolbar .flex {
        flex-wrap: nowrap !important;
        min-width: min-content !important;
    }

    .editor-btn {
        flex-shrink: 0 !important;
        min-width: 2rem !important;
    }

    /* Title input on mobile */
    #article-title-input {
        font-size: 1.5rem !important;
        padding: 0.75rem !important;
    }

    /* Editor content area */
    #editor-content {
        padding: 0.75rem !important;
        min-height: 300px !important;
        font-size: 1rem !important;
        max-width: 100% !important;
        overflow-x: auto !important;
    }

    /* Editor container width constraints */
    #editor-container {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    #article-edit-mode {
        max-width: 100% !important;
        overflow-x: hidden !important;
    }

    /* Prevent content inside editor from overflowing */
    #editor-content * {
        max-width: 100% !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }

    #editor-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    #editor-content table {
        display: block !important;
        overflow-x: auto !important;
        max-width: 100% !important;
    }

    /* Action buttons at top */
    .mb-4 button.inline-flex {
        white-space: nowrap !important;
    }

    /* Share and Edit buttons */
    .article-content .flex.justify-end {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .article-content .flex.justify-end button,
    .article-content .flex.justify-end a {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Image modal mobile optimization */
    #image-modal > div {
        max-width: 95% !important;
        margin: 1rem !important;
    }

    #image-modal input,
    #image-modal label {
        font-size: 0.875rem !important;
    }

    #image-modal button {
        font-size: 0.875rem !important;
        padding: 0.5rem 1rem !important;
    }

    /* Sentiment & Feedback modal animation */
    @keyframes sentimentModalIn {
        from {
            opacity: 0;
            transform: scale(0.92) translateY(12px);
        }

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

    /* Rewrite modal styles */
    #rewrite-modal {
        z-index: 9999;
    }

        #rewrite-modal .modal-content {
            animation: modalFadeIn 0.3s ease-out;
        }

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

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

    .pulse-animation {
        animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    }

    @keyframes pulse {
        0%, 100% {
            opacity: 1;
        }

        50% {
            opacity: .5;
        }
    }

    /* Info boxes and callouts */
    .bg-blue-50.border.border-blue-200.rounded-lg {
        padding: 1rem !important;
    }

    .bg-blue-50 p {
        font-size: 0.875rem !important;
    }

    /* Action buttons at bottom */
    .action-buttons {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .action-buttons a,
    .action-buttons button {
        width: 100% !important;
        justify-content: center !important;
        text-align: center !important;
    }
}

/* Keyword highlight styling */
.keyword-highlight {
    background-color: #fef08a;
    border-radius: 2px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}
