/* Imgur Embed Styles - Minimal Design */

.imgur-embed-pub {
    margin: 1rem 0;
    font-style: normal;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.imgur-embed-pub iframe,
.imgur-embed-pub img {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
}

.imgur-embed-container {
    position: relative;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .imgur-embed-pub {
        margin: 0.5rem 0;
    }
}

/* 順次処理状態 */
.imgur-embed-pub {
    transition: all 0.3s ease;
    position: relative;
}

/* 待機状態 */
.imgur-embed-pub.imgur-waiting {
    opacity: 0.4 !important;
    filter: grayscale(80%) !important;
    pointer-events: none !important;
}

.imgur-embed-pub.imgur-waiting::before {
    content: "imgur待機中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(108, 117, 125, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    z-index: 10;
    white-space: nowrap;
}

/* 処理中状態 */
.imgur-embed-pub.imgur-processing {
    border: 2px solid #007bff !important;
    background: linear-gradient(-45deg, #e3f2fd, #bbdefb, #e3f2fd, #bbdefb) !important;
    background-size: 400% 400% !important;
    animation: processing-gradient 2s ease infinite !important;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2) !important;
}

.imgur-embed-pub.imgur-processing::before {
    content: "imgur読み込み中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 123, 255, 0.95);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 10;
    animation: pulse 1.5s ease-in-out infinite;
    white-space: nowrap;
}

.imgur-embed-pub.imgur-processing::after {
    content: "";
    position: absolute;
    top: calc(50% - 8px);
    left: calc(50% + 80px);
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    z-index: 11;
    animation: spin 1s linear infinite;
}

/* 完了状態 */
.imgur-embed-pub.imgur-completed {
    opacity: 1 !important;
    filter: none !important;
    border: 1px solid #28a745 !important;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.1) !important;
}

/* アニメーション */
@keyframes processing-gradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .imgur-embed-pub {
        margin: 0.5rem 0;
        max-width: 100% !important;
    }

    .imgur-embed-pub.imgur-waiting::before,
    .imgur-embed-pub.imgur-processing::before {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .imgur-embed-pub.imgur-processing::after {
        left: calc(50% + 60px);
        width: 14px;
        height: 14px;
    }

    /* 返信コメント内のimgur対応 */
    .comment[style*="margin-left"] .imgur-embed-pub,
    .comment[style*="margin-left"] .imgur-embed-pub iframe,
    .comment[style*="margin-left"] .imgur-embed-pub img {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* 返信コメントの左マージン・パディング調整 */
    .comment[style*="margin-left"] {
        margin-left: 0 !important;
        padding-left: 0.75rem !important;
    }
}

/* 旧スタイル（互換性維持） */
.imgur-embed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 8px;
}

.imgur-embed-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}