/**
 * 圈子链接卡片样式
 * 用于圈子编辑器中的链接卡片功能
 * 版本：1.0.0
 */

/* 链接卡片主容器 */
.pixelshare-link-card {
    border: 1px solid var(--border-color-base, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    margin: 16px 0;
    background: var(--bg-main-color, #ffffff);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.pixelshare-link-card:hover {
    border-color: var(--theme-color, #007cba);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 链接卡片容器 */
.link-card-container {
    display: flex;
    text-decoration: none;
    color: inherit;
    width: 100%;
    min-height: 120px;
}

.link-card-container:hover {
    text-decoration: none;
    color: inherit;
}

/* 链接卡片图片 */
.link-card-image {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    overflow: hidden;
    background: var(--bg-muted-color, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: center;
}

.link-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 链接卡片内容 */
.link-card-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

/* 链接卡片头部 */
.link-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.link-card-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    flex-shrink: 0;
}

.link-card-site {
    font-size: 12px;
    color: var(--color-text-secondary, #6b7280);
    font-weight: 500;
}

/* 链接卡片标题 */
.link-card-title {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--color-text-primary, #1f2937);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 链接卡片描述 */
.link-card-description {
    margin: 0 0 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--color-text-regular, #4b5563);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 链接卡片URL */
.link-card-url {
    font-size: 12px;
    color: var(--color-text-secondary, #6b7280);
    word-break: break-all;
    margin-top: auto;
}

/* 外部链接图标 */
.link-card-external {
    position: absolute;
    top: 12px;
    right: 12px;
    color: var(--color-text-secondary, #6b7280);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pixelshare-link-card:hover .link-card-external {
    opacity: 1;
}

.link-card-external i {
    font-size: 16px;
}

/* 链接卡片模态框 */
.pixelshare-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pixelshare-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.pixelshare-modal-content {
    position: relative;
    background: var(--bg-main-color, #ffffff);
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
}

.pixelshare-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color-base, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pixelshare-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-primary, #1f2937);
}

.pixelshare-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text-secondary, #6b7280);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pixelshare-modal-close:hover {
    background: var(--bg-muted-color, #f8f9fa);
    color: var(--color-text-primary, #1f2937);
}

.pixelshare-modal-body {
    padding: 24px;
}

/* 链接输入组 */
.link-input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.link-url-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border-color-base, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.link-url-input:focus {
    outline: none;
    border-color: var(--theme-color, #007cba);
    box-shadow: 0 0 0 3px rgba(0, 123, 186, 0.1);
}

.parse-link-btn {
    padding: 12px 20px;
    background: var(--theme-color, #007cba);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.parse-link-btn:hover {
    background: var(--theme-color-hover, #005a8b);
}

.parse-link-btn:disabled {
    background: var(--color-text-secondary, #6b7280);
    cursor: not-allowed;
}

/* 链接卡片预览 */
.link-card-preview {
    border: 1px solid var(--border-color-base, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
}

/* 加载状态 */
.link-card-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--color-text-secondary, #6b7280);
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color-base, #e5e7eb);
    border-top: 2px solid var(--theme-color, #007cba);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner + span {
    margin-left: 12px;
    font-size: 14px;
}

/* 模态框底部 */
.pixelshare-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color-base, #e5e7eb);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.btn-cancel,
.btn-confirm {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: none;
    border: 1px solid var(--border-color-base, #e5e7eb);
    color: var(--color-text-regular, #4b5563);
}

.btn-cancel:hover {
    background: var(--bg-muted-color, #f8f9fa);
}

.btn-confirm {
    background: var(--theme-color, #007cba);
    border: 1px solid var(--theme-color, #007cba);
    color: white;
}

.btn-confirm:hover:not(:disabled) {
    background: var(--theme-color-hover, #005a8b);
    border-color: var(--theme-color-hover, #005a8b);
}

.btn-confirm:disabled {
    background: var(--color-text-secondary, #6b7280);
    border-color: var(--color-text-secondary, #6b7280);
    cursor: not-allowed;
    opacity: 0.6;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .link-card-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .link-card-image {
        width: 100%;
        height: 160px;
    }
    
    .link-card-content {
        padding: 12px;
    }
    
    .pixelshare-modal {
        padding: 10px;
    }
    
    .pixelshare-modal-content {
        max-height: 95vh;
    }
    
    .link-input-group {
        flex-direction: column;
    }
    
    .pixelshare-modal-footer {
        flex-direction: column-reverse;
    }
    
    .btn-cancel,
    .btn-confirm {
        width: 100%;
        justify-content: center;
    }
}

@media screen and (max-width: 480px) {
    .link-card-content {
        padding: 10px;
    }
    
    .link-card-title {
        font-size: 15px;
    }
    
    .link-card-description {
        font-size: 13px;
    }
    
    .pixelshare-modal-header,
    .pixelshare-modal-body {
        padding: 16px;
    }
}

/* 暗黑模式支持 */
.dark-theme .pixelshare-link-card {
    border-color: var(--border-color-base);
    background: var(--bg-main-color);
}

.dark-theme .pixelshare-modal-content {
    background: var(--bg-main-color);
}

.dark-theme .link-url-input {
    background: var(--bg-body-color);
    border-color: var(--border-color-base);
    color: var(--color-text-primary);
}

.dark-theme .link-url-input:focus {
    border-color: var(--theme-color);
}

/* 无图片时的占位符 */
.link-card-image.no-image {
    background: linear-gradient(135deg, var(--bg-muted-color, #f8f9fa) 0%, var(--border-color-base, #e5e7eb) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary, #6b7280);
    font-size: 24px;
}

.link-card-image.no-image::before {
    content: '🔗';
}