/* ============================================
   TVBox JSON Formatter Tool
   myyinghe.com - 硬核工坊
   ============================================ */

.tvbox-tool-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    color: #333;
    line-height: 1.6;
}

/* Header */
.tvbox-tool-header {
    text-align: center;
    margin-bottom: 24px;
}

.tvbox-tool-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px;
    letter-spacing: -0.5px;
}

.tvbox-tool-header p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Toolbar */
.tvbox-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.tvbox-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    color: #495057;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-weight: 500;
    white-space: nowrap;
}

.tvbox-btn:hover {
    background: #e9ecef;
    border-color: #ced4da;
    transform: translateY(-1px);
}

.tvbox-btn:active {
    transform: translateY(0);
}

.tvbox-btn.primary {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.tvbox-btn.primary:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.tvbox-btn.success {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.tvbox-btn.success:hover {
    background: #218838;
    border-color: #1e7e34;
}

.tvbox-btn.danger {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.tvbox-btn.danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.tvbox-btn svg {
    flex-shrink: 0;
}

/* Main Layout */
.tvbox-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .tvbox-main {
        grid-template-columns: 1fr;
    }
    .tvbox-toolbar {
        justify-content: center;
    }
    .tvbox-btn {
        font-size: 13px;
        padding: 7px 12px;
    }
}

/* Panel */
.tvbox-panel {
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.tvbox-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.tvbox-panel-body {
    flex: 1;
    position: relative;
    min-height: 420px;
}

/* Input Textarea */
.tvbox-textarea {
    width: 100%;
    height: 100%;
    min-height: 420px;
    padding: 14px;
    border: none;
    outline: none;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", "Noto Sans Mono CJK SC", monospace;
    font-size: 13px;
    line-height: 1.7;
    resize: vertical;
    background: #fafbfc;
    color: #24292e;
    tab-size: 4;
    -moz-tab-size: 4;
}

.tvbox-textarea::placeholder {
    color: #adb5bd;
}

/* Output Area */
.tvbox-output {
    width: 100%;
    height: 100%;
    min-height: 420px;
    padding: 14px;
    margin: 0;
    overflow: auto;
    background: #fafbfc;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", Consolas, "Courier New", "Noto Sans Mono CJK SC", monospace;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-all;
    tab-size: 4;
    -moz-tab-size: 4;
    border: none;
    color: #24292e;
}

.tvbox-output code {
    font-family: inherit;
    background: transparent;
    padding: 0;
}

/* JSON Syntax Highlighting */
.json-key   { color: #005cc5; font-weight: 600; }
.json-string{ color: #032f62; }
.json-number{ color: #22863a; font-weight: 600; }
.json-bool  { color: #d73a49; font-weight: 600; }
.json-null  { color: #6f42c1; font-weight: 600; }
.json-punc  { color: #24292e; }

/* Error Line Highlight */
.error-line {
    background: #ffe6e6;
    display: inline-block;
    width: 100%;
    border-left: 3px solid #dc3545;
    padding-left: 11px;
    margin-left: -14px;
    box-sizing: content-box;
}

/* Status Bar */
.tvbox-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    font-size: 13px;
    color: #495057;
    flex-wrap: wrap;
    gap: 8px;
}

.tvbox-status-bar .status-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.tvbox-status-bar .status-msg.success { color: #28a745; }
.tvbox-status-bar .status-msg.error   { color: #dc3545; }
.tvbox-status-bar .status-msg.warning { color: #e67700; }
.tvbox-status-bar .status-msg.default { color: #495057; }

.tvbox-meta {
    display: flex;
    gap: 16px;
    color: #868e96;
    font-size: 12px;
}

/* Scrollbar */
.tvbox-textarea::-webkit-scrollbar,
.tvbox-output::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tvbox-textarea::-webkit-scrollbar-track,
.tvbox-output::-webkit-scrollbar-track {
    background: transparent;
}

.tvbox-textarea::-webkit-scrollbar-thumb,
.tvbox-output::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.tvbox-textarea::-webkit-scrollbar-thumb:hover,
.tvbox-output::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Toast Notification */
.tvbox-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2d2d2d;
    color: #fff;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    pointer-events: none;
    white-space: nowrap;
}

.tvbox-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Copy button active state */
.tvbox-btn.copied {
    background: #28a745 !important;
    color: #fff !important;
    border-color: #28a745 !important;
}
