/* Instagram Comments Component - Desktop Optimized */

/* Base settings - using border-box for consistent sizing */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Image Upload Styles */
.instagram-comment-image-upload {
    margin-bottom: 20px;
    width: 100%;
}

.instagram-comment-image-upload label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #262626;
    margin-bottom: 10px;
    width: 100%;
}

.instagram-comment-image-upload-container {
    position: relative;
    width: 100%;
    border: 1px dashed #dbdbdb;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 120px;
}

.instagram-comment-image-upload-container:hover {
    border-color: #8e8e8e;
    background-color: #fafafa;
}

.instagram-comment-image-upload-container input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.instagram-comment-image-upload-container:before {
    content: "+";
    display: block;
    font-size: 32px;
    color: #8e8e8e;
    margin-bottom: 10px;
}

.instagram-comment-image-upload-container:after {
    content: "Click to upload image";
    display: block;
    font-size: 16px;
    color: #8e8e8e;
}

.instagram-comment-image-preview {
    display: none;
    margin-top: 20px;
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.instagram-comment-image-preview.has-image {
    display: block;
    border: 1px solid #dbdbdb;
}

.preview-image {
    width: 100%;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-image.square {
    aspect-ratio: 1/1;
}

.preview-image.portrait {
    aspect-ratio: 4/5;
}

.preview-image.landscape {
    aspect-ratio: 1.91/1;
}

.instagram-comment-image-preview .remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: background 0.3s;
}

.instagram-comment-image-preview .remove-image:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Comment Image Display */
.instagram-comment-image {
    margin-top: 20px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.instagram-comment-image:hover {
    transform: scale(1.01);
}

.instagram-comment-image.instagram-style {
    margin-top: 10px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 100%;
    height: auto;
}

.instagram-comment-image.instagram-style img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.instagram-comment-image.instagram-style.square {
    aspect-ratio: 1/1;
}

.instagram-comment-image.instagram-style.portrait {
    aspect-ratio: 4/5;
}

.instagram-comment-image.instagram-style.landscape {
    aspect-ratio: 1.91/1;
}

/* Instagram Comments Container - Updated for Desktop */
.instagram-comments-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    max-width: 80% !important;
    margin: 0 auto;
    padding: 0 15px;
    margin-top: 30px;
    width: 100%;
}

/* Individual Comment Style */
.instagram-comment {
    display: flex;
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #efefef;
    width: 100%;
    position: relative;
}

.instagram-comment:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Comment Avatar */
.instagram-comment-avatar {
    margin-right: 16px;
    flex-shrink: 0;
}

.instagram-comment-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #dbdbdb;
}

/* Comment Content */
.instagram-comment-content {
    flex: 1;
    min-width: 0; /* Prevents overflow in flex container */
}

/* Comment Meta (Author & Date) */
.instagram-comment-meta {
    margin-bottom: 8px;
    width: 100%;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
}

.instagram-comment-author {
    font-weight: 600;
    font-size: 16px;
    color: #262626;
    margin-right: 10px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.instagram-comment-author:hover {
    color: #0095f6;
    text-decoration: underline;
}

.instagram-comment-date {
    font-size: 14px;
    color: #8e8e8e;
}

/* Comment Text */
.instagram-comment-text {
    font-size: 16px;
    line-height: 1.6;
    color: #262626;
    word-wrap: break-word;
    width: 100%;
}

/* Comment Actions */
.instagram-comment-actions {
    display: flex;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.instagram-comment:hover .instagram-comment-actions {
    opacity: 1;
}

.comment-action-like,
.comment-action-reply {
    display: flex;
    align-items: center;
    margin-right: 15px;
    font-size: 14px;
    color: #8e8e8e;
    cursor: pointer;
    transition: color 0.2s ease;
}

.comment-action-like:hover,
.comment-action-reply:hover {
    color: #262626;
}

.comment-action-like.liked {
    color: #ed4956;
}

.like-count {
    margin-left: 5px;
}

.heart-animation {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 10;
}

.heart-animation.small {
    font-size: 10px;
}

/* Comment Form Styles */
.instagram-comment-form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 30px auto 0;
    padding-top: 24px;
    border-top: 1px solid #efefef;
    width: 80%;
}

.instagram-comment-form-title {
    font-size: 18px;
    font-weight: 600;
    color: #262626;
    margin-bottom: 20px;
    width: 80%;
    text-align: center; /* وسط‌چین شدن عنوان */
}


.instagram-comment-form-container {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
}

.instagram-comment-form-avatar {
    margin-right: 16px;
    flex-shrink: 0;
}

.instagram-comment-form-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid #dbdbdb;
}

.instagram-comment-form-content {
    flex: 1;
    min-width: 0; /* Prevents overflow in flex container */
    min-width: 300px; /* Minimum width for form content */
}

.instagram-comment-form-field {
    margin-bottom: 20px;
    width: 100%;
}

.instagram-comment-form-field input[type="text"],
.instagram-comment-form-field input[type="email"],
.instagram-comment-form-field textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dbdbdb;
    border-radius: 8px;
    font-size: 16px;
    color: #262626;
    background-color: #fafafa;
    transition: all 0.3s ease;
}

.instagram-comment-form-field textarea {
    min-height: 100px;
    resize: vertical;
}

.instagram-comment-form-field input[type="text"]:focus,
.instagram-comment-form-field input[type="email"]:focus,
.instagram-comment-form-field textarea:focus {
    outline: none;
    border-color: #8e8e8e;
    background-color: #fff;
}

.instagram-comment-submit-btn {
    background-color: #0095f6;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: auto;
    display: inline-block;
}

.instagram-comment-submit-btn:hover {
    background-color: #0081d6;
}

.instagram-comment-submit-btn:disabled {
    background-color: #c0dffd;
    cursor: not-allowed;
}

/* Messages */
.instagram-comment-message {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
}

.instagram-comment-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.instagram-comment-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Instagram Image Modal */
.instagram-image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    cursor: pointer;
}

.instagram-image-modal .modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: 5% auto;
    display: block;
    cursor: default;
}

.instagram-image-modal img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

.close-modal {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #ddd;
}

/* Temporary Messages */
.temporary-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 25px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.temporary-message.success {
    background-color: #28a745;
}

.temporary-message.error {
    background-color: #dc3545;
}

.temporary-message.info {
    background-color: #17a2b8;
}

/* Load More Comments Button */
.load-more-comments {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    background-color: #fafafa;
    border: 1px solid #dbdbdb;
    border-radius: 8px;
    color: #262626;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.load-more-comments:hover {
    background-color: #f0f0f0;
}

.load-more-comments:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Dark mode adjustments */
@media (prefers-color-scheme: dark) {
    .instagram-comment-image-upload label,
    .instagram-comment-author,
    .instagram-comment-form-title,
    .instagram-comment-text {
        color: #ffffff;
        align-item: center;
    }
    
    .instagram-comment-image-upload-container,
    .instagram-comment-form {
        border-color: #383838;
    }
    
    .instagram-comment-image-upload-container:hover {
        border-color: #8e8e8e;
        background-color: #262626;
    }
    
    .instagram-comment-image-upload-container:before,
    .instagram-comment-image-upload-container:after {
        color: #a8a8a8;
    }
    
    .instagram-comment {
        border-bottom-color: #262626;
    }
    
    .instagram-comment-form {
        border-top-color: #262626;
    }
    
    .instagram-comment-form-field input[type="text"],
    .instagram-comment-form-field input[type="email"],
    .instagram-comment-form-field textarea {
        background-color: #262626;
        border-color: #383838;
        color: #ffffff;
    }
    
    .instagram-comment-form-field input[type="text"]:focus,
    .instagram-comment-form-field input[type="email"]:focus,
    .instagram-comment-form-field textarea:focus {
        background-color: #121212;
        border-color: #8e8e8e;
    }
    
    .instagram-comment-avatar img,
    .instagram-comment-form-avatar img {
        border-color: #383838;
    }
    
    .instagram-comment-image-preview.has-image {
        border-color: #383838;
    }
    
    .load-more-comments {
        background-color: #262626;
        border-color: #383838;
        color: #ffffff;
    }
    
    .load-more-comments:hover {
        background-color: #383838;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Adjust padding and margins for tablets */
    .instagram-comment-image-upload {
        margin-bottom: 14px;
    }
    
    .instagram-comment-image-upload-container {
        padding: 18px 14px;
        min-height: 90px;
    }
    
    .instagram-comment-image-upload-container:before {
        font-size: 24px;
    }
    
    .instagram-comment-image-preview {
        margin-top: 14px;
    }
    
    .instagram-comment-image-preview .remove-image {
        width: 24px;
        height: 24px;
        font-size: 16px;
    }
    
    .instagram-comment-image {
        margin-top: 14px;
    }
    
    .instagram-comments-container {
        margin-top: 20px;
        padding: 0 10px;
    }
    
    .instagram-comment {
        margin-bottom: 16px;
        padding-bottom: 16px;
    }
    
    .instagram-comment-avatar img {
        width: 36px;
        height: 36px;
    }
    
    .instagram-comment-form {
        margin-top: 20px;
        padding-top: 16px;
    }
    
    .instagram-comment-form-title {
        margin-bottom: 14px;
    }
    
    .instagram-comment-form-field {
        margin-bottom: 14px;
    }
    
    .instagram-comment-form-field input[type="text"],
    .instagram-comment-form-field input[type="email"],
    .instagram-comment-form-field textarea {
        padding: 8px 10px;
    }
    
    .instagram-comment-submit-btn {
        padding: 6px 16px;
    }
    
    .instagram-image-modal .modal-content {
        max-width: 95%;
        max-height: 95%;
        margin: 2.5% auto;
    }
}

@media (max-width: 576px) {
    /* Adjust for mobile devices */
    .instagram-comment-image-upload-container {
        padding: 16px 12px;
        min-height: 80px;
    }
    
    .instagram-comment-image-upload-container:before {
        font-size: 22px;
        margin-bottom: 6px;
    }
    
    .instagram-comment-image-upload-container:after {
        font-size: 13px;
    }
    
    .instagram-comment-image-preview .remove-image {
        width: 22px;
        height: 22px;
        font-size: 14px;
    }
    
    .instagram-comment {
        margin-bottom: 14px;
        padding-bottom: 14px;
    }
    
    .instagram-comment-avatar {
        margin-right: 10px;
    }
    
    .instagram-comment-avatar img {
        width: 32px;
        height: 32px;
    }
    
    .instagram-comment-meta {
        margin-bottom: 4px;
    }
    
    .instagram-comment-author {
        font-size: 13px;
    }
    
    .instagram-comment-date {
        font-size: 11px;
    }
    
    .instagram-comment-text {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .instagram-comment-form {
        margin-top: 18px;
        padding-top: 14px;
        width: 90%;
    }
    
    .instagram-comment-form-title {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .instagram-comment-form-container {
        flex-direction: column;
    }
    
    .instagram-comment-form-avatar {
        margin-right: 0;
        margin-bottom: 12px;
        align-self: flex-start;
    }
    
    .instagram-comment-form-content {
        min-width: 100%;
    }
    
    .instagram-comment-form-field {
        margin-bottom: 12px;
    }
    
    .instagram-comment-form-field input[type="text"],
    .instagram-comment-form-field input[type="email"],
    .instagram-comment-form-field textarea {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .instagram-comment-submit-btn {
        padding: 6px 14px;
        font-size: 13px;
    }
    
    .instagram-image-modal .modal-content {
        max-width: 98%;
        max-height: 98%;
        margin: 1% auto;
    }
    
    .close-modal {
        top: -30px;
        font-size: 24px;
    }
    
    .temporary-message {
        width: 90%;
        padding: 12px 20px;
        font-size: 14px;
    }
}