/* ============================================
   JSON Formatter Tool Specific Styles
   ============================================ */

:root {
    /* Dark Mode (Default) */
    --jf-primary: #818cf8;
    --jf-primary-hover: #6366f1;
    --jf-primary-soft: rgba(129, 140, 248, 0.22);
    --jf-bg-surface: #1e293b;
    --jf-bg-surface-2: #0f172a;
    --jf-border: #334155;
    --jf-text-main: #f1f5f9;
    --jf-text-muted: #94a3b8;
    --jf-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --jf-radius: 12px;
    --jf-font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

[data-theme="light"] {
    /* Light Mode */
    --jf-primary: #a89850;
    --jf-primary-hover: #c07870;
    --jf-primary-soft: rgba(168, 152, 80, 0.24);
    --jf-bg-surface: #efe4d6;
    --jf-bg-surface-2: #e2d5c4;
    --jf-border: #cdbfac;
    --jf-text-main: #2f2a21;
    --jf-text-muted: #5b5246;
    --jf-shadow: 0 4px 6px -1px rgba(47, 42, 33, 0.12), 0 2px 4px -2px rgba(47, 42, 33, 0.08);
}

/* 히어로 레이아웃/외형은 공통 styles.css의 .hero 규칙을 사용 */

/* Layout & Common (scoped to JSON formatter content) */
.json-formatter-page .json-workspace {
    margin: 0 auto;
}

.json-formatter-page .json-sticky {
    position: sticky;
    top: 88px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--jf-primary-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(14px);
    margin-bottom: 1.5rem;
}

[data-theme="light"] .json-formatter-page .json-sticky {
    background: rgba(239, 228, 214, 0.9);
}

@media (max-width: 720px) {
    .json-formatter-page .json-sticky {
        top: 72px;
    }
}

.json-formatter-page .json-sticky-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.json-formatter-page .json-title {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--jf-text-main);
}

.json-formatter-page .json-title-text {
    font-size: 1rem;
}

.json-formatter-page .json-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid var(--jf-border);
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
    color: var(--jf-text-muted);
}

.json-formatter-page .json-subtitle {
    margin: 0;
    font-size: 0.85rem;
    color: var(--jf-text-muted);
}

.json-formatter-page .json-sticky-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.json-formatter-page .workspace-grid.json-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (max-width: 1024px) {
    .json-formatter-page .workspace-grid.json-split {
        grid-template-columns: 1fr;
    }
}

/* Card Styles */
/* Card Styles */
.json-formatter-page .card {
    background: var(--jf-bg-surface);
    border: 1px solid var(--jf-primary-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Toolbar */
/* Toolbar */
.json-formatter-page .toolbar-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.json-formatter-page .action-group {
    display: flex;
    gap: 0.5rem;
}

.json-formatter-page .divider-vertical {
    width: 1px;
    height: 24px;
    background-color: var(--jf-border);
    margin: 0 0.5rem;
    display: none;
}

@media (min-width: 768px) {
    .json-formatter-page .divider-vertical {
        display: block;
    }
}

/* Buttons (workspace & IO actions만 커스터마이징) */
.json-formatter-page .json-sticky .btn,
.json-formatter-page .io-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid transparent;
}

.json-formatter-page .json-sticky .btn.primary {
    background-color: var(--jf-primary);
    color: white;
}

.json-formatter-page .json-sticky .btn.primary:hover {
    background-color: var(--jf-primary-hover);
    transform: translateY(-1px);
}

.json-formatter-page .json-sticky .btn.secondary {
    background-color: var(--jf-bg-surface-2);
    color: var(--jf-text-main);
    border-color: var(--jf-border);
}

.json-formatter-page .json-sticky .btn.secondary:hover {
    background-color: var(--jf-border);
}

.json-formatter-page .json-sticky .btn.ghost,
.json-formatter-page .io-actions .btn.ghost {
    background-color: transparent;
    color: var(--jf-text-muted);
}

.json-formatter-page .json-sticky .btn.ghost:hover,
.json-formatter-page .io-actions .btn.ghost:hover {
    background-color: var(--jf-bg-surface-2);
    color: var(--jf-text-main);
}

.json-formatter-page .io-actions .btn.sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
}

/* IO Cards */
.json-formatter-page .io-card {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: var(--jf-bg-surface);
    border: 1px solid var(--jf-primary-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.json-formatter-page .io-header {
    padding: 0.75rem 1rem;
    background: var(--jf-bg-surface-2);
    border-bottom: 1px solid var(--jf-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.json-formatter-page .io-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--jf-text-main);
}

.json-formatter-page .io-title .icon {
    color: var(--jf-primary);
}

.json-formatter-page .editor-wrapper {
    flex: 1;
    position: relative;
    background: var(--jf-bg-surface);
}

.json-formatter-page .io-card textarea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    padding: 1rem;
    font-family: var(--jf-font-mono);
    font-size: 14px;
    line-height: 1.6;
    background: transparent;
    color: var(--jf-text-main);
}

.json-formatter-page .io-card textarea:focus {
    outline: none;
    background: rgba(129, 140, 248, 0.06);
}

[data-theme="light"] .json-formatter-page .io-card textarea:focus {
    background: rgba(168, 152, 80, 0.1);
}

.json-formatter-page .io-footer {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--jf-border);
    background: var(--jf-bg-surface-2);
    font-size: 0.8rem;
    color: var(--jf-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.json-formatter-page .io-metrics {
    display: flex;
    gap: 1rem;
    font-family: var(--jf-font-mono);
}

/* Error Panel */
.json-formatter-page .error-panel {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 1rem;
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideDown 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.json-formatter-page .error-panel[hidden] {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status Toast */
.json-formatter-page #status {
    font-weight: 500;
    transition: opacity 0.3s;
}

/* Scrollbar */
.json-formatter-page textarea::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.json-formatter-page textarea::-webkit-scrollbar-track {
    background: transparent;
}

.json-formatter-page textarea::-webkit-scrollbar-thumb {
    background: var(--jf-border);
    border-radius: 4px;
}

.json-formatter-page textarea::-webkit-scrollbar-thumb:hover {
    background: var(--jf-text-muted);
}
