/**
 * Article Modal Styles
 * Styles for the article modal popup
 */

/* Article Modal Base */
.article-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.article-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.article-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Close Button - Fixed Position */
.article-modal-close {
    position: sticky;
    top: 20px;
    right: 20px;
    float: right;
    margin-top: -60px;
    margin-right: -20px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    transition: all 0.2s ease;
    color: #666;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.article-modal-close:hover {
    background: rgba(93, 167, 231, 0.1);
    color: #5DA7E7;
    transform: scale(1.1);
}

.article-modal-close i {
    font-size: 16px;
}

/* Modal Header - Fixed with Background */
.article-modal-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: white;
    border-bottom: 1px solid #e9ecef;
    padding: 25px 30px 20px;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Featured image is now shown in content, hide the separate one */
.modal-article-featured-image {
    display: none !important;
}

/* Featured image inside content */
.article-content-featured-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: cover;
    margin: 0 0 25px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block;
}

/* Responsive featured image in content */
@media (max-width: 768px) {
    .article-content-featured-image {
        max-height: 220px;
        margin: 0 0 20px 0;
        border-radius: 6px;
    }
}

@media (max-width: 480px) {
    .article-content-featured-image {
        max-height: 180px;
        margin: 0 0 15px 0;
        border-radius: 4px;
    }
}

.article-modal-meta {
    padding: 0;
}

.article-modal-meta h2 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin: 0 0 15px 0;
    line-height: 1.3;
    padding-right: 50px; /* Space for close button */
}

.article-modal-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.article-meta-separator {
    color: #ccc;
}

/* Modal Body - Two Column Layout */
.article-modal-body {
    padding: 20px 30px 20px;
    overflow-y: auto;
    display: flex;
    gap: 30px;
}

.article-modal-main {
    flex: 1;
    min-width: 0; /* Prevent flex item from overflowing */
}

.article-modal-sidebar {
    width: 280px;
    flex-shrink: 0;
    border-left: 1px solid #e9ecef;
    padding-left: 30px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #5DA7E7;
}

/* Recent Articles List */
.recent-articles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.recent-article-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
}

.recent-article-item:hover {
    background: #f8f9fa;
    border-color: #5DA7E7;
    transform: translateY(-1px);
}

.recent-article-item.current {
    background: #e3f2fd;
    border-color: #5DA7E7;
}

.recent-article-thumbnail {
    width: 60px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
}

.recent-article-info {
    flex: 1;
    min-width: 0;
}

.recent-article-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    margin: 0 0 6px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-article-meta {
    font-size: 12px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recent-article-date {
    font-weight: 500;
}

.recent-article-author {
    opacity: 0.8;
}

.article-modal-excerpt {
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-left: 4px solid #5DA7E7;
    border-radius: 0 6px 6px 0;
}

.article-modal-excerpt p {
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
    color: #555;
    font-style: italic;
}

.article-modal-content-text {
    font-size: 16px;
    line-height: 1.7;
    color: #333;
}

.article-modal-content-text p {
    margin: 0 0 20px 0;
}

.article-modal-content-text p:last-child {
    margin-bottom: 0;
}

.article-modal-content-text h1,
.article-modal-content-text h2,
.article-modal-content-text h3,
.article-modal-content-text h4,
.article-modal-content-text h5,
.article-modal-content-text h6 {
    color: #333;
    margin: 30px 0 15px 0;
    font-weight: 600;
}

.article-modal-content-text h1 { font-size: 24px; }
.article-modal-content-text h2 { font-size: 22px; }
.article-modal-content-text h3 { font-size: 20px; }
.article-modal-content-text h4 { font-size: 18px; }

.article-modal-content-text ul,
.article-modal-content-text ol {
    margin: 15px 0;
    padding-left: 25px;
}

.article-modal-content-text li {
    margin: 8px 0;
}

.article-modal-content-text blockquote {
    margin: 25px 0;
    padding: 20px;
    background: #f8f9fa;
    border-left: 4px solid #5DA7E7;
    border-radius: 0 6px 6px 0;
    font-style: italic;
}

.article-modal-content-text code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
}

.article-modal-content-text pre {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 20px 0;
}

.article-modal-content-text pre code {
    background: none;
    padding: 0;
}

/* Featured image at top of article - specific styling */
.article-modal-content-text .article-featured-image {
    margin-bottom: 2em !important;
    overflow: hidden !important;
}

.article-modal-content-text .article-featured-image img {
    width: 100% !important;
    max-height: 250px !important;
    height: auto !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
    display: block !important;
    margin: 0 !important;
}

/* Image styles for article content */
.article-modal-content-text img {
    max-width: 100%;
    height: auto;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: block !important; /* Override global styles */
    clear: both; /* Ensure images don't float */
}

/* Center images by default */
.article-modal-content-text p img {
    display: block;
    margin: 20px auto;
}

/* Handle images in paragraphs properly */
.article-modal-content-text p:has(img) {
    text-align: center;
}

/* Fallback for browsers that don't support :has() */
.article-modal-content-text p {
    overflow: visible; /* Allow proper image display */
    position: relative; /* Ensure proper stacking context */
}

/* Ensure images don't get repositioned by any global styles */
.article-modal-content-text img {
    position: static !important;
    float: none !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
}

.article-modal-content-text figure {
    margin: 25px 0;
    text-align: center;
}

.article-modal-content-text figure img {
    margin: 0 auto 10px;
}

.article-modal-content-text figcaption {
    font-size: 14px;
    color: #666;
    font-style: italic;
    margin-top: 8px;
}

/* Article Actions */
.article-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid #e9ecef;
}

.article-like-btn {
    background: transparent;
    border: 2px solid #e9ecef;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    color: #666;
}

.article-like-btn:hover {
    border-color: #5DA7E7;
    color: #5DA7E7;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 167, 231, 0.2);
}

.article-like-btn.liked {
    background: #5DA7E7;
    border-color: #5DA7E7;
    color: var(--text-white);
}

.article-like-btn.liked:hover {
    background: #4a8bc2;
    border-color: #4a8bc2;
}

.article-like-btn i {
    font-size: 16px;
    transition: all 0.3s ease;
}

.article-like-btn.liked i {
    color: var(--text-white);
}

.like-text {
    font-size: 14px;
}

/* Share Dropdown */
.share-dropdown {
    position: relative;
}

.article-share-btn {
    background: #5DA7E7;
    color: var(--text-white);
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
}

.article-share-btn:hover {
    background: #4a8bc2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(93, 167, 231, 0.3);
}

.article-share-btn i {
    font-size: 14px;
}

.share-options {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    padding: 8px 0;
    min-width: 180px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.share-options.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.share-option {
    width: 100%;
    background: none;
    border: none;
    padding: 12px 16px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s ease;
}

.share-option:hover {
    background: #f8f9fa;
}

.share-option i {
    width: 20px;
    font-size: 16px;
}

.share-option[data-platform="whatsapp"]:hover {
    background: #e8f5e8;
    color: #25d366;
}

.share-option[data-platform="twitter"]:hover {
    background: #e3f2fd;
    color: #1da1f2;
}

.share-option[data-platform="facebook"]:hover {
    background: #e3f2fd;
    color: #1877f2;
}

.share-option[data-platform="linkedin"]:hover {
    background: #e3f2fd;
    color: #0077b5;
}

.share-option[data-platform="copy"]:hover {
    background: #f0f0f0;
    color: #666;
}

/* Modal Footer */
.article-modal-footer {
    padding: 15px 30px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    justify-content: center;
    min-height: 20px;
}

/* Share Notification */
.share-notification {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Like button animation */
@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.article-like-btn.liked i {
    animation: heartBeat 0.6s ease-in-out;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .article-modal-body {
        flex-direction: column;
        gap: 20px;
    }
    
    .article-modal-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e9ecef;
        padding-left: 0;
        padding-top: 20px;
    }
    
    .recent-articles-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .article-modal {
        padding: 10px;
        align-items: stretch;
    }
    
    .article-modal-content {
        max-height: calc(100vh - 20px);
        height: calc(100vh - 20px);
        max-width: 100%;
        border-radius: 12px;
    }
    
    .article-modal-header {
        padding: 20px 20px 15px;
        border-radius: 8px 8px 0 0;
    }
    
    .article-modal-meta h2 {
        font-size: 24px;
        padding-right: 45px; /* Space for smaller close button */
    }
    
    .article-modal-body {
        padding: 15px 20px 15px;
        flex-direction: column;
        gap: 15px;
    }
    
    .article-modal-sidebar {
        width: 100%;
        border-left: none;
        border-top: 1px solid #e9ecef;
        padding-left: 0;
        padding-top: 15px;
    }
    
    .recent-articles-list {
        grid-template-columns: 1fr;
    }
    
    .article-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-top: 25px;
        padding-top: 20px;
    }
    
    .article-like-btn,
    .article-share-btn {
        padding: 10px 16px;
        font-size: 13px;
        width: 100%;
        justify-content: center;
    }
    
    .share-dropdown {
        width: 100%;
    }
    
    .article-modal-footer {
        padding: 15px 20px 20px;
    }
    
    .article-modal-close {
        position: sticky;
        top: 15px;
        margin-top: -50px;
        margin-right: -15px;
        width: 35px;
        height: 35px;
        z-index: 30;
    }
}

@media (max-width: 480px) {
    .article-modal {
        padding: 8px;
    }
    
    .article-modal-content {
        border-radius: 10px;
        max-height: calc(100vh - 16px);
        height: calc(100vh - 16px);
        width: 100%;
    }
    
    .article-modal-header {
        padding: 15px 15px 12px;
        border-radius: 10px 10px 0 0;
    }
    
    .article-modal-meta h2 {
        font-size: 20px;
        padding-right: 40px;
    }
    
    .article-modal-body {
        padding: 12px 15px 12px;
        gap: 12px;
    }
    
    .article-modal-content-text {
        font-size: 15px;
    }
    
    .article-modal-excerpt {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .sidebar-title {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .recent-article-item {
        padding: 10px;
    }
    
    .recent-article-thumbnail {
        width: 50px;
        height: 38px;
    }
    
    .recent-article-title {
        font-size: 13px;
    }
    
    .recent-article-meta {
        font-size: 11px;
    }
    
    .article-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-top: 20px;
        padding-top: 15px;
    }
    
    .article-like-btn,
    .article-share-btn {
        padding: 10px 16px;
        font-size: 13px;
        justify-content: center;
        width: 100%;
    }
    
    .share-dropdown {
        width: 100%;
    }
    
    .share-options {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100% - 40px);
        max-width: 300px;
    }
    
    .share-options.show {
        transform: translateX(-50%) translateY(0);
    }
    
    .article-modal-close {
        position: sticky;
        top: 12px;
        margin-top: -44px;
        margin-right: -12px;
        width: 32px;
        height: 32px;
        z-index: 30;
    }
}

/* Force light mode for article modal - dark mode disabled */
.article-modal-content {
    background: white !important;
    color: #333 !important;
}

.article-modal-header {
    background: white !important;
    border-bottom-color: #e9ecef !important;
}

.article-modal-meta h2 {
    color: #333 !important;
}

.article-modal-content-text {
    color: #333 !important;
}

.article-modal-content-text h1,
.article-modal-content-text h2,
.article-modal-content-text h3,
.article-modal-content-text h4,
.article-modal-content-text h5,
.article-modal-content-text h6 {
    color: #333 !important;
}

.article-modal-excerpt {
    background: #f8f9fa !important;
    color: #555 !important;
}

.article-modal-content-text blockquote {
    background: #f8f9fa !important;
    color: #333 !important;
}

.article-modal-content-text code {
    background: #f1f3f4 !important;
    color: #333 !important;
}

.article-modal-content-text pre {
    background: #f8f9fa !important;
}

.article-modal-footer {
    border-top-color: #e9ecef !important;
}

.article-modal-sidebar {
    border-left-color: #e9ecef !important;
    border-top-color: #e9ecef !important;
}

.sidebar-title {
    color: #333 !important;
}

.recent-article-item {
    background: white !important;
}

.recent-article-item:hover {
    background: #f8f9fa !important;
    border-color: #5DA7E7 !important;
}

.recent-article-item.current {
    background: #e3f2fd !important;
    border-color: #5DA7E7 !important;
}

.recent-article-title {
    color: #333 !important;
}

.recent-article-meta {
    color: #666 !important;
}

.article-like-btn {
    background: transparent !important;
    border-color: #e9ecef !important;
    color: #666 !important;
}

.share-options {
    background: white !important;
    border-color: #e9ecef !important;
}

.share-option {
    color: #333 !important;
}

.share-option:hover {
    background: #f8f9fa !important;
}