/* Modal Base Styles */
.aem-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 200000;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.aem-modal.is-open {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.aem-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.aem-dialog {
    position: relative;
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.aem-modal.is-open .aem-dialog {
    transform: scale(1);
}

.aem-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.aem-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.aem-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.aem-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.aem-content {
    line-height: 1.6;
}

.aem-error {
    color: #d32f2f;
    background: #ffebee;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #d32f2f;
}

/* Repost Section Styles */


.aem-repost-form {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.aem-repost-content {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    background: white;
    transition: border-color 0.2s ease;
}

.aem-repost-content:focus {
    outline: none;
    border-color: #1e73be;
    box-shadow: 0 0 0 2px rgba(30, 115, 190, 0.1);
}

.aem-repost-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aem-repost-btn {
    background: #1e73be;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.aem-repost-btn:hover {
    background: #155a8a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 115, 190, 0.3);
}

.aem-repost-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.aem-repost-btn.shared {
    background: #28a745;
}

.aem-repost-btn.shared:hover {
    background: #218838;
}

.aem-char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

.aem-char-counter.warning {
    color: #d32f2f;
    font-weight: 500;
}

.aem-repost-status {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
}

.aem-repost-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.aem-repost-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.aem-repost-login-required {
    text-align: center;
    padding: 20px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
}

.aem-repost-login-required p {
    margin: 0 0 15px 0;
    color: #0066cc;
}

.aem-login-btn {
    display: inline-block;
    background: #0066cc;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.aem-login-btn:hover {
    background: #0052a3;
    color: white;
    text-decoration: none;
}

/* Body class when modal is open */
body.aem-modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aem-dialog {
        width: 95vw;
        margin: 20px;
    }
    
    .aem-body {
        padding: 15px;
    }
    
    .aem-repost-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .aem-repost-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Animation for status messages */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aem-repost-status {
    animation: slideInDown 0.3s ease;
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner.fa-spin {
    animation: spin 1s linear infinite;
}

/* LinkedIn-style Post Preview Card */
.aem-post-preview-card {
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin-top: 12px;
    transition: box-shadow 0.2s ease;
    display: flex;
}

.aem-post-preview-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.aem-preview-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f3f6f8;
}

.aem-preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.aem-preview-image:hover img {
    transform: scale(1.02);
}

.aem-preview-content {
    padding: 16px;
}

.aem-preview-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.aem-preview-author {
    font-weight: 600;
    color: #0073b1;
}

.aem-preview-date::before {
    content: "•";
    margin-right: 8px;
}

.aem-preview-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.aem-preview-title a {
    color: #000;
    text-decoration: none;
    transition: color 0.2s ease;
}

.aem-preview-title a:hover {
    color: #0073b1;
    text-decoration: underline;
}

.aem-preview-excerpt {
    margin: 0 0 12px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aem-preview-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 12px;
}

.aem-preview-link i {
    font-size: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .aem-preview-image {
        height: 150px;
    }
    
    .aem-preview-content {
        padding: 12px;
    }
    
    .aem-preview-title {
        font-size: 14px;
    }
}
/* URL Preview Card Styles */
.aem-post-preview-card {
    display: flex;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
    margin: 15px 0;
    background: #f8f9fa;
    transition: all 0.2s ease;
    max-width: 100%;
}
.aem-repost-modal {
    display: none;
}
.aem-post-preview-card:hover {
    border-color: #0073b1;
    box-shadow: 0 2px 8px rgba(0, 115, 177, 0.1);
}

.aem-preview-thumbnail {
    width: 278px !important;
    border-right: 1px solid rgb(70 77 87 / 10%);
    margin-bottom: 0px !important;
    overflow: hidden;
}

.aem-preview-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.aem-preview-content {
    flex: 1;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.aem-preview-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #666;
}

.aem-preview-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.aem-preview-title a {
    color: #0073b1;
    text-decoration: none;
}

.aem-preview-title a:hover {
    text-decoration: underline;
}

.aem-preview-excerpt {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aem-preview-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #0073b1;
}

.aem-preview-link i {
    font-size: 10px;
}

/* Responsive design */
@media (max-width: 768px) {
    .aem-post-preview-card {
        flex-direction: column;
    }
    
    .aem-preview-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .aem-preview-meta {
        flex-direction: column;
        gap: 5px;
    }
}

/* Integration with PeepSo */
.ps-post__content .aem-post-preview-card,
.ps-comment__content .aem-post-preview-card {
    margin-top: 10px;
}
/* Modal Base Styles */
.aem-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999; /* Increased to ensure it's above PeepSo elements */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    background: rgba(0, 0, 0, 0.8);
}

.aem-modal.is-open {
    display: flex;
    opacity: 1;
    align-items: center;
    justify-content: center;
}

.aem-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    cursor: pointer;
}

.aem-dialog {
    position: relative;
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    z-index: 1000000; /* Ensure dialog is above backdrop */
}

.aem-modal.is-open .aem-dialog {
    transform: scale(1);
}

.aem-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    z-index: 1000001; /* Above dialog */
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.aem-close-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

.aem-body {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.aem-loading {
    text-align: center;
    padding: 40px;
    color: #666;
    position: relative;
}

.aem-loading .fa-spinner {
    font-size: 24px;
    margin-bottom: 10px;
}

.aem-content {
    line-height: 1.6;
}

.aem-error {
    color: #d32f2f;
    background: #ffebee;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #d32f2f;
}

/* Repost Section Styles */

.aem-repost-form {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.aem-repost-content {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    background: white;
    transition: border-color 0.2s ease;
}

.aem-repost-content:focus {
    outline: none;
    border-color: #1e73be;
    box-shadow: 0 0 0 2px rgba(30, 115, 190, 0.1);
}

.aem-repost-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.aem-repost-btn {
    background: #1e73be;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
    min-width: 140px;
    justify-content: center;
}

.aem-repost-btn:hover:not(:disabled) {
    background: #155a8a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 115, 190, 0.3);
}

.aem-repost-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.aem-repost-btn.is-busy {
    background: #1e73be;
    cursor: wait;
}

.aem-repost-btn.shared {
    background: #28a745;
}

.aem-repost-btn.shared:hover {
    background: #218838;
}

/* Loading spinner for button */
.aem-repost-btn .fa-spinner {
    animation: spin 1s linear infinite;
}

.aem-char-counter {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
}

.aem-char-counter.warning {
    color: #d32f2f;
    font-weight: 500;
}

.aem-repost-status {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
    align-items: center;
    gap: 8px;
    animation: slideInDown 0.3s ease;
}

.aem-repost-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: flex;
}

.aem-repost-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: flex;
}

.aem-repost-login-required {
    text-align: center;
    padding: 20px;
    background: #f0f8ff;
    border: 1px solid #b3d9ff;
    border-radius: 6px;
}

.aem-repost-login-required p {
    margin: 0 0 15px 0;
    color: #0066cc;
}

.aem-login-btn {
    display: inline-block;
    background: #0066cc;
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.aem-login-btn:hover {
    background: #0052a3;
    color: white;
    text-decoration: none;
}

/* PeepSo Modal Integration */
.aem-repost-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000000; /* Higher than PeepSo modals */
    background: rgba(0, 0, 0, 0.8);
    align-items: center;
    justify-content: center;
}

.aem-repost-modal.show {
    display: flex;
}

/* PeepSo Window Override */
#ps-window {
    z-index: 999998 !important; /* Ensure it's below our repost modal */
}

/* Body class when modal is open */
body.aem-modal-open {
    overflow: hidden;
}

/* Responsive Design */
@media (max-width: 768px) {
    .aem-dialog {
        width: 95vw;
        margin: 20px;
    }
    
    .aem-body {
        padding: 15px;
    }
    
    .aem-repost-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .aem-repost-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Animation for status messages */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading spinner animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.fa-spinner.fa-spin {
    animation: spin 1s linear infinite;
}

/* ... existing code ... */