/**
 * FPT Code Highlighter - Highlight.js Light Theme
 * Clean and professional styling
 */

/* Main code block container */
.fpt-code-block {
    margin: 2em 0;
    border-radius: 8px;
    overflow: hidden;
    background: rgb(251, 251, 251);
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    transition: all 0.3s ease;
}

.fpt-code-block:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
}

/* Header section */
.fpt-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 20px;
    background: rgb(233, 234, 235);
    border-bottom: 1px solid #d1d5db;
}

.fpt-code-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Copy button */
.fpt-copy-button {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: transparent;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    color: #374151;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin-bottom: 0;
    min-height: auto;
    line-height: normal;
	margin-right: 0;
    margin-left: auto;
}

.entry-content .fpt-code-block{}

.fpt-copy-button:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111827;
}

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

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

.fpt-copy-button.copied {
    background: #10b981;
    border-color: #10b981;
    color: #fff;
}

.fpt-copy-button.copied .fpt-copy-text::after {
    content: ' ✓';
}

/* Code content area */
.fpt-code-content {
    position: relative;
    overflow: auto;
    background: rgb(251, 251, 251);
}

.fpt-code-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.fpt-code-content::-webkit-scrollbar-track {
    background: rgb(251, 251, 251);
}

.fpt-code-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.fpt-code-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Pre and Code elements */
.fpt-code-content pre {
    margin: 0;
    padding: 20px;
    background: rgb(251, 251, 251) !important;
    font-size: 14px;
    line-height: 1.45;
    overflow: visible;
}

.fpt-code-content code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    background: transparent !important;
    display: block;
    padding: 0 !important;
    line-height: 1.45;
}

/* Highlight.js line numbers styling */
.fpt-code-content .hljs-ln {
    border-collapse: collapse;
    width: 100%;
}

.fpt-code-content .hljs-ln tbody {
    display: table-row-group;
}

.fpt-code-content .hljs-ln tr {
    display: table-row;
}

.fpt-code-content .hljs-ln td {
    padding: 0;
    margin: 0;
    border: none;
    line-height: 1.45;
}

.fpt-code-content .hljs-ln-numbers {
    text-align: right;
    color: #9ca3af;
    border-right: 1px solid #d1d5db;
    vertical-align: top;
    padding-right: 12px !important;
    padding-left: 0 !important;
    width: 40px;
    user-select: none;
    white-space: nowrap;
}

.fpt-code-content .hljs-ln-code {
    padding-left: 16px !important;
    white-space: pre;
}

/* Responsive design */
@media (max-width: 768px) {
    .fpt-code-block {
        margin: 1.5em 0;
        border-radius: 6px;
    }

    .fpt-code-header {
        padding: 10px 15px;
    }

    .fpt-code-title {
        font-size: 12px;
    }

    .fpt-copy-button {
        padding: 5px 10px;
        font-size: 11px;
    }

    .fpt-code-content pre {
        padding: 15px;
        font-size: 13px;
    }

    .fpt-code-content code {
        font-size: 13px;
    }

    .fpt-copy-button svg {
        width: 12px;
        height: 12px;
    }
}

@media (max-width: 480px) {
    .fpt-code-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .fpt-copy-button {
        align-self: flex-end;
    }

    .fpt-code-content pre {
        font-size: 12px;
    }

    .fpt-code-content code {
        font-size: 12px;
    }
}

/* Print styles */
@media print {
    .fpt-code-block {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .fpt-copy-button {
        display: none;
    }

    .fpt-code-content {
        background: #fff !important;
    }

    .fpt-code-content pre {
        background: #fff !important;
    }
}

/* Animation for copy feedback */
@keyframes copySuccess {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.fpt-copy-button.copied {
    animation: copySuccess 0.3s ease;
}

/* Focus styles for accessibility */
.fpt-copy-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.fpt-copy-button:focus:not(:focus-visible) {
    outline: none;
}
