/* ========================================
   Codetude JSON Formatter - Estilos
   ======================================== */

:root {
    --json-primary: #f97316;
    --json-success: #10b981;
    --json-danger: #ef4444;
    --json-light-bg: #ffffff;
    --json-light-surface: #f8fafc;
    --json-light-border: #e2e8f0;
    --json-light-text: #1e293b;
    --json-light-text-secondary: #64748b;
    --json-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.dark-mode {
    --json-light-bg: #1e293b;
    --json-light-surface: #0f172a;
    --json-light-border: #334155;
    --json-light-text: #e2e8f0;
    --json-light-text-secondary: #94a3b8;
    --json-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

/* Container */
.codetude-json-formatter {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Seções */
.json-section {
    background: var(--json-light-bg);
    border: 1px solid var(--json-light-border);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--json-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.json-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Headers */
.section-header {
    margin-bottom: 25px;
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--json-light-text);
    margin: 0 0 10px 0;
}

.section-header h2 .icon {
    width: 28px;
    height: 28px;
    color: var(--json-primary);
    stroke-width: 2;
}

.section-description {
    color: var(--json-light-text-secondary);
    margin: 0;
    font-size: 15px;
}

/* Actions */
.json-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.json-options {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 15px;
    background: var(--json-light-surface);
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--json-light-text);
}

.option-label select {
    padding: 6px 12px;
    border: 2px solid var(--json-light-border);
    border-radius: 6px;
    background: var(--json-light-bg);
    color: var(--json-light-text);
    cursor: pointer;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--json-primary);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--json-primary);
    color: white;
}

.btn-primary:hover {
    background: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.btn-secondary {
    background: var(--json-light-surface);
    color: var(--json-light-text);
    border: 2px solid var(--json-light-border);
}

.btn-secondary:hover {
    background: var(--json-light-border);
}

.btn-copy {
    background: var(--json-success);
    color: white;
}

.btn-copy:hover {
    background: #059669;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Editor */
.json-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-header,
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.editor-header label,
.result-header label {
    font-size: 14px;
    font-weight: 600;
    color: var(--json-light-text);
}

.editor-actions {
    display: flex;
    gap: 8px;
}

#json-input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--json-light-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Courier New', 'Monaco', monospace;
    background: var(--json-light-surface);
    color: var(--json-light-text);
    resize: vertical;
    line-height: 1.6;
    transition: border-color 0.2s ease;
}

#json-input:focus {
    outline: none;
    border-color: var(--json-primary);
}

/* Stats */
.json-stats {
    display: flex;
    gap: 20px;
    padding: 10px 14px;
    background: var(--json-light-surface);
    border-radius: 6px;
    font-size: 13px;
    flex-wrap: wrap;
}

.json-stats strong {
    color: var(--json-light-text);
    font-weight: 600;
}

.json-stats span span {
    color: var(--json-primary);
    font-weight: 700;
}

/* Result */
.json-result {
    margin-top: 25px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-content {
    padding: 16px;
    background: var(--json-light-surface);
    border: 2px solid var(--json-light-border);
    border-radius: 8px;
    overflow-x: auto;
    max-height: 500px;
    margin-bottom: 10px;
}

.result-content pre {
    margin: 0;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: var(--json-light-text);
}

/* Syntax Highlighting */
.json-key { color: #0ea5e9; font-weight: 600; }
.json-string { color: #10b981; }
.json-number { color: #f59e0b; }
.json-boolean { color: #8b5cf6; font-weight: 600; }
.json-null { color: #ef4444; font-weight: 600; }

/* Error */
.json-error {
    margin-top: 20px;
    padding: 16px;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    animation: shake 0.3s ease;
}

.dark-mode .json-error {
    background: #7f1d1d;
    color: #fee2e2;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.error-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #991b1b;
    font-weight: 700;
}

.dark-mode .error-header {
    color: #fee2e2;
}

.error-header .icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.error-message {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #991b1b;
    line-height: 1.6;
}

.dark-mode .error-message {
    color: #fecaca;
}

/* Tools */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.tool-card {
    padding: 20px;
    background: var(--json-light-surface);
    border: 1px solid var(--json-light-border);
    border-radius: 10px;
}

.tool-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--json-light-text);
    margin: 0 0 8px 0;
}

.tool-card p {
    font-size: 13px;
    color: var(--json-light-text-secondary);
    margin: 0 0 12px 0;
}

.tool-card input {
    width: 100%;
    padding: 10px;
    border: 2px solid var(--json-light-border);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: var(--json-light-bg);
    color: var(--json-light-text);
    margin-bottom: 10px;
}

.tool-result {
    margin-top: 12px;
    padding: 12px;
    background: var(--json-light-bg);
    border: 1px solid var(--json-light-border);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    min-height: 60px;
    color: var(--json-light-text);
}

.stats-display {
    font-size: 13px;
    line-height: 1.8;
    color: var(--json-light-text);
}

.stats-display p {
    margin: 8px 0;
}

/* Info Cards */
.info-content {
    display: grid;
    gap: 20px;
}

.info-card {
    padding: 20px;
    background: var(--json-light-surface);
    border-left: 4px solid var(--json-primary);
    border-radius: 8px;
}

.info-card h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--json-light-text);
    margin: 0 0 12px 0;
}

.info-card p {
    color: var(--json-light-text-secondary);
    line-height: 1.6;
    margin: 0 0 10px 0;
}

.info-card ul {
    margin: 10px 0;
    padding-left: 25px;
    color: var(--json-light-text-secondary);
    line-height: 1.8;
}

.info-card code {
    background: var(--json-light-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: var(--json-primary);
}

.info-card pre {
    background: var(--json-light-bg);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

/* Toast */
.json-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--json-light-text);
    color: white;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: var(--json-shadow);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.json-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Responsivo */
@media (max-width: 768px) {
    .codetude-json-formatter {
        padding: 15px;
    }
    
    .json-section {
        padding: 20px;
    }
    
    .json-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .json-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}