/**
 * Kashiwazaki SEO Code Clipper - Frontend Styles
 */

/* コードブロックラッパー */
.kscc-code-wrapper {
    position: relative;
    margin: 1em 0;
}

/* コードブロック（pre要素） */
.kscc-code-wrapper pre {
    margin: 0;
    padding: 1.5em;
    padding-top: 2.5em;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
}

.kscc-code-wrapper pre code {
    background: transparent;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

/* 言語ラベル */
.kscc-language-label {
    position: absolute;
    top: 8px;
    left: 8px;
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.9);
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    z-index: 10;
    user-select: none;
}

/* コピーボタン */
.kscc-copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.kscc-copy-button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 1);
}

.kscc-copy-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.kscc-copy-button:active {
    transform: scale(0.95);
}

/* コピー完了状態 */
.kscc-copy-button.kscc-copied {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* SVGアイコン */
.kscc-copy-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ツールチップ */
.kscc-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    background-color: #1f2937;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.kscc-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
}

.kscc-copy-button:hover .kscc-tooltip,
.kscc-copy-button:focus .kscc-tooltip {
    opacity: 1;
    visibility: visible;
}

/* コピー完了時のツールチップ */
.kscc-copy-button.kscc-copied .kscc-tooltip {
    opacity: 1;
    visibility: visible;
    background-color: #22c55e;
}

.kscc-copy-button.kscc-copied .kscc-tooltip::after {
    border-top-color: #22c55e;
}

/* ========================================
   インラインコード用スタイル
   ======================================== */

/* インラインコードラッパー */
.kscc-inline-code-wrapper {
    display: inline-flex;
    align-items: center;
    position: relative;
    vertical-align: baseline;
}

.kscc-inline-code-wrapper code {
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
    font-size: 0.9em;
}

/* インラインコピーボタン */
.kscc-inline-copy-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-left: 4px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
    vertical-align: middle;
}

.kscc-inline-copy-button:hover {
    background-color: rgba(0, 0, 0, 0.15);
    color: rgba(0, 0, 0, 0.8);
}

.kscc-inline-copy-button:focus {
    outline: 2px solid rgba(0, 0, 0, 0.2);
    outline-offset: 1px;
}

.kscc-inline-copy-button:active {
    transform: scale(0.95);
}

/* インラインコピー完了状態 */
.kscc-inline-copy-button.kscc-copied {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* インラインSVGアイコン */
.kscc-inline-copy-button svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* インラインツールチップ */
.kscc-inline-copy-button .kscc-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 4px;
    padding: 3px 6px;
    font-size: 10px;
    font-weight: 500;
    color: #fff;
    background-color: #1f2937;
    border-radius: 3px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    z-index: 1000;
}

.kscc-inline-copy-button .kscc-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid transparent;
    border-top-color: #1f2937;
}

.kscc-inline-copy-button:hover .kscc-tooltip,
.kscc-inline-copy-button:focus .kscc-tooltip {
    opacity: 1;
    visibility: visible;
}

.kscc-inline-copy-button.kscc-copied .kscc-tooltip {
    opacity: 1;
    visibility: visible;
    background-color: #22c55e;
}

.kscc-inline-copy-button.kscc-copied .kscc-tooltip::after {
    border-top-color: #22c55e;
}

/* ========================================
   レスポンシブ対応
   ======================================== */

@media (max-width: 600px) {
    .kscc-code-wrapper pre {
        padding: 1em;
        padding-top: 2.5em;
        font-size: 13px;
    }

    .kscc-copy-button {
        width: 28px;
        height: 28px;
    }

    .kscc-copy-button svg {
        width: 14px;
        height: 14px;
    }

    .kscc-language-label {
        font-size: 10px;
        padding: 2px 8px;
    }

    .kscc-inline-copy-button {
        width: 18px;
        height: 18px;
    }

    .kscc-inline-copy-button svg {
        width: 10px;
        height: 10px;
    }
}
