
/* URL Preview Card Enhanced v1.4 - 자동 감지 + 이미지 잘림 해결 */
.wp-block-url-preview-card {
    max-width: 500px;
    margin: 20px 0;
}

.wp-block-url-preview-card.align-center {
    margin-left: auto;
    margin-right: auto;
}

.wp-block-url-preview-card.align-right {
    margin-left: auto;
    margin-right: 0;
}

.url-preview-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.url-preview-item {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.url-preview-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    border-color: #007cba;
}

.url-preview-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.url-preview-image::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 49%, rgba(0,0,0,0.02) 50%, transparent 51%);
    pointer-events: none;
}

.url-preview-image img {
    width: 100%;
    height: 100%;
    /* 이미지 전체가 보이도록 contain으로 설정 (잘림 방지) */
    object-fit: contain !important;
    object-position: center !important;
    transition: transform 0.3s ease;
    background-color: #f8f9fa;
}

/* 호버 효과는 contain 모드에서도 부드럽게 작동 */
.url-preview-item:hover .url-preview-image img {
    transform: scale(1.02) !important;
}

.url-preview-content {
    padding: 20px;
}

.url-preview-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-decoration: none;
}

.url-preview-description {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.url-preview-domain {
    font-size: 12px;
    color: #007cba;
    background: linear-gradient(135deg, #f0f8ff 0%, #e6f3ff 100%);
    padding: 4px 8px;
    border-radius: 6px;
    display: inline-block;
    font-weight: 500;
    border: 1px solid rgba(0, 124, 186, 0.2);
}

.url-preview-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 2px dashed #007cba;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.url-preview-placeholder::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 40%, rgba(0, 124, 186, 0.05) 50%, transparent 60%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .url-preview-item {
        background: #1a1a1a;
        border-color: #333;
        color: #fff;
    }
    
    .url-preview-title {
        color: #fff;
    }
    
    .url-preview-description {
        color: #ccc;
    }
    
    .url-preview-image {
        background: #2a2a2a;
    }
    
    .url-preview-domain {
        background: linear-gradient(135deg, #003d5c 0%, #004a6b 100%);
        color: #87ceeb;
        border-color: rgba(135, 206, 235, 0.3);
    }
    
    .url-preview-placeholder {
        background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
        border-color: #007cba;
        color: #ccc;
    }
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .wp-block-url-preview-card {
        max-width: 100%;
        margin: 15px 0;
    }
    
    .url-preview-image {
        height: 160px;
    }
    
    .url-preview-content {
        padding: 15px;
    }
    
    .url-preview-title {
        font-size: 16px;
    }
    
    .url-preview-description {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .url-preview-image {
        height: 140px;
    }
    
    .url-preview-content {
        padding: 12px;
    }
    
    .url-preview-title {
        font-size: 15px;
    }
}

/* 접근성 개선 */
@media (prefers-reduced-motion: reduce) {
    .url-preview-item,
    .url-preview-image img {
        transition: none;
    }
    
    .url-preview-placeholder::before {
        animation: none;
    }
}

/* 고대비 모드 지원 */
@media (prefers-contrast: high) {
    .url-preview-item {
        border-width: 2px;
        border-color: #000;
    }
    
    .url-preview-domain {
        border-width: 2px;
        background: #000;
        color: #fff;
    }
}
